1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.lum.lu.assembly; |
17 |
|
|
18 |
|
import java.util.ArrayList; |
19 |
|
import java.util.List; |
20 |
|
|
21 |
|
import org.apache.log4j.Logger; |
22 |
|
import org.kuali.rice.kim.bo.types.dto.AttributeSet; |
23 |
|
import org.kuali.student.common.assembly.data.AssemblyException; |
24 |
|
import org.kuali.student.common.assembly.data.Data; |
25 |
|
import org.kuali.student.common.assembly.data.Metadata; |
26 |
|
import org.kuali.student.common.assembly.dictionary.MetadataServiceImpl; |
27 |
|
import org.kuali.student.common.assembly.old.BaseAssembler; |
28 |
|
import org.kuali.student.common.assembly.old.data.SaveResult; |
29 |
|
import org.kuali.student.common.dto.MetaInfo; |
30 |
|
import org.kuali.student.common.dto.RichTextInfo; |
31 |
|
import org.kuali.student.common.exceptions.MissingParameterException; |
32 |
|
import org.kuali.student.common.search.dto.SearchRequest; |
33 |
|
import org.kuali.student.common.search.dto.SearchResult; |
34 |
|
import org.kuali.student.common.search.dto.SearchResultCell; |
35 |
|
import org.kuali.student.common.search.dto.SearchResultRow; |
36 |
|
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
37 |
|
import org.kuali.student.common.validation.dto.ValidationResultInfo.ErrorLevel; |
38 |
|
import org.kuali.student.common.versionmanagement.dto.VersionDisplayInfo; |
39 |
|
import org.kuali.student.lum.common.client.lo.MetaInfoHelper; |
40 |
|
import org.kuali.student.lum.common.client.widgets.CluSetHelper; |
41 |
|
import org.kuali.student.lum.common.client.widgets.CluSetRangeHelper; |
42 |
|
import org.kuali.student.lum.common.client.widgets.CluSetRangeModelUtil; |
43 |
|
import org.kuali.student.lum.lu.dto.CluInfo; |
44 |
|
import org.kuali.student.lum.lu.dto.CluSetInfo; |
45 |
|
import org.kuali.student.lum.lu.dto.MembershipQueryInfo; |
46 |
|
import org.kuali.student.lum.lu.service.LuService; |
47 |
|
import org.kuali.student.lum.lu.service.LuServiceConstants; |
48 |
|
import org.springframework.transaction.annotation.Transactional; |
49 |
|
|
50 |
|
@Transactional(readOnly=true,rollbackFor={Throwable.class}) |
|
|
| 0% |
Uncovered Elements: 401 (401) |
Complexity: 97 |
Complexity Density: 0.34 |
|
51 |
|
public class CluSetManagementAssembler extends BaseAssembler<Data, Void> { |
52 |
|
|
53 |
|
|
54 |
|
final Logger LOG = Logger.getLogger(CluSetManagementAssembler.class); |
55 |
|
|
56 |
|
public static final String JOINT_RELATION_TYPE = "kuali.lu.relation.type.co-located"; |
57 |
|
|
58 |
|
public static final String PROPOSAL_TYPE_CREATE_COURSE = "kuali.proposal.type.course.create"; |
59 |
|
public static final String FORMAT_LU_TYPE = "kuali.lu.type.CreditCourseFormatShell"; |
60 |
|
|
61 |
|
public static final String FORMAT_RELATION_TYPE = "luLuRelationType.hasCourseFormat"; |
62 |
|
public static final String ACTIVITY_RELATION_TYPE = "luLuRelationType.contains"; |
63 |
|
|
64 |
|
public static final String PROPOSAL_REFERENCE_TYPE = "kuali.proposal.referenceType.clu"; |
65 |
|
|
66 |
|
public static final String CLUSET_DATA_TYPE = "cluset"; |
67 |
|
|
68 |
|
private LuService luService; |
69 |
|
private MetadataServiceImpl metadataService; |
70 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
0
|
public MetadataServiceImpl getMetadataService() {... |
72 |
0
|
return metadataService; |
73 |
|
} |
74 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
75 |
0
|
public void setMetadataService(MetadataServiceImpl metadataService) {... |
76 |
0
|
this.metadataService = metadataService; |
77 |
|
} |
78 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
79 |
0
|
@Override... |
80 |
|
public Data get(String id) throws AssemblyException { |
81 |
|
|
82 |
0
|
CluSetHelper resultCluSetHelper = null; |
83 |
0
|
Data resultData = null; |
84 |
|
|
85 |
0
|
try { |
86 |
0
|
CluSetInfo cluSetInfo = getCluSetInfo(id); |
87 |
0
|
resultCluSetHelper = toCluSetHelper(cluSetInfo); |
88 |
0
|
if (resultCluSetHelper == null) { |
89 |
0
|
resultData = null; |
90 |
|
} else { |
91 |
|
|
92 |
|
|
93 |
0
|
resultData = resultCluSetHelper.getData(); |
94 |
|
} |
95 |
|
} catch (Exception e) { |
96 |
0
|
throw new AssemblyException("Could not retrive cluSet with id " + id, e); |
97 |
|
} |
98 |
|
|
99 |
0
|
return resultData; |
100 |
|
} |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
102 |
0
|
public CluSetInfo getCluSetInfo(String cluSetId) throws Exception {... |
103 |
0
|
List<String> cluIds = null; |
104 |
0
|
CluSetInfo cluSetInfo = null; |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
0
|
cluSetInfo = luService.getCluSetInfo(cluSetId); |
109 |
0
|
cluSetInfo.setCluIds(null); |
110 |
0
|
cluIds = luService.getCluIdsFromCluSet(cluSetId); |
111 |
0
|
cluSetInfo.setCluIds(cluIds); |
112 |
0
|
upWrap(cluSetInfo); |
113 |
0
|
return cluSetInfo; |
114 |
|
} |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
116 |
0
|
public MetaInfoHelper toMetaInfoHelper(MetaInfo metaInfo) {... |
117 |
0
|
MetaInfoHelper metaInfoHelper = null; |
118 |
0
|
Data metaData = new Data(); |
119 |
0
|
if (metaInfo == null) return null; |
120 |
0
|
metaInfoHelper = MetaInfoHelper.wrap(metaData); |
121 |
0
|
metaInfoHelper.setCreateId(metaInfo.getCreateId()); |
122 |
0
|
metaInfoHelper.setCreateTime(metaInfo.getCreateTime()); |
123 |
0
|
metaInfoHelper.setUpdateId(metaInfo.getUpdateId()); |
124 |
0
|
metaInfoHelper.setUpdateTime(metaInfo.getUpdateTime()); |
125 |
0
|
metaInfoHelper.setVersionInd(metaInfo.getVersionInd()); |
126 |
0
|
return metaInfoHelper; |
127 |
|
} |
128 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
129 |
0
|
public MetaInfo toMetaInfo(MetaInfoHelper metaInfoHelper) {... |
130 |
0
|
MetaInfo metaInfo = null; |
131 |
0
|
if (metaInfoHelper == null) return null; |
132 |
0
|
metaInfo = new MetaInfo(); |
133 |
0
|
metaInfo.setCreateId(metaInfoHelper.getCreateId()); |
134 |
0
|
metaInfo.setCreateTime(metaInfoHelper.getCreateTime()); |
135 |
0
|
metaInfo.setUpdateId(metaInfoHelper.getUpdateId()); |
136 |
0
|
metaInfo.setUpdateTime(metaInfoHelper.getUpdateTime()); |
137 |
0
|
metaInfo.setVersionInd(metaInfoHelper.getVersionInd()); |
138 |
0
|
return metaInfo; |
139 |
|
} |
140 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
141 |
0
|
public String richTextToString(RichTextInfo richTextInfo) {... |
142 |
0
|
String result = null; |
143 |
0
|
if (richTextInfo == null) return null; |
144 |
0
|
result = richTextInfo.getPlain(); |
145 |
0
|
return result; |
146 |
|
} |
147 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.25 |
|
148 |
0
|
@Override... |
149 |
|
@Transactional(readOnly=false) |
150 |
|
public SaveResult<Data> save(Data input) throws AssemblyException { |
151 |
|
|
152 |
0
|
try { |
153 |
0
|
SaveResult<Data> result = new SaveResult<Data>(); |
154 |
0
|
List<ValidationResultInfo> validationResults = validate(input); |
155 |
0
|
if (hasValidationErrors(validationResults)) { |
156 |
0
|
result.setValidationResults(validationResults); |
157 |
0
|
result.setValue(input); |
158 |
0
|
return result; |
159 |
|
} |
160 |
|
|
161 |
0
|
SaveResult<Data> clusetResult = saveCluSet(input); |
162 |
0
|
result.setValidationResults(clusetResult.getValidationResults()); |
163 |
0
|
result.setValue(clusetResult.getValue()); |
164 |
0
|
return result; |
165 |
|
} catch (Exception e) { |
166 |
0
|
throw new AssemblyException("Unable to save ....", e); |
167 |
|
} |
168 |
|
} |
169 |
|
|
|
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 15 |
Complexity Density: 0.62 |
|
170 |
0
|
private void upWrap(CluSetInfo cluSetInfo) throws AssemblyException {... |
171 |
0
|
List<String> cluSetIds = (cluSetInfo == null)? null : cluSetInfo.getCluSetIds(); |
172 |
0
|
List<String> unWrappedCluSetIds = null; |
173 |
0
|
List<CluSetInfo> wrappedCluSets = null; |
174 |
0
|
List<CluSetInfo> subCluSets = null; |
175 |
|
|
176 |
0
|
try { |
177 |
0
|
if (cluSetIds != null && !cluSetIds.isEmpty()) { |
178 |
0
|
subCluSets = luService.getCluSetInfoByIdList(cluSetIds); |
179 |
|
} |
180 |
|
} catch (Exception e) { |
181 |
0
|
LOG.error(e.getMessage(), e); |
182 |
0
|
throw new AssemblyException("Failed to retrieve the sub clusets of cluset " + |
183 |
|
cluSetInfo.getId()); |
184 |
|
} |
185 |
|
|
186 |
0
|
if (subCluSets != null) { |
187 |
0
|
for (CluSetInfo subCluSet : subCluSets) { |
188 |
0
|
if (subCluSet.getIsReusable()) { |
189 |
0
|
unWrappedCluSetIds = (unWrappedCluSetIds == null)? |
190 |
|
new ArrayList<String>() : unWrappedCluSetIds; |
191 |
0
|
unWrappedCluSetIds.add(subCluSet.getId()); |
192 |
|
} else { |
193 |
0
|
wrappedCluSets = (wrappedCluSets == null)? |
194 |
|
new ArrayList<CluSetInfo>() : wrappedCluSets; |
195 |
0
|
wrappedCluSets.add(subCluSet); |
196 |
|
} |
197 |
|
} |
198 |
|
} |
199 |
0
|
cluSetInfo.setCluSetIds(unWrappedCluSetIds); |
200 |
0
|
if (wrappedCluSets != null) { |
201 |
0
|
for (CluSetInfo wrappedCluSet : wrappedCluSets) { |
202 |
0
|
MembershipQueryInfo mqInfo = wrappedCluSet.getMembershipQuery(); |
203 |
0
|
if (wrappedCluSet.getCluIds() != null && !wrappedCluSet.getCluIds().isEmpty()) { |
204 |
0
|
cluSetInfo.setCluIds(wrappedCluSet.getCluIds()); |
205 |
|
} |
206 |
0
|
if (mqInfo != null && mqInfo.getSearchTypeKey() != null && !mqInfo.getSearchTypeKey().isEmpty()) { |
207 |
0
|
cluSetInfo.setMembershipQuery(mqInfo); |
208 |
|
} |
209 |
|
} |
210 |
|
} |
211 |
|
} |
212 |
|
|
|
|
| 0% |
Uncovered Elements: 58 (58) |
Complexity: 15 |
Complexity Density: 0.36 |
|
213 |
0
|
private void wrap(CluSetInfo cluSetInfo) throws AssemblyException {... |
214 |
0
|
int numCluSetElementTypes = 0; |
215 |
0
|
boolean hasCluIds = false; |
216 |
0
|
boolean hasCluSetIds = false; |
217 |
0
|
boolean hasMembershipQuery = false; |
218 |
0
|
List<String> wrapperCluSetIds = new ArrayList<String>(); |
219 |
0
|
MembershipQueryInfo mqInfo = null; |
220 |
0
|
if (cluSetInfo.getCluIds() != null && !cluSetInfo.getCluIds().isEmpty()) { |
221 |
0
|
numCluSetElementTypes++; |
222 |
0
|
hasCluIds = true; |
223 |
|
} |
224 |
0
|
if (cluSetInfo.getCluSetIds() != null && !cluSetInfo.getCluSetIds().isEmpty()) { |
225 |
0
|
numCluSetElementTypes++; |
226 |
0
|
hasCluSetIds = true; |
227 |
|
} |
228 |
0
|
mqInfo = cluSetInfo.getMembershipQuery(); |
229 |
0
|
if (mqInfo != null && mqInfo.getSearchTypeKey() != null && !mqInfo.getSearchTypeKey().isEmpty()) { |
230 |
0
|
numCluSetElementTypes++; |
231 |
0
|
hasMembershipQuery = true; |
232 |
|
} |
233 |
|
|
234 |
0
|
if (numCluSetElementTypes > 1) { |
235 |
0
|
if (hasCluIds) { |
236 |
0
|
CluSetInfo wrapperCluSet = new CluSetInfo(); |
237 |
0
|
setWrapperCluSetInfoValues(wrapperCluSet, cluSetInfo); |
238 |
|
|
239 |
0
|
wrapperCluSet.setCluIds(cluSetInfo.getCluIds()); |
240 |
0
|
cluSetInfo.setCluIds(null); |
241 |
0
|
try { |
242 |
0
|
if (wrapperCluSet.getType() == null) { |
243 |
0
|
wrapperCluSet.setType("kuali.cluSet.type.CreditCourse"); |
244 |
|
} |
245 |
0
|
wrapperCluSet = luService.createCluSet(wrapperCluSet.getType(), wrapperCluSet); |
246 |
|
} catch (Exception e) { |
247 |
0
|
LOG.error("Failed to create wrapper cluset",e); |
248 |
0
|
throw new AssemblyException(e); |
249 |
|
} |
250 |
0
|
wrapperCluSetIds.add(wrapperCluSet.getId()); |
251 |
|
} |
252 |
0
|
if (hasMembershipQuery) { |
253 |
0
|
CluSetInfo wrapperCluSet = new CluSetInfo(); |
254 |
0
|
setWrapperCluSetInfoValues(wrapperCluSet, cluSetInfo); |
255 |
|
|
256 |
0
|
wrapperCluSet.setMembershipQuery(mqInfo); |
257 |
0
|
cluSetInfo.setMembershipQuery(null); |
258 |
0
|
try { |
259 |
0
|
wrapperCluSet = luService.createCluSet(wrapperCluSet.getType(), wrapperCluSet); |
260 |
|
} catch (Exception e) { |
261 |
0
|
LOG.error("Failed to create wrapper cluset",e); |
262 |
0
|
throw new AssemblyException(e); |
263 |
|
} |
264 |
0
|
wrapperCluSetIds.add(wrapperCluSet.getId()); |
265 |
|
} |
266 |
0
|
if (hasCluSetIds) { |
267 |
0
|
wrapperCluSetIds.addAll(cluSetInfo.getCluSetIds()); |
268 |
|
} |
269 |
0
|
cluSetInfo.setCluSetIds(wrapperCluSetIds); |
270 |
|
} |
271 |
|
} |
272 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
273 |
0
|
private void setWrapperCluSetInfoValues(CluSetInfo wrapperCluSet, CluSetInfo cluSetInfo) {... |
274 |
0
|
wrapperCluSet.setAdminOrg(cluSetInfo.getAdminOrg()); |
275 |
0
|
wrapperCluSet.setEffectiveDate(cluSetInfo.getEffectiveDate()); |
276 |
0
|
wrapperCluSet.setExpirationDate(cluSetInfo.getExpirationDate()); |
277 |
0
|
wrapperCluSet.setIsReusable(false); |
278 |
0
|
wrapperCluSet.setIsReferenceable(false); |
279 |
0
|
wrapperCluSet.setName(cluSetInfo.getName()); |
280 |
0
|
wrapperCluSet.setState(cluSetInfo.getState()); |
281 |
0
|
wrapperCluSet.setType(cluSetInfo.getType()); |
282 |
|
} |
283 |
|
|
|
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 14 |
Complexity Density: 0.37 |
|
284 |
0
|
private SaveResult<Data> saveCluSet(Data input) throws AssemblyException {... |
285 |
0
|
SaveResult<Data> result = new SaveResult<Data>(); |
286 |
|
|
287 |
0
|
List<ValidationResultInfo> saveValidationResults = null; |
288 |
0
|
CluSetHelper cluSetHelper = new CluSetHelper(input); |
289 |
0
|
CluSetInfo cluSetInfo = toCluSetInfo(cluSetHelper); |
290 |
0
|
CluSetInfo updatedCluSetInfo = null; |
291 |
0
|
CluSetHelper resultCluSetHelper = null; |
292 |
0
|
Data resultData = null; |
293 |
0
|
wrap(cluSetInfo); |
294 |
|
|
295 |
0
|
if ((cluSetInfo.getCluIds() == null || cluSetInfo.getCluIds().isEmpty()) && |
296 |
|
(cluSetInfo.getCluSetIds() == null || cluSetInfo.getCluSetIds().isEmpty()) && |
297 |
|
(cluSetInfo.getMembershipQuery() == null)){ |
298 |
0
|
ValidationResultInfo cluSetCannotBeEmpty = new ValidationResultInfo(); |
299 |
0
|
saveValidationResults = (saveValidationResults == null)? new ArrayList<ValidationResultInfo>() : |
300 |
|
saveValidationResults; |
301 |
0
|
result.setValue(null); |
302 |
0
|
cluSetCannotBeEmpty.setElement(""); |
303 |
0
|
cluSetCannotBeEmpty.setMessage("Clu set cannot be empty"); |
304 |
0
|
cluSetCannotBeEmpty.setError("Clu set cannot be empty"); |
305 |
0
|
cluSetCannotBeEmpty.setLevel(ErrorLevel.ERROR); |
306 |
0
|
saveValidationResults.add(cluSetCannotBeEmpty); |
307 |
0
|
result.setValidationResults(saveValidationResults); |
308 |
0
|
return result; |
309 |
|
} |
310 |
|
|
311 |
0
|
if (cluSetInfo.getId() != null && cluSetInfo.getId().trim().length() > 0) { |
312 |
0
|
try { |
313 |
0
|
updatedCluSetInfo = luService.updateCluSet(cluSetInfo.getId(), cluSetInfo); |
314 |
|
} catch (Exception e) { |
315 |
0
|
LOG.error("Failed to update cluset",e); |
316 |
0
|
throw new AssemblyException(e); |
317 |
|
} |
318 |
|
} else { |
319 |
0
|
try { |
320 |
0
|
if (cluSetInfo.getType() == null) { |
321 |
0
|
cluSetInfo.setType("kuali.cluSet.type.CreditCourse"); |
322 |
|
} |
323 |
0
|
updatedCluSetInfo = luService.createCluSet(cluSetInfo.getType(), cluSetInfo); |
324 |
|
} catch (Exception e) { |
325 |
0
|
LOG.error("Failed to create cluset",e); |
326 |
0
|
throw new AssemblyException(e); |
327 |
|
} |
328 |
|
} |
329 |
0
|
try { |
330 |
0
|
resultCluSetHelper = toCluSetHelper(updatedCluSetInfo); |
331 |
|
} catch (Exception e) { |
332 |
0
|
throw new AssemblyException(e); |
333 |
|
} |
334 |
0
|
if (resultCluSetHelper == null) { |
335 |
0
|
resultData = null; |
336 |
|
} else { |
337 |
|
|
338 |
|
|
339 |
0
|
resultData = resultCluSetHelper.getData(); |
340 |
|
} |
341 |
0
|
result.setValue(resultData); |
342 |
0
|
return result; |
343 |
|
} |
344 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 3 |
Complexity Density: 0.21 |
|
345 |
0
|
private List<String> getMembershipQuerySearchResult(MembershipQueryInfo query) throws MissingParameterException {... |
346 |
0
|
if(query == null) { |
347 |
0
|
return null; |
348 |
|
} |
349 |
0
|
SearchRequest sr = new SearchRequest(); |
350 |
0
|
sr.setSearchKey(query.getSearchTypeKey()); |
351 |
0
|
sr.setParams(query.getQueryParamValueList()); |
352 |
|
|
353 |
0
|
SearchResult result = luService.search(sr); |
354 |
|
|
355 |
0
|
List<String> cluIds = new ArrayList<String>(); |
356 |
0
|
List<SearchResultRow> rows = result.getRows(); |
357 |
0
|
for(SearchResultRow row : rows) { |
358 |
0
|
List<SearchResultCell> cells = row.getCells(); |
359 |
0
|
for(SearchResultCell cell : cells) { |
360 |
0
|
if(cell.getKey().equals("lu.resultColumn.cluId")) { |
361 |
0
|
cluIds.add(cell.getValue()); |
362 |
|
} |
363 |
|
} |
364 |
|
} |
365 |
0
|
return cluIds; |
366 |
|
} |
367 |
|
|
|
|
| 0% |
Uncovered Elements: 50 (50) |
Complexity: 9 |
Complexity Density: 0.24 |
|
368 |
0
|
private CluSetHelper toCluSetHelper(CluSetInfo cluSetInfo) throws Exception {... |
369 |
0
|
Data data = new Data(); |
370 |
0
|
Data cluSetDetailData = new Data(); |
371 |
0
|
data.set("cluset", cluSetDetailData); |
372 |
0
|
CluSetHelper result = CluSetHelper.wrap(cluSetDetailData); |
373 |
0
|
if (cluSetInfo != null) { |
374 |
0
|
if (cluSetInfo.getCluIds() != null && !cluSetInfo.getCluIds().isEmpty()) { |
375 |
0
|
List<CluInfo> cluInfos = new ArrayList<CluInfo>(); |
376 |
0
|
for(String id:cluSetInfo.getCluIds()){ |
377 |
0
|
VersionDisplayInfo versionInfo = luService.getCurrentVersion(LuServiceConstants.CLU_NAMESPACE_URI, id); |
378 |
0
|
cluInfos.add(luService.getClu(versionInfo.getId())); |
379 |
|
} |
380 |
0
|
result.setApprovedClus(new Data()); |
381 |
0
|
for (CluInfo cluInfo : cluInfos) { |
382 |
0
|
if (cluInfo.getState().equals("Active")) { |
383 |
0
|
result.getApprovedClus().add(cluInfo.getVersionInfo().getVersionIndId()); |
384 |
|
} else { |
385 |
0
|
result.getProposedClus().add(cluInfo.getVersionInfo().getVersionIndId()); |
386 |
|
} |
387 |
0
|
result.getAllClus().add(cluInfo.getVersionInfo().getVersionIndId()); |
388 |
|
} |
389 |
|
} |
390 |
0
|
if (cluSetInfo.getCluSetIds() != null && !cluSetInfo.getCluSetIds().isEmpty()) { |
391 |
0
|
result.setCluSets(new Data()); |
392 |
0
|
for (String cluSetId : cluSetInfo.getCluSetIds()) { |
393 |
0
|
result.getCluSets().add(cluSetId); |
394 |
|
} |
395 |
|
} |
396 |
0
|
if (cluSetInfo.getMembershipQuery() != null) { |
397 |
0
|
MembershipQueryInfo mq = cluSetInfo.getMembershipQuery(); |
398 |
0
|
List<String> cluRangeCluIds = getMembershipQuerySearchResult(mq); |
399 |
0
|
if (cluRangeCluIds != null) { |
400 |
0
|
result.setCluRangeViewDetails(new Data()); |
401 |
0
|
for (String cluRangeCluId : cluRangeCluIds) { |
402 |
0
|
result.getCluRangeViewDetails().add(cluRangeCluId); |
403 |
|
} |
404 |
|
} |
405 |
|
} |
406 |
0
|
result.setDescription(richTextToString(cluSetInfo.getDescr())); |
407 |
0
|
result.setEffectiveDate(cluSetInfo.getEffectiveDate()); |
408 |
0
|
result.setExpirationDate(cluSetInfo.getExpirationDate()); |
409 |
0
|
result.setId(cluSetInfo.getId()); |
410 |
0
|
result.setMetaInfo(toMetaInfoHelper(cluSetInfo.getMetaInfo())); |
411 |
0
|
result.setName(cluSetInfo.getName()); |
412 |
0
|
result.setOrganization(cluSetInfo.getAdminOrg()); |
413 |
0
|
result.setState(cluSetInfo.getState()); |
414 |
0
|
result.setType(cluSetInfo.getType()); |
415 |
0
|
result.setCluRangeParams(CluSetRangeModelUtil.INSTANCE.toData( |
416 |
|
cluSetInfo.getMembershipQuery())); |
417 |
|
} |
418 |
0
|
return result; |
419 |
|
} |
420 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
421 |
0
|
private void addToCluIds(Data clusData, final List<String> cluIds) {... |
422 |
0
|
if (clusData != null) { |
423 |
0
|
for (Data.Property p : clusData) { |
424 |
0
|
if(!"_runtimeData".equals(p.getKey())){ |
425 |
0
|
String cluId = p.getValue(); |
426 |
0
|
cluIds.add(cluId); |
427 |
|
} |
428 |
|
} |
429 |
|
} |
430 |
|
} |
431 |
|
|
|
|
| 0% |
Uncovered Elements: 51 (51) |
Complexity: 10 |
Complexity Density: 0.29 |
|
432 |
0
|
private CluSetInfo toCluSetInfo(CluSetHelper cluSetHelper) {... |
433 |
0
|
CluSetInfo cluSetInfo = new CluSetInfo(); |
434 |
0
|
Data approvedClusData = cluSetHelper.getApprovedClus(); |
435 |
0
|
Data proposedClusData = cluSetHelper.getProposedClus(); |
436 |
0
|
Data cluSetsData = cluSetHelper.getCluSets(); |
437 |
0
|
final List<String> cluIds = new ArrayList<String>(); |
438 |
0
|
List<String> cluSetIds = null; |
439 |
|
|
440 |
0
|
cluSetInfo.setId(cluSetHelper.getId()); |
441 |
0
|
if (approvedClusData != null) { |
442 |
0
|
addToCluIds(approvedClusData, cluIds); |
443 |
|
} |
444 |
0
|
if (proposedClusData != null) { |
445 |
0
|
addToCluIds(proposedClusData, cluIds); |
446 |
|
} |
447 |
0
|
if (cluIds != null && !cluIds.isEmpty()) { |
448 |
0
|
cluSetInfo.setCluIds(cluIds); |
449 |
|
} |
450 |
0
|
if (cluSetsData != null) { |
451 |
0
|
for (Data.Property p : cluSetsData) { |
452 |
0
|
if(!"_runtimeData".equals(p.getKey())){ |
453 |
0
|
String cluSetId = p.getValue(); |
454 |
0
|
cluSetIds = (cluSetIds == null)? new ArrayList<String>(3) : |
455 |
|
cluSetIds; |
456 |
0
|
cluSetIds.add(cluSetId); |
457 |
|
} |
458 |
|
} |
459 |
|
} |
460 |
0
|
if (cluSetIds != null) { |
461 |
0
|
cluSetInfo.setCluSetIds(cluSetIds); |
462 |
|
} |
463 |
0
|
cluSetInfo.setAdminOrg(cluSetHelper.getOrganization()); |
464 |
0
|
cluSetInfo.setDescr(toRichTextInfo(cluSetHelper.getDescription())); |
465 |
0
|
cluSetInfo.setEffectiveDate(cluSetHelper.getEffectiveDate()); |
466 |
0
|
cluSetInfo.setExpirationDate(cluSetHelper.getExpirationDate()); |
467 |
0
|
cluSetInfo.setMembershipQuery(toMembershipQueryInfo(cluSetHelper.getCluRangeParams())); |
468 |
|
|
469 |
0
|
cluSetInfo.setMetaInfo(toMetaInfo(cluSetHelper.getMetaInfo())); |
470 |
0
|
cluSetInfo.setName(cluSetHelper.getName()); |
471 |
0
|
cluSetInfo.setState(cluSetHelper.getState()); |
472 |
0
|
if (cluSetInfo.getState() == null) { |
473 |
0
|
cluSetInfo.setState("active"); |
474 |
|
} |
475 |
0
|
cluSetInfo.setType(cluSetHelper.getType()); |
476 |
0
|
cluSetInfo.setIsReusable(cluSetHelper.getReusable()); |
477 |
0
|
cluSetInfo.setIsReferenceable(cluSetHelper.getReferenceable()); |
478 |
0
|
return cluSetInfo; |
479 |
|
} |
480 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
481 |
0
|
private MembershipQueryInfo toMembershipQueryInfo(CluSetRangeHelper cluSetRangeHelper) {... |
482 |
0
|
return CluSetRangeModelUtil.INSTANCE.toMembershipQueryInfo(cluSetRangeHelper.getData()); |
483 |
|
} |
484 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
485 |
0
|
private RichTextInfo toRichTextInfo(String text) {... |
486 |
0
|
RichTextInfo result = new RichTextInfo(); |
487 |
0
|
if (text == null) return null; |
488 |
0
|
result.setPlain(text); |
489 |
0
|
result.setFormatted(text); |
490 |
0
|
return result; |
491 |
|
} |
492 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
493 |
0
|
@Override... |
494 |
|
public Data assemble(Void input) throws AssemblyException { |
495 |
0
|
throw new UnsupportedOperationException("Data assembly not supported"); |
496 |
|
} |
497 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
498 |
0
|
@Override... |
499 |
|
public Void disassemble(Data input) throws AssemblyException { |
500 |
0
|
throw new UnsupportedOperationException("Data disassembly not supported"); |
501 |
|
} |
502 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
503 |
0
|
public LuService getLuService() {... |
504 |
0
|
return luService; |
505 |
|
} |
506 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
507 |
0
|
public void setLuService(LuService luService) {... |
508 |
0
|
this.luService = luService; |
509 |
|
} |
510 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
511 |
0
|
@Override... |
512 |
|
protected String getDataType() { |
513 |
0
|
return CLUSET_DATA_TYPE; |
514 |
|
} |
515 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
516 |
0
|
@Override... |
517 |
|
public Metadata getDefaultMetadata() { |
518 |
|
|
519 |
0
|
return metadataService.getMetadata(getDataType()); |
520 |
|
} |
521 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
522 |
0
|
@Override... |
523 |
|
protected String getDocumentPropertyName() { |
524 |
0
|
return "course"; |
525 |
|
} |
526 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
527 |
0
|
@Override... |
528 |
|
protected String getDtoName() { |
529 |
0
|
return "kuali.lu.type.CreditCourse"; |
530 |
|
} |
531 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
532 |
0
|
@Override... |
533 |
|
protected AttributeSet getQualification(String idType, String id) { |
534 |
0
|
String DOCUMENT_TYPE_NAME = "documentTypeName"; |
535 |
0
|
AttributeSet qualification = new AttributeSet(); |
536 |
0
|
qualification.put(DOCUMENT_TYPE_NAME, "CluCreditCourse"); |
537 |
|
|
538 |
|
|
539 |
|
|
540 |
|
|
541 |
|
|
542 |
|
|
543 |
0
|
qualification.put(idType, id); |
544 |
0
|
return qualification; |
545 |
|
} |
546 |
|
|
547 |
|
} |