1
2
3
4
5
6
7
8
9
10
11
12
13
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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 public class NLCluSet {
39
40 private String cluSetId;
41 private List<CluInfo> cluList;
42
43 public NLCluSet(String cluSetId, List<CluInfo> cluList) {
44 this.cluSetId = cluSetId;
45 this.cluList = cluList;
46 }
47
48
49
50
51
52
53 public String getCluSetId() {
54 return cluSetId;
55 }
56
57
58
59
60
61
62 public List<CluInfo> getCluList() {
63 return this.cluList;
64 }
65
66
67
68
69
70
71
72 public String getCluAsShortName(int index) {
73 return this.cluList.get(index).getOfficialIdentifier().getShortName();
74 }
75
76
77
78
79
80
81 public String getCluAsCode(int index) {
82 return this.cluList.get(index).getOfficialIdentifier().getCode();
83 }
84
85
86
87
88
89
90
91 public String getCluSetAsShortName() {
92 StringBuilder sb = new StringBuilder();
93 if (this.cluList.size() > 1) {
94 sb.append("(");
95 }
96 for(CluInfo clu : this.cluList) {
97 sb.append(clu.getOfficialIdentifier().getShortName());
98 if (this.cluList.indexOf(clu) < (this.cluList.size() - 1)) {
99 sb.append(", ");
100 }
101 }
102 if (this.cluList.size() > 1) {
103 sb.append(")");
104 }
105 return getString(sb);
106 }
107
108
109
110
111
112
113
114 public String getCluSetAsLongName() {
115 StringBuilder sb = new StringBuilder();
116 if (this.cluList.size() > 1) {
117 sb.append("(");
118 }
119 for(CluInfo clu : this.cluList) {
120 sb.append(clu.getOfficialIdentifier().getLongName());
121 if (this.cluList.indexOf(clu) < (this.cluList.size() - 1)) {
122 sb.append(", ");
123 }
124 }
125 if (this.cluList.size() > 1) {
126 sb.append(")");
127 }
128 return getString(sb);
129 }
130
131
132
133
134
135
136
137 public String getCluSetAsCode() {
138 StringBuilder sb = new StringBuilder();
139 if (this.cluList.size() > 1) {
140 sb.append("(");
141 }
142 for(CluInfo clu : this.cluList) {
143 sb.append(clu.getOfficialIdentifier().getCode());
144 if (this.cluList.indexOf(clu) < (this.cluList.size() - 1)) {
145 sb.append(", ");
146 }
147 }
148 if (this.cluList.size() > 1) {
149 sb.append(")");
150 }
151 return getString(sb);
152 }
153
154 private String getString(StringBuilder sb) {
155 return (sb.length() == 0 ? "No CLUs available in CluSet" : sb.toString());
156 }
157
158 public String toString() {
159 if(this.cluList == null) {
160 return "Null CluSet";
161 }
162 return "id=" + this.cluSetId;
163 }
164 }