Clover Coverage Report - Kuali Student 1.3.0-SNAPSHOT (Aggregated)
Coverage timestamp: Thu Apr 28 2011 05:03:32 EDT
../../../../../../../../img/srcFileCovDistChart0.png 2% of files have more coverage
40   164   21   4
22   80   0.52   10
10     2.1  
1    
 
  NLCluSet       Line # 38 40 0% 21 72 0% 0.0
 
No Tests
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
14    */
15   
16    package org.kuali.student.lum.statement.config.context.util;
17   
18    import java.util.List;
19   
20    import org.kuali.student.lum.lu.dto.CluInfo;
21   
22    /**
23    * <p><b><u>Warning</u></b><br/>
24    * DO NOT change the public method signatures of this class.<br/>
25    * The natural language templates are coded against this class's public methods.
26    * If the method signatures are changed then all the templates referencing
27    * this class will need to be changed as well.</p>
28    *
29    * This class is inserted into the template engine to get Clu and CluSet
30    * information. <code>$cluSet</code> is this class.
31    * <p>
32    * Example:
33    * <code>"Student must have completed $intValue of $cluSet.getCluSetAsShortName()"</code>
34    * </p>
35    *
36    * {@link MockCluSetInfo} wrapper class.
37    */
 
38    public class NLCluSet {
39   
40    private String cluSetId;
41    private List<CluInfo> cluList;
42   
 
43  0 toggle public NLCluSet(String cluSetId, List<CluInfo> cluList) {
44  0 this.cluSetId = cluSetId;
45  0 this.cluList = cluList;
46    }
47   
48    /**
49    * Gets the CLU set id.
50    *
51    * @return Clu set id
52    */
 
53  0 toggle public String getCluSetId() {
54  0 return cluSetId;
55    }
56   
57    /**
58    * Gets a list of CLUs.
59    *
60    * @return List of CLUs
61    */
 
62  0 toggle public List<CluInfo> getCluList() {
63  0 return this.cluList;
64    }
65   
66    /**
67    * Gets a particular CLU's official identifier short name.
68    *
69    * @param index Index in CLU set
70    * @return CLU official identifier short name
71    */
 
72  0 toggle public String getCluAsShortName(int index) {
73  0 return this.cluList.get(index).getOfficialIdentifier().getShortName();
74    }
75   
76    /**
77    * Gets a particular CLU's official identifier code at <code>index</code>
78    * @param index
79    * @return CLU's official identifier code
80    */
 
81  0 toggle public String getCluAsCode(int index) {
82  0 return this.cluList.get(index).getOfficialIdentifier().getCode();
83    }
84   
85    /**
86    * Gets all the CLUs' official identifier short name in the CLU set
87    * as a comma separated list.
88    *
89    * @return Comma separated list of CLUs' official identifier short name
90    */
 
91  0 toggle public String getCluSetAsShortName() {
92  0 StringBuilder sb = new StringBuilder();
93  0 if (this.cluList.size() > 1) {
94  0 sb.append("(");
95    }
96  0 for(CluInfo clu : this.cluList) {
97  0 sb.append(clu.getOfficialIdentifier().getShortName());
98  0 if (this.cluList.indexOf(clu) < (this.cluList.size() - 1)) {
99  0 sb.append(", ");
100    }
101    }
102  0 if (this.cluList.size() > 1) {
103  0 sb.append(")");
104    }
105  0 return getString(sb);
106    }
107   
108    /**
109    * Gets all the CLUs' official identifier long name in the CLU set
110    * as a comma separated list.
111    *
112    * @return Comma separated list of CLUs' official identifier long name
113    */
 
114  0 toggle public String getCluSetAsLongName() {
115  0 StringBuilder sb = new StringBuilder();
116  0 if (this.cluList.size() > 1) {
117  0 sb.append("(");
118    }
119  0 for(CluInfo clu : this.cluList) {
120  0 sb.append(clu.getOfficialIdentifier().getLongName());
121  0 if (this.cluList.indexOf(clu) < (this.cluList.size() - 1)) {
122  0 sb.append(", ");
123    }
124    }
125  0 if (this.cluList.size() > 1) {
126  0 sb.append(")");
127    }
128  0 return getString(sb);
129    }
130   
131    /**
132    * Gets all the CLUs' official identifier code in the CLU set
133    * as a comma separated list.
134    *
135    * @return Comma separated list of CLUs' official identifier code
136    */
 
137  0 toggle public String getCluSetAsCode() {
138  0 StringBuilder sb = new StringBuilder();
139  0 if (this.cluList.size() > 1) {
140  0 sb.append("(");
141    }
142  0 for(CluInfo clu : this.cluList) {
143  0 sb.append(clu.getOfficialIdentifier().getCode());
144  0 if (this.cluList.indexOf(clu) < (this.cluList.size() - 1)) {
145  0 sb.append(", ");
146    }
147    }
148  0 if (this.cluList.size() > 1) {
149  0 sb.append(")");
150    }
151  0 return getString(sb);
152    }
153   
 
154  0 toggle private String getString(StringBuilder sb) {
155  0 return (sb.length() == 0 ? "No CLUs available in CluSet" : sb.toString());
156    }
157   
 
158  0 toggle public String toString() {
159  0 if(this.cluList == null) {
160  0 return "Null CluSet";
161    }
162  0 return "id=" + this.cluSetId;
163    }
164    }