1 |
|
package org.kuali.student.lum.program.service.impl; |
2 |
|
|
3 |
|
import static org.apache.commons.collections.CollectionUtils.isNotEmpty; |
4 |
|
|
5 |
|
import java.util.ArrayList; |
6 |
|
import java.util.Date; |
7 |
|
import java.util.List; |
8 |
|
|
9 |
|
import org.apache.log4j.Logger; |
10 |
|
import org.kuali.student.common.assembly.BaseDTOAssemblyNode; |
11 |
|
import org.kuali.student.common.assembly.BusinessServiceMethodInvoker; |
12 |
|
import org.kuali.student.common.assembly.BaseDTOAssemblyNode.NodeOperation; |
13 |
|
import org.kuali.student.common.assembly.data.AssemblyException; |
14 |
|
import org.kuali.student.common.dictionary.dto.DataType; |
15 |
|
import org.kuali.student.common.dictionary.dto.ObjectStructureDefinition; |
16 |
|
import org.kuali.student.common.dictionary.service.DictionaryService; |
17 |
|
import org.kuali.student.common.dto.DtoConstants; |
18 |
|
import org.kuali.student.common.dto.StatusInfo; |
19 |
|
import org.kuali.student.common.exceptions.AlreadyExistsException; |
20 |
|
import org.kuali.student.common.exceptions.CircularReferenceException; |
21 |
|
import org.kuali.student.common.exceptions.CircularRelationshipException; |
22 |
|
import org.kuali.student.common.exceptions.DataValidationErrorException; |
23 |
|
import org.kuali.student.common.exceptions.DependentObjectsExistException; |
24 |
|
import org.kuali.student.common.exceptions.DoesNotExistException; |
25 |
|
import org.kuali.student.common.exceptions.IllegalVersionSequencingException; |
26 |
|
import org.kuali.student.common.exceptions.InvalidParameterException; |
27 |
|
import org.kuali.student.common.exceptions.MissingParameterException; |
28 |
|
import org.kuali.student.common.exceptions.OperationFailedException; |
29 |
|
import org.kuali.student.common.exceptions.PermissionDeniedException; |
30 |
|
import org.kuali.student.common.exceptions.UnsupportedActionException; |
31 |
|
import org.kuali.student.common.exceptions.VersionMismatchException; |
32 |
|
import org.kuali.student.common.search.dto.SearchCriteriaTypeInfo; |
33 |
|
import org.kuali.student.common.search.dto.SearchRequest; |
34 |
|
import org.kuali.student.common.search.dto.SearchResult; |
35 |
|
import org.kuali.student.common.search.dto.SearchResultTypeInfo; |
36 |
|
import org.kuali.student.common.search.dto.SearchTypeInfo; |
37 |
|
import org.kuali.student.common.search.service.SearchManager; |
38 |
|
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
39 |
|
import org.kuali.student.common.validator.ServerDateParser; |
40 |
|
import org.kuali.student.common.validator.Validator; |
41 |
|
import org.kuali.student.common.validator.ValidatorFactory; |
42 |
|
import org.kuali.student.common.validator.ValidatorUtils; |
43 |
|
import org.kuali.student.common.versionmanagement.dto.VersionDisplayInfo; |
44 |
|
import org.kuali.student.core.atp.dto.AtpInfo; |
45 |
|
import org.kuali.student.core.atp.service.AtpService; |
46 |
|
import org.kuali.student.core.document.dto.RefDocRelationInfo; |
47 |
|
import org.kuali.student.core.document.service.DocumentService; |
48 |
|
import org.kuali.student.core.statement.dto.ReqCompFieldInfo; |
49 |
|
import org.kuali.student.core.statement.dto.ReqComponentInfo; |
50 |
|
import org.kuali.student.core.statement.dto.StatementTreeViewInfo; |
51 |
|
import org.kuali.student.lum.course.dto.LoDisplayInfo; |
52 |
|
import org.kuali.student.lum.lu.dto.CluCluRelationInfo; |
53 |
|
import org.kuali.student.lum.lu.dto.CluInfo; |
54 |
|
import org.kuali.student.lum.lu.dto.CluSetInfo; |
55 |
|
import org.kuali.student.lum.lu.dto.LuTypeInfo; |
56 |
|
import org.kuali.student.lum.lu.service.LuService; |
57 |
|
import org.kuali.student.lum.lu.service.LuServiceConstants; |
58 |
|
import org.kuali.student.lum.program.dto.CoreProgramInfo; |
59 |
|
import org.kuali.student.lum.program.dto.CredentialProgramInfo; |
60 |
|
import org.kuali.student.lum.program.dto.HonorsProgramInfo; |
61 |
|
import org.kuali.student.lum.program.dto.MajorDisciplineInfo; |
62 |
|
import org.kuali.student.lum.program.dto.MinorDisciplineInfo; |
63 |
|
import org.kuali.student.lum.program.dto.ProgramRequirementInfo; |
64 |
|
import org.kuali.student.lum.program.dto.ProgramVariationInfo; |
65 |
|
import org.kuali.student.lum.program.service.ProgramService; |
66 |
|
import org.kuali.student.lum.program.service.ProgramServiceConstants; |
67 |
|
import org.kuali.student.lum.program.service.assembler.CoreProgramAssembler; |
68 |
|
import org.kuali.student.lum.program.service.assembler.CredentialProgramAssembler; |
69 |
|
import org.kuali.student.lum.program.service.assembler.MajorDisciplineAssembler; |
70 |
|
import org.kuali.student.lum.program.service.assembler.ProgramAssemblerConstants; |
71 |
|
import org.kuali.student.lum.statement.typekey.ReqComponentFieldTypes; |
72 |
|
import org.springframework.transaction.annotation.Transactional; |
73 |
|
|
74 |
|
@Transactional(readOnly=true,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
|
|
| 63.4% |
Uncovered Elements: 217 (593) |
Complexity: 191 |
Complexity Density: 0.47 |
|
75 |
|
public class ProgramServiceImpl implements ProgramService { |
76 |
|
final static Logger LOG = Logger.getLogger(ProgramServiceImpl.class); |
77 |
|
|
78 |
|
private LuService luService; |
79 |
|
private ValidatorFactory validatorFactory; |
80 |
|
private BusinessServiceMethodInvoker programServiceMethodInvoker; |
81 |
|
private DictionaryService dictionaryService; |
82 |
|
private SearchManager searchManager; |
83 |
|
private MajorDisciplineAssembler majorDisciplineAssembler; |
84 |
|
private ProgramRequirementAssembler programRequirementAssembler; |
85 |
|
private CredentialProgramAssembler credentialProgramAssembler; |
86 |
|
private CoreProgramAssembler coreProgramAssembler; |
87 |
|
|
88 |
|
private AtpService atpService; |
89 |
|
private DocumentService documentService; |
90 |
|
|
91 |
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 4 |
Complexity Density: 0.5 |
|
92 |
1
|
@Override... |
93 |
|
@Transactional(readOnly=false) |
94 |
|
public CredentialProgramInfo createCredentialProgram( |
95 |
|
CredentialProgramInfo credentialProgramInfo) |
96 |
|
throws AlreadyExistsException, DataValidationErrorException, |
97 |
|
InvalidParameterException, MissingParameterException, |
98 |
|
OperationFailedException, PermissionDeniedException { |
99 |
|
|
100 |
1
|
checkForMissingParameter(credentialProgramInfo, "CredentialProgramInfo"); |
101 |
|
|
102 |
|
|
103 |
1
|
List<ValidationResultInfo> validationResults = validateCredentialProgram("OBJECT", credentialProgramInfo); |
104 |
1
|
if (null != validationResults && validationResults.size() > 0) { |
105 |
0
|
throw new DataValidationErrorException("Validation error!", validationResults); |
106 |
|
} |
107 |
|
|
108 |
1
|
try { |
109 |
1
|
return processCredentialProgramInfo(credentialProgramInfo, NodeOperation.CREATE); |
110 |
|
} catch (AssemblyException e) { |
111 |
0
|
LOG.error("Error disassembling Credential Program", e); |
112 |
0
|
throw new OperationFailedException("Error disassembling Credential Program"); |
113 |
|
} |
114 |
|
} |
115 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
1
|
@Override... |
117 |
|
@Transactional(readOnly=false) |
118 |
|
public HonorsProgramInfo createHonorsProgram( |
119 |
|
HonorsProgramInfo honorsProgramInfo) throws AlreadyExistsException, |
120 |
|
DataValidationErrorException, InvalidParameterException, |
121 |
|
MissingParameterException, OperationFailedException, |
122 |
|
PermissionDeniedException { |
123 |
|
|
124 |
1
|
return null; |
125 |
|
} |
126 |
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
127 |
7
|
@Override... |
128 |
|
@Transactional(readOnly=false) |
129 |
|
public ProgramRequirementInfo createProgramRequirement( |
130 |
|
ProgramRequirementInfo programRequirementInfo) |
131 |
|
throws AlreadyExistsException, DataValidationErrorException, |
132 |
|
InvalidParameterException, MissingParameterException, |
133 |
|
OperationFailedException, PermissionDeniedException { |
134 |
7
|
checkForMissingParameter(programRequirementInfo, "programRequirementInfo"); |
135 |
|
|
136 |
|
|
137 |
6
|
List<ValidationResultInfo> validationResults = validateProgramRequirement("OBJECT", programRequirementInfo); |
138 |
6
|
if (isNotEmpty(validationResults)) { |
139 |
0
|
throw new DataValidationErrorException("Validation error!", validationResults); |
140 |
|
} |
141 |
|
|
142 |
6
|
try { |
143 |
6
|
return processProgramRequirement(programRequirementInfo, NodeOperation.CREATE); |
144 |
|
} catch (AssemblyException e) { |
145 |
0
|
LOG.error("Error disassembling Program Requirement", e); |
146 |
0
|
throw new OperationFailedException("Error disassembling Program Requirement", e); |
147 |
|
} |
148 |
|
} |
149 |
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 4 |
Complexity Density: 0.5 |
|
150 |
3
|
@Override... |
151 |
|
@Transactional(readOnly=false) |
152 |
|
public MajorDisciplineInfo createMajorDiscipline( |
153 |
|
MajorDisciplineInfo majorDisciplineInfo) |
154 |
|
throws AlreadyExistsException, DataValidationErrorException, |
155 |
|
InvalidParameterException, MissingParameterException, |
156 |
|
OperationFailedException, PermissionDeniedException { |
157 |
|
|
158 |
3
|
checkForMissingParameter(majorDisciplineInfo, "MajorDisciplineInfo"); |
159 |
|
|
160 |
|
|
161 |
3
|
List<ValidationResultInfo> validationResults = validateMajorDiscipline("OBJECT", majorDisciplineInfo); |
162 |
3
|
if (null != validationResults && validationResults.size() > 0) { |
163 |
0
|
throw new DataValidationErrorException("Validation error!", validationResults); |
164 |
|
} |
165 |
|
|
166 |
3
|
try { |
167 |
3
|
return processMajorDisciplineInfo(majorDisciplineInfo, NodeOperation.CREATE); |
168 |
|
} catch (AssemblyException e) { |
169 |
0
|
LOG.error("Error creating Major Discipline", e); |
170 |
0
|
throw new OperationFailedException("Error creating Major Discipline"); |
171 |
|
} |
172 |
|
} |
173 |
|
|
|
|
| 62.5% |
Uncovered Elements: 6 (16) |
Complexity: 7 |
Complexity Density: 0.44 |
|
174 |
2
|
@Override... |
175 |
|
@Transactional(readOnly=false) |
176 |
|
public MajorDisciplineInfo createNewMajorDisciplineVersion( |
177 |
|
String majorDisciplineVerIndId, String versionComment) |
178 |
|
throws DoesNotExistException, InvalidParameterException, |
179 |
|
MissingParameterException, OperationFailedException, |
180 |
|
PermissionDeniedException, VersionMismatchException, DataValidationErrorException { |
181 |
|
|
182 |
2
|
VersionDisplayInfo currentVersion = luService.getCurrentVersion(LuServiceConstants.CLU_NAMESPACE_URI, majorDisciplineVerIndId); |
183 |
2
|
MajorDisciplineInfo originalMajorDicipline = getMajorDiscipline(currentVersion.getId()); |
184 |
|
|
185 |
|
|
186 |
2
|
CluInfo newVersionClu = luService.createNewCluVersion(majorDisciplineVerIndId, versionComment); |
187 |
|
|
188 |
2
|
try { |
189 |
2
|
BaseDTOAssemblyNode<MajorDisciplineInfo, CluInfo> results; |
190 |
|
|
191 |
|
|
192 |
2
|
majorDisciplineAssembler.assemble(newVersionClu, originalMajorDicipline, true); |
193 |
|
|
194 |
|
|
195 |
2
|
processCopy(originalMajorDicipline, currentVersion.getId()); |
196 |
|
|
197 |
|
|
198 |
2
|
results = majorDisciplineAssembler.disassemble(originalMajorDicipline, NodeOperation.UPDATE); |
199 |
|
|
200 |
|
|
201 |
2
|
programServiceMethodInvoker.invokeServiceCalls(results); |
202 |
|
|
203 |
2
|
return results.getBusinessDTORef(); |
204 |
|
} catch(AssemblyException e) { |
205 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
206 |
|
} catch (AlreadyExistsException e) { |
207 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
208 |
|
} catch (DependentObjectsExistException e) { |
209 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
210 |
|
} catch (CircularRelationshipException e) { |
211 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
212 |
|
} catch (UnsupportedActionException e) { |
213 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
214 |
|
} catch (CircularReferenceException e) { |
215 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
216 |
|
} |
217 |
|
} |
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
@param |
225 |
|
@throws |
226 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.4 |
|
227 |
0
|
private void clearStatementTreeViewIdsRecursively(StatementTreeViewInfo statementTreeView) throws OperationFailedException{... |
228 |
0
|
if(statementTreeView!=null){ |
229 |
0
|
statementTreeView.setId(null); |
230 |
0
|
for(ReqComponentInfo reqComp:statementTreeView.getReqComponents()){ |
231 |
0
|
reqComp.setId(null); |
232 |
0
|
for(ReqCompFieldInfo field:reqComp.getReqCompFields()){ |
233 |
0
|
field.setId(null); |
234 |
|
|
235 |
0
|
if(ReqComponentFieldTypes.COURSE_CLUSET_KEY.getId().equals(field.getType())|| |
236 |
|
ReqComponentFieldTypes.PROGRAM_CLUSET_KEY.getId().equals(field.getType())|| |
237 |
|
ReqComponentFieldTypes.CLUSET_KEY.getId().equals(field.getType())){ |
238 |
0
|
try { |
239 |
0
|
CluSetInfo cluSet = luService.getCluSetInfo(field.getValue()); |
240 |
0
|
cluSet.setId(null); |
241 |
0
|
cluSet = luService.createCluSet(cluSet.getType(), cluSet); |
242 |
0
|
field.setValue(cluSet.getId()); |
243 |
|
} catch (Exception e) { |
244 |
0
|
throw new OperationFailedException("Error copying clusets.", e); |
245 |
|
} |
246 |
|
} |
247 |
|
|
248 |
|
} |
249 |
|
} |
250 |
|
|
251 |
0
|
for(StatementTreeViewInfo child: statementTreeView.getStatements()){ |
252 |
0
|
clearStatementTreeViewIdsRecursively(child); |
253 |
|
} |
254 |
|
} |
255 |
|
} |
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
@param |
262 |
|
@throws |
263 |
|
@throws |
264 |
|
@throws |
265 |
|
@throws |
266 |
|
@throws |
267 |
|
@throws |
268 |
|
@throws |
269 |
|
@throws |
270 |
|
@throws |
271 |
|
|
|
|
| 65.7% |
Uncovered Elements: 12 (35) |
Complexity: 4 |
Complexity Density: 0.14 |
|
272 |
2
|
private void processCopy(MajorDisciplineInfo majorDiscipline,String originalId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, AlreadyExistsException, DataValidationErrorException, VersionMismatchException, CircularRelationshipException {... |
273 |
|
|
274 |
2
|
for(LoDisplayInfo lo:majorDiscipline.getLearningObjectives()){ |
275 |
4
|
resetLoRecursively(lo); |
276 |
|
} |
277 |
|
|
278 |
2
|
if(majorDiscipline.getOrgCoreProgram()!=null){ |
279 |
0
|
majorDiscipline.getOrgCoreProgram().setId(null); |
280 |
|
|
281 |
0
|
if(majorDiscipline.getOrgCoreProgram().getLearningObjectives()!=null){ |
282 |
0
|
for(LoDisplayInfo lo:majorDiscipline.getOrgCoreProgram().getLearningObjectives()){ |
283 |
0
|
resetLoRecursively(lo); |
284 |
|
} |
285 |
|
} |
286 |
|
} |
287 |
|
|
288 |
2
|
for(ProgramVariationInfo variation:majorDiscipline.getVariations()){ |
289 |
|
|
290 |
4
|
String variationVersionIndId = variation.getVersionInfo().getVersionIndId(); |
291 |
4
|
CluInfo newVariationClu = luService.createNewCluVersion(variationVersionIndId, "Variation version for MajorDiscipline version " + majorDiscipline.getVersionInfo().getSequenceNumber()); |
292 |
|
|
293 |
|
|
294 |
4
|
CluCluRelationInfo relation = new CluCluRelationInfo(); |
295 |
4
|
relation.setCluId(majorDiscipline.getId()); |
296 |
4
|
relation.setRelatedCluId(newVariationClu.getId()); |
297 |
4
|
relation.setType(ProgramAssemblerConstants.HAS_PROGRAM_VARIATION); |
298 |
4
|
relation.setState(DtoConstants.STATE_ACTIVE); |
299 |
4
|
luService.createCluCluRelation(relation.getCluId(), relation.getRelatedCluId(), relation.getType(), relation); |
300 |
|
|
301 |
|
|
302 |
4
|
variation.setId(newVariationClu.getId()); |
303 |
4
|
variation.setMetaInfo(newVariationClu.getMetaInfo()); |
304 |
|
|
305 |
|
|
306 |
4
|
variation.setState(majorDiscipline.getState()); |
307 |
|
|
308 |
4
|
for(LoDisplayInfo lo:variation.getLearningObjectives()){ |
309 |
8
|
resetLoRecursively(lo); |
310 |
|
} |
311 |
|
|
312 |
4
|
copyProgramRequirements(variation.getProgramRequirements(),majorDiscipline.getState()); |
313 |
|
} |
314 |
|
|
315 |
|
|
316 |
2
|
copyProgramRequirements(majorDiscipline.getProgramRequirements(),majorDiscipline.getState()); |
317 |
|
|
318 |
|
|
319 |
2
|
List<RefDocRelationInfo> docRelations = documentService.getRefDocRelationsByRef("kuali.org.RefObjectType.ProposalInfo", originalId); |
320 |
2
|
if(docRelations!=null){ |
321 |
0
|
for(RefDocRelationInfo docRelation:docRelations){ |
322 |
0
|
docRelation.setId(null); |
323 |
0
|
docRelation.setRefObjectId(majorDiscipline.getId()); |
324 |
0
|
documentService.createRefDocRelation("kuali.org.RefObjectType.ProposalInfo", majorDiscipline.getId(), docRelation.getDocumentId(), docRelation.getType(), docRelation); |
325 |
|
} |
326 |
|
} |
327 |
|
} |
328 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
329 |
0
|
private void processCopy(CredentialProgramInfo originaCredentialProgram,... |
330 |
|
String originalId) throws OperationFailedException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, PermissionDeniedException, DoesNotExistException { |
331 |
|
|
332 |
0
|
if (originaCredentialProgram.getLearningObjectives() != null){ |
333 |
0
|
for(LoDisplayInfo lo:originaCredentialProgram.getLearningObjectives()){ |
334 |
0
|
resetLoRecursively(lo); |
335 |
|
} |
336 |
|
} |
337 |
|
|
338 |
|
|
339 |
0
|
copyProgramRequirements(originaCredentialProgram.getProgramRequirements(),originaCredentialProgram.getState()); |
340 |
|
|
341 |
|
|
342 |
0
|
List<RefDocRelationInfo> docRelations = documentService.getRefDocRelationsByRef("kuali.org.RefObjectType.ProposalInfo", originalId); |
343 |
0
|
if(docRelations!=null){ |
344 |
0
|
for(RefDocRelationInfo docRelation:docRelations){ |
345 |
0
|
docRelation.setId(null); |
346 |
0
|
docRelation.setRefObjectId(originaCredentialProgram.getId()); |
347 |
0
|
documentService.createRefDocRelation("kuali.org.RefObjectType.ProposalInfo", originaCredentialProgram.getId(), docRelation.getDocumentId(), docRelation.getType(), docRelation); |
348 |
|
} |
349 |
|
} |
350 |
|
} |
351 |
|
|
|
|
| 54.5% |
Uncovered Elements: 5 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
352 |
2
|
private void processCopy(CoreProgramInfo originalCoreProgram, String originalId) throws OperationFailedException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, PermissionDeniedException, DoesNotExistException {... |
353 |
|
|
354 |
2
|
for(LoDisplayInfo lo:originalCoreProgram.getLearningObjectives()){ |
355 |
4
|
resetLoRecursively(lo); |
356 |
|
} |
357 |
|
|
358 |
2
|
copyProgramRequirements(originalCoreProgram.getProgramRequirements(),originalCoreProgram.getState()); |
359 |
|
|
360 |
|
|
361 |
2
|
List<RefDocRelationInfo> docRelations = documentService.getRefDocRelationsByRef("kuali.org.RefObjectType.ProposalInfo", originalId); |
362 |
2
|
if(docRelations!=null){ |
363 |
0
|
for(RefDocRelationInfo docRelation:docRelations){ |
364 |
0
|
docRelation.setId(null); |
365 |
0
|
docRelation.setRefObjectId(originalCoreProgram.getId()); |
366 |
0
|
documentService.createRefDocRelation("kuali.org.RefObjectType.ProposalInfo", originalCoreProgram.getId(), docRelation.getDocumentId(), docRelation.getType(), docRelation); |
367 |
|
} |
368 |
|
} |
369 |
|
} |
370 |
|
|
371 |
|
|
372 |
|
|
373 |
|
@param |
374 |
|
@param |
375 |
|
@throws |
376 |
|
@throws |
377 |
|
@throws |
378 |
|
@throws |
379 |
|
@throws |
380 |
|
@throws |
381 |
|
@throws |
382 |
|
|
|
|
| 27.3% |
Uncovered Elements: 8 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
383 |
8
|
private void copyProgramRequirements(List<String> originalProgramRequirementIds,String state) throws OperationFailedException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, PermissionDeniedException, DoesNotExistException{... |
384 |
|
|
385 |
8
|
List<String> programRequirementIds = new ArrayList<String>(originalProgramRequirementIds); |
386 |
8
|
originalProgramRequirementIds.clear(); |
387 |
|
|
388 |
8
|
for(String programRequirementId:programRequirementIds){ |
389 |
|
|
390 |
0
|
ProgramRequirementInfo programRequirementInfo = getProgramRequirement(programRequirementId, null, null); |
391 |
|
|
392 |
0
|
programRequirementInfo.setId(null); |
393 |
|
|
394 |
0
|
programRequirementInfo.setState(state); |
395 |
|
|
396 |
0
|
clearStatementTreeViewIdsRecursively(programRequirementInfo.getStatement()); |
397 |
|
|
398 |
0
|
for(LoDisplayInfo lo:programRequirementInfo.getLearningObjectives()){ |
399 |
0
|
resetLoRecursively(lo); |
400 |
|
} |
401 |
|
|
402 |
0
|
ProgramRequirementInfo createdProgramRequirement = createProgramRequirement(programRequirementInfo); |
403 |
|
|
404 |
0
|
originalProgramRequirementIds.add(createdProgramRequirement.getId()); |
405 |
|
} |
406 |
|
} |
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
@param |
411 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
412 |
112
|
private void resetLoRecursively(LoDisplayInfo lo){... |
413 |
112
|
lo.getLoInfo().setId(null); |
414 |
112
|
for(LoDisplayInfo nestedLo:lo.getLoDisplayInfoList()){ |
415 |
96
|
resetLoRecursively(nestedLo); |
416 |
|
} |
417 |
|
} |
418 |
|
|
|
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
419 |
1
|
@Override... |
420 |
|
@Transactional(readOnly=false) |
421 |
|
public StatusInfo setCurrentMajorDisciplineVersion( |
422 |
|
String majorDisciplineId, Date currentVersionStart) |
423 |
|
throws DoesNotExistException, InvalidParameterException, |
424 |
|
MissingParameterException, IllegalVersionSequencingException, |
425 |
|
OperationFailedException, PermissionDeniedException { |
426 |
1
|
StatusInfo status = luService.setCurrentCluVersion(majorDisciplineId, currentVersionStart); |
427 |
|
|
428 |
|
|
429 |
1
|
List<ProgramVariationInfo> variationList = getVariationsByMajorDisciplineId(majorDisciplineId); |
430 |
1
|
for (ProgramVariationInfo variationInfo:variationList){ |
431 |
2
|
String variationId = variationInfo.getId(); |
432 |
|
|
433 |
2
|
if (variationInfo.getVersionInfo().getCurrentVersionStart() == null){ |
434 |
2
|
luService.setCurrentCluVersion(variationId, currentVersionStart); |
435 |
|
} |
436 |
|
} |
437 |
|
|
438 |
1
|
return status; |
439 |
|
} |
440 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
441 |
1
|
@Override... |
442 |
|
@Transactional(readOnly=false) |
443 |
|
public MinorDisciplineInfo createMinorDiscipline( |
444 |
|
MinorDisciplineInfo minorDisciplineInfo) |
445 |
|
throws AlreadyExistsException, DataValidationErrorException, |
446 |
|
InvalidParameterException, MissingParameterException, |
447 |
|
OperationFailedException, PermissionDeniedException { |
448 |
|
|
449 |
1
|
return null; |
450 |
|
} |
451 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
452 |
1
|
@Override... |
453 |
|
@Transactional(readOnly=false) |
454 |
|
public StatusInfo deleteCredentialProgram(String credentialProgramId) |
455 |
|
throws DoesNotExistException, InvalidParameterException, |
456 |
|
MissingParameterException, OperationFailedException, |
457 |
|
PermissionDeniedException { |
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
|
|
463 |
|
|
464 |
|
|
465 |
|
|
466 |
|
|
467 |
|
|
468 |
|
|
469 |
|
|
470 |
1
|
throw new OperationFailedException("Deletion of CredentialProgram is not supported."); |
471 |
|
} |
472 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
473 |
1
|
@Override... |
474 |
|
@Transactional(readOnly=false) |
475 |
|
public StatusInfo deleteHonorsProgram(String honorsProgramId) |
476 |
|
throws DoesNotExistException, InvalidParameterException, |
477 |
|
MissingParameterException, OperationFailedException, |
478 |
|
PermissionDeniedException { |
479 |
|
|
480 |
1
|
return null; |
481 |
|
} |
482 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
483 |
0
|
@Override... |
484 |
|
@Transactional(readOnly=false) |
485 |
|
public StatusInfo deleteMajorDiscipline(String majorDisciplineId) |
486 |
|
throws DoesNotExistException, InvalidParameterException, |
487 |
|
MissingParameterException, OperationFailedException, |
488 |
|
PermissionDeniedException { |
489 |
|
|
490 |
0
|
try { |
491 |
0
|
MajorDisciplineInfo majorDiscipline = getMajorDiscipline(majorDisciplineId); |
492 |
|
|
493 |
0
|
processMajorDisciplineInfo(majorDiscipline, NodeOperation.DELETE); |
494 |
|
|
495 |
0
|
return getStatus(); |
496 |
|
|
497 |
|
} catch (AssemblyException e) { |
498 |
0
|
LOG.error("Error disassembling MajorDiscipline", e); |
499 |
0
|
throw new OperationFailedException("Error disassembling MajorDiscipline"); |
500 |
|
} |
501 |
|
} |
502 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
503 |
1
|
@Override... |
504 |
|
@Transactional(readOnly=false) |
505 |
|
public StatusInfo deleteMinorDiscipline(String minorDisciplineId) |
506 |
|
throws DoesNotExistException, InvalidParameterException, |
507 |
|
MissingParameterException, OperationFailedException, |
508 |
|
PermissionDeniedException { |
509 |
|
|
510 |
1
|
return null; |
511 |
|
} |
512 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
513 |
2
|
@Override... |
514 |
|
@Transactional(readOnly=false) |
515 |
|
public StatusInfo deleteProgramRequirement(String programRequirementId) |
516 |
|
throws DoesNotExistException, InvalidParameterException, |
517 |
|
MissingParameterException, OperationFailedException, |
518 |
|
PermissionDeniedException { |
519 |
2
|
checkForMissingParameter(programRequirementId, "programRequirementId"); |
520 |
2
|
try { |
521 |
2
|
ProgramRequirementInfo programRequirement = getProgramRequirement(programRequirementId, null, null); |
522 |
|
|
523 |
2
|
processProgramRequirement(programRequirement, NodeOperation.DELETE); |
524 |
|
|
525 |
2
|
return getStatus(); |
526 |
|
|
527 |
|
} catch (AssemblyException e) { |
528 |
0
|
LOG.error("Error disassembling MajorDiscipline", e); |
529 |
0
|
throw new OperationFailedException("Error disassembling ProgramRequirement", e); |
530 |
|
} |
531 |
|
|
532 |
|
} |
533 |
|
|
|
|
| 63.6% |
Uncovered Elements: 4 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
534 |
4
|
@Override... |
535 |
|
public CredentialProgramInfo getCredentialProgram(String credentialProgramId) |
536 |
|
throws DoesNotExistException, InvalidParameterException, |
537 |
|
MissingParameterException, OperationFailedException, |
538 |
|
PermissionDeniedException { |
539 |
|
|
540 |
4
|
CredentialProgramInfo credentialProgramInfo = null; |
541 |
|
|
542 |
4
|
try { |
543 |
4
|
CluInfo clu = luService.getClu(credentialProgramId); |
544 |
|
|
545 |
4
|
if ( ! ProgramAssemblerConstants.CREDENTIAL_PROGRAM_TYPES.contains(clu.getType()) ) { |
546 |
0
|
throw new DoesNotExistException("Specified CLU is not a Credential Program"); |
547 |
|
} |
548 |
|
|
549 |
4
|
credentialProgramInfo = credentialProgramAssembler.assemble(clu, null, false); |
550 |
|
} catch (AssemblyException e) { |
551 |
0
|
LOG.error("Error assembling CredentialProgram", e); |
552 |
0
|
throw new OperationFailedException("Error assembling CredentialProgram"); |
553 |
|
} |
554 |
4
|
return credentialProgramInfo; |
555 |
|
|
556 |
|
|
557 |
|
|
558 |
|
|
559 |
|
|
560 |
|
|
561 |
|
|
562 |
|
|
563 |
|
} |
564 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
565 |
1
|
@Override... |
566 |
|
public LuTypeInfo getCredentialProgramType(String credentialProgramTypeKey) |
567 |
|
throws DoesNotExistException, InvalidParameterException, |
568 |
|
MissingParameterException, OperationFailedException { |
569 |
|
|
570 |
1
|
return null; |
571 |
|
} |
572 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
573 |
1
|
@Override... |
574 |
|
public List<LuTypeInfo> getCredentialProgramTypes() |
575 |
|
throws OperationFailedException { |
576 |
|
|
577 |
1
|
return null; |
578 |
|
} |
579 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
580 |
1
|
@Override... |
581 |
|
public List<String> getHonorsByCredentialProgramType(String programType) |
582 |
|
throws DoesNotExistException, InvalidParameterException, |
583 |
|
MissingParameterException, OperationFailedException { |
584 |
|
|
585 |
1
|
return null; |
586 |
|
} |
587 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
588 |
1
|
@Override... |
589 |
|
public HonorsProgramInfo getHonorsProgram(String honorsProgramId) |
590 |
|
throws DoesNotExistException, InvalidParameterException, |
591 |
|
MissingParameterException, OperationFailedException, |
592 |
|
PermissionDeniedException { |
593 |
|
|
594 |
1
|
return null; |
595 |
|
} |
596 |
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
597 |
15
|
@Override... |
598 |
|
public MajorDisciplineInfo getMajorDiscipline(String majorDisciplineId) |
599 |
|
throws DoesNotExistException, InvalidParameterException, |
600 |
|
MissingParameterException, OperationFailedException, |
601 |
|
PermissionDeniedException { |
602 |
|
|
603 |
|
|
604 |
15
|
MajorDisciplineInfo majorDiscipline = null; |
605 |
|
|
606 |
15
|
try { |
607 |
15
|
CluInfo clu = luService.getClu(majorDisciplineId); |
608 |
15
|
if ( ! ProgramAssemblerConstants.MAJOR_DISCIPLINE.equals(clu.getType()) ) { |
609 |
1
|
throw new DoesNotExistException("Specified CLU is not a Major Discipline"); |
610 |
|
} |
611 |
14
|
majorDiscipline = majorDisciplineAssembler.assemble(clu, null, false); |
612 |
|
} catch (AssemblyException e) { |
613 |
0
|
LOG.error("Error assembling MajorDiscipline", e); |
614 |
0
|
throw new OperationFailedException("Error assembling MajorDiscipline"); |
615 |
|
} |
616 |
14
|
return majorDiscipline; |
617 |
|
|
618 |
|
|
619 |
|
|
620 |
|
|
621 |
|
|
622 |
|
|
623 |
|
|
624 |
|
} |
625 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
626 |
1
|
@Override... |
627 |
|
public List<String> getMajorIdsByCredentialProgramType(String programType) |
628 |
|
throws DoesNotExistException, InvalidParameterException, |
629 |
|
MissingParameterException, OperationFailedException { |
630 |
|
|
631 |
1
|
return null; |
632 |
|
} |
633 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
634 |
1
|
@Override... |
635 |
|
public MinorDisciplineInfo getMinorDiscipline(String minorDisciplineId) |
636 |
|
throws DoesNotExistException, InvalidParameterException, |
637 |
|
MissingParameterException, OperationFailedException, |
638 |
|
PermissionDeniedException { |
639 |
|
|
640 |
1
|
return null; |
641 |
|
} |
642 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
643 |
1
|
@Override... |
644 |
|
public List<String> getMinorsByCredentialProgramType(String programType) |
645 |
|
throws DoesNotExistException, InvalidParameterException, |
646 |
|
MissingParameterException, OperationFailedException { |
647 |
|
|
648 |
1
|
return null; |
649 |
|
} |
650 |
|
|
|
|
| 66.7% |
Uncovered Elements: 4 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
651 |
8
|
@Override... |
652 |
|
public ProgramRequirementInfo getProgramRequirement(String programRequirementId, String nlUsageTypeKey, String language) throws DoesNotExistException, |
653 |
|
InvalidParameterException, MissingParameterException, |
654 |
|
OperationFailedException, PermissionDeniedException { |
655 |
|
|
656 |
8
|
checkForMissingParameter(programRequirementId, "programRequirementId"); |
657 |
|
|
658 |
7
|
CluInfo clu = luService.getClu(programRequirementId); |
659 |
5
|
if (!ProgramAssemblerConstants.PROGRAM_REQUIREMENT.equals(clu.getType())) { |
660 |
0
|
throw new DoesNotExistException("Specified CLU is not a Program Requirement"); |
661 |
|
} |
662 |
5
|
try { |
663 |
5
|
ProgramRequirementInfo progReqInfo = programRequirementAssembler.assemble(clu, null, false); |
664 |
5
|
StatementTreeViewInfo statement = progReqInfo.getStatement(); |
665 |
|
|
666 |
|
|
667 |
|
|
668 |
5
|
return progReqInfo; |
669 |
|
} catch (AssemblyException e) { |
670 |
0
|
LOG.error("Error assembling program requirement", e); |
671 |
0
|
throw new OperationFailedException("Error assembling program requirement: " + e.getMessage(), e); |
672 |
|
} |
673 |
|
} |
674 |
|
|
|
|
| 73.3% |
Uncovered Elements: 4 (15) |
Complexity: 5 |
Complexity Density: 0.45 |
|
675 |
5
|
@Override... |
676 |
|
public List<ProgramVariationInfo> getVariationsByMajorDisciplineId( |
677 |
|
String majorDisciplineId) throws DoesNotExistException, |
678 |
|
InvalidParameterException, MissingParameterException, |
679 |
|
OperationFailedException { |
680 |
5
|
List<ProgramVariationInfo> pvInfos = new ArrayList<ProgramVariationInfo>(); |
681 |
|
|
682 |
5
|
try { |
683 |
5
|
List<CluInfo> clus = luService.getRelatedClusByCluId(majorDisciplineId, ProgramAssemblerConstants.HAS_PROGRAM_VARIATION); |
684 |
|
|
685 |
5
|
if(clus != null && clus.size() > 0){ |
686 |
5
|
for(CluInfo clu : clus){ |
687 |
12
|
ProgramVariationInfo pvInfo = majorDisciplineAssembler.getProgramVariationAssembler().assemble(clu, null, false); |
688 |
12
|
if(pvInfo != null){ |
689 |
12
|
pvInfos.add(pvInfo); |
690 |
|
} |
691 |
|
} |
692 |
|
} |
693 |
|
} catch (AssemblyException e) { |
694 |
0
|
LOG.error("Error assembling ProgramVariation", e); |
695 |
0
|
throw new OperationFailedException("Error assembling ProgramVariation"); |
696 |
|
} |
697 |
|
|
698 |
5
|
return pvInfos; |
699 |
|
} |
700 |
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 4 |
Complexity Density: 0.5 |
|
701 |
1
|
@Override... |
702 |
|
@Transactional(readOnly=false) |
703 |
|
public CredentialProgramInfo updateCredentialProgram( |
704 |
|
CredentialProgramInfo credentialProgramInfo) |
705 |
|
throws DataValidationErrorException, DoesNotExistException, |
706 |
|
InvalidParameterException, MissingParameterException, |
707 |
|
VersionMismatchException, OperationFailedException, |
708 |
|
PermissionDeniedException { |
709 |
|
|
710 |
1
|
checkForMissingParameter(credentialProgramInfo, "CredentialProgramInfo"); |
711 |
|
|
712 |
|
|
713 |
1
|
List<ValidationResultInfo> validationResults = validateCredentialProgram("OBJECT", credentialProgramInfo); |
714 |
1
|
if (null != validationResults && validationResults.size() > 0) { |
715 |
0
|
throw new DataValidationErrorException("Validation error!", validationResults); |
716 |
|
} |
717 |
|
|
718 |
1
|
try { |
719 |
|
|
720 |
1
|
return processCredentialProgramInfo(credentialProgramInfo, NodeOperation.UPDATE); |
721 |
|
|
722 |
|
} catch (AssemblyException e) { |
723 |
0
|
LOG.error("Error disassembling Credential Program", e); |
724 |
0
|
throw new OperationFailedException("Error disassembling Credential Program"); |
725 |
|
} |
726 |
|
} |
727 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
728 |
1
|
@Override... |
729 |
|
@Transactional(readOnly=false) |
730 |
|
public HonorsProgramInfo updateHonorsProgram( |
731 |
|
HonorsProgramInfo honorsProgramInfo) |
732 |
|
throws DataValidationErrorException, DoesNotExistException, |
733 |
|
InvalidParameterException, MissingParameterException, |
734 |
|
VersionMismatchException, OperationFailedException, |
735 |
|
PermissionDeniedException { |
736 |
|
|
737 |
1
|
return null; |
738 |
|
} |
739 |
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 4 |
Complexity Density: 0.5 |
|
740 |
6
|
@Override... |
741 |
|
@Transactional(readOnly=false) |
742 |
|
public MajorDisciplineInfo updateMajorDiscipline( |
743 |
|
MajorDisciplineInfo majorDisciplineInfo) |
744 |
|
throws DataValidationErrorException, DoesNotExistException, |
745 |
|
InvalidParameterException, MissingParameterException, |
746 |
|
VersionMismatchException, OperationFailedException, |
747 |
|
PermissionDeniedException { |
748 |
|
|
749 |
6
|
checkForMissingParameter(majorDisciplineInfo, "MajorDisciplineInfo"); |
750 |
|
|
751 |
|
|
752 |
6
|
List<ValidationResultInfo> validationResults = validateMajorDiscipline("OBJECT", majorDisciplineInfo); |
753 |
6
|
if (null != validationResults && validationResults.size() > 0) { |
754 |
0
|
throw new DataValidationErrorException("Validation error!", validationResults); |
755 |
|
} |
756 |
|
|
757 |
6
|
try { |
758 |
|
|
759 |
6
|
return processMajorDisciplineInfo(majorDisciplineInfo, NodeOperation.UPDATE); |
760 |
|
|
761 |
|
} catch (AssemblyException e) { |
762 |
0
|
LOG.error("Error disassembling majorDiscipline", e); |
763 |
0
|
throw new OperationFailedException("Error disassembling majorDiscipline"); |
764 |
|
} |
765 |
|
} |
766 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
767 |
1
|
@Override... |
768 |
|
@Transactional(readOnly=false) |
769 |
|
public MinorDisciplineInfo updateMinorDiscipline( |
770 |
|
MinorDisciplineInfo minorDisciplineInfo) |
771 |
|
throws DataValidationErrorException, DoesNotExistException, |
772 |
|
InvalidParameterException, MissingParameterException, |
773 |
|
VersionMismatchException, OperationFailedException, |
774 |
|
PermissionDeniedException { |
775 |
|
|
776 |
1
|
return null; |
777 |
|
} |
778 |
|
|
|
|
| 66.7% |
Uncovered Elements: 3 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
779 |
1
|
@Override... |
780 |
|
@Transactional(readOnly=false) |
781 |
|
public ProgramRequirementInfo updateProgramRequirement( |
782 |
|
ProgramRequirementInfo programRequirementInfo) |
783 |
|
throws DataValidationErrorException, DoesNotExistException, |
784 |
|
InvalidParameterException, MissingParameterException, |
785 |
|
VersionMismatchException, OperationFailedException, |
786 |
|
PermissionDeniedException { |
787 |
1
|
checkForMissingParameter(programRequirementInfo, "programRequirementInfo"); |
788 |
|
|
789 |
1
|
List<ValidationResultInfo> validationResults = validateProgramRequirement("OBJECT", programRequirementInfo); |
790 |
1
|
if (isNotEmpty(validationResults)) { |
791 |
0
|
throw new DataValidationErrorException("Validation error!", validationResults); |
792 |
|
} |
793 |
|
|
794 |
1
|
try { |
795 |
1
|
return processProgramRequirement(programRequirementInfo, NodeOperation.UPDATE); |
796 |
|
} catch (AssemblyException e) { |
797 |
0
|
throw new OperationFailedException("Unable to update ProgramRequirement", e); |
798 |
|
} |
799 |
|
} |
800 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
801 |
2
|
@Override... |
802 |
|
public List<ValidationResultInfo> validateCredentialProgram( |
803 |
|
String validationType, CredentialProgramInfo credentialProgramInfo) |
804 |
|
throws InvalidParameterException, |
805 |
|
MissingParameterException, OperationFailedException { |
806 |
|
|
807 |
2
|
List<ValidationResultInfo> validationResults = new ArrayList<ValidationResultInfo>(); |
808 |
|
|
809 |
2
|
ObjectStructureDefinition objStructure = this.getObjectStructure(CredentialProgramInfo.class.getName()); |
810 |
2
|
Validator validator = validatorFactory.getValidator(); |
811 |
2
|
validationResults.addAll(validator.validateObject(credentialProgramInfo, objStructure)); |
812 |
|
|
813 |
|
|
814 |
2
|
return validationResults; |
815 |
|
} |
816 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
817 |
1
|
@Override... |
818 |
|
public List<ValidationResultInfo> validateHonorsProgram( |
819 |
|
String validationType, HonorsProgramInfo honorsProgramInfo) |
820 |
|
throws InvalidParameterException, |
821 |
|
MissingParameterException, OperationFailedException { |
822 |
|
|
823 |
1
|
return null; |
824 |
|
} |
825 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
826 |
9
|
@Override... |
827 |
|
public List<ValidationResultInfo> validateMajorDiscipline( |
828 |
|
String validationType, MajorDisciplineInfo majorDisciplineInfo) |
829 |
|
throws InvalidParameterException, |
830 |
|
MissingParameterException, OperationFailedException { |
831 |
|
|
832 |
9
|
List<ValidationResultInfo> validationResults = new ArrayList<ValidationResultInfo>(); |
833 |
|
|
834 |
9
|
ObjectStructureDefinition objStructure = this.getObjectStructure(MajorDisciplineInfo.class.getName()); |
835 |
9
|
Validator validator = validatorFactory.getValidator(); |
836 |
9
|
validationResults.addAll(validator.validateObject(majorDisciplineInfo, objStructure)); |
837 |
|
|
838 |
9
|
validateMajorDisciplineAtps(majorDisciplineInfo,validationResults); |
839 |
9
|
return validationResults; |
840 |
|
} |
841 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
842 |
1
|
@Override... |
843 |
|
public List<ValidationResultInfo> validateMinorDiscipline( |
844 |
|
String validationType, MinorDisciplineInfo minorDisciplineInfo) |
845 |
|
throws InvalidParameterException, |
846 |
|
MissingParameterException, OperationFailedException { |
847 |
|
|
848 |
1
|
return null; |
849 |
|
} |
850 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
851 |
7
|
@Override... |
852 |
|
public List<ValidationResultInfo> validateProgramRequirement( |
853 |
|
String validationType, ProgramRequirementInfo programRequirementInfo) |
854 |
|
throws InvalidParameterException, |
855 |
|
MissingParameterException, OperationFailedException { |
856 |
|
|
857 |
7
|
ObjectStructureDefinition objStructure = this.getObjectStructure(ProgramRequirementInfo.class.getName()); |
858 |
7
|
Validator validator = validatorFactory.getValidator(); |
859 |
7
|
List<ValidationResultInfo> validationResults = validator.validateObject(programRequirementInfo, objStructure); |
860 |
|
|
861 |
7
|
return validationResults; |
862 |
|
} |
863 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
864 |
23
|
@Override... |
865 |
|
public ObjectStructureDefinition getObjectStructure(String objectTypeKey) { |
866 |
23
|
return dictionaryService.getObjectStructure(objectTypeKey); |
867 |
|
} |
868 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
869 |
1
|
@Override... |
870 |
|
public List<String> getObjectTypes() { |
871 |
1
|
return dictionaryService.getObjectTypes(); |
872 |
|
} |
873 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
874 |
1
|
@Override... |
875 |
|
public SearchCriteriaTypeInfo getSearchCriteriaType( |
876 |
|
String searchCriteriaTypeKey) throws DoesNotExistException, |
877 |
|
InvalidParameterException, MissingParameterException, |
878 |
|
OperationFailedException { |
879 |
|
|
880 |
1
|
return null; |
881 |
|
} |
882 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
883 |
1
|
@Override... |
884 |
|
public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() |
885 |
|
throws OperationFailedException { |
886 |
|
|
887 |
1
|
return null; |
888 |
|
} |
889 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
890 |
1
|
@Override... |
891 |
|
public SearchResultTypeInfo getSearchResultType(String searchResultTypeKey) |
892 |
|
throws DoesNotExistException, InvalidParameterException, |
893 |
|
MissingParameterException, OperationFailedException { |
894 |
|
|
895 |
1
|
return null; |
896 |
|
} |
897 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
898 |
1
|
@Override... |
899 |
|
public List<SearchResultTypeInfo> getSearchResultTypes() |
900 |
|
throws OperationFailedException { |
901 |
|
|
902 |
1
|
return null; |
903 |
|
} |
904 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
905 |
1
|
@Override... |
906 |
|
public SearchTypeInfo getSearchType(String searchTypeKey) |
907 |
|
throws DoesNotExistException, InvalidParameterException, |
908 |
|
MissingParameterException, OperationFailedException { |
909 |
|
|
910 |
1
|
return null; |
911 |
|
} |
912 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
913 |
1
|
@Override... |
914 |
|
public List<SearchTypeInfo> getSearchTypes() |
915 |
|
throws OperationFailedException { |
916 |
|
|
917 |
1
|
return null; |
918 |
|
} |
919 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
920 |
1
|
@Override... |
921 |
|
public List<SearchTypeInfo> getSearchTypesByCriteria( |
922 |
|
String searchCriteriaTypeKey) throws DoesNotExistException, |
923 |
|
InvalidParameterException, MissingParameterException, |
924 |
|
OperationFailedException { |
925 |
|
|
926 |
1
|
return null; |
927 |
|
} |
928 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
929 |
1
|
@Override... |
930 |
|
public List<SearchTypeInfo> getSearchTypesByResult( |
931 |
|
String searchResultTypeKey) throws DoesNotExistException, |
932 |
|
InvalidParameterException, MissingParameterException, |
933 |
|
OperationFailedException { |
934 |
|
|
935 |
1
|
return null; |
936 |
|
} |
937 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
938 |
1
|
@Override... |
939 |
|
public SearchResult search(SearchRequest searchRequest) |
940 |
|
throws MissingParameterException { |
941 |
|
|
942 |
1
|
return null; |
943 |
|
} |
944 |
|
|
945 |
|
|
946 |
|
|
947 |
|
|
948 |
|
@param |
949 |
|
@param |
950 |
|
@throws |
951 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
952 |
33
|
private void checkForMissingParameter(Object param, String paramName)... |
953 |
|
throws MissingParameterException { |
954 |
33
|
if (param == null) { |
955 |
2
|
throw new MissingParameterException(paramName + " can not be null"); |
956 |
|
} |
957 |
|
} |
958 |
|
|
959 |
|
|
960 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
961 |
9
|
private MajorDisciplineInfo processMajorDisciplineInfo(MajorDisciplineInfo majorDisciplineInfo, NodeOperation operation) throws AssemblyException {... |
962 |
|
|
963 |
9
|
BaseDTOAssemblyNode<MajorDisciplineInfo, CluInfo> results = majorDisciplineAssembler.disassemble(majorDisciplineInfo, operation); |
964 |
9
|
invokeServiceCalls(results); |
965 |
9
|
return results.getBusinessDTORef(); |
966 |
|
} |
967 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
968 |
2
|
private CredentialProgramInfo processCredentialProgramInfo(CredentialProgramInfo credentialProgramInfo, NodeOperation operation) throws AssemblyException {... |
969 |
|
|
970 |
2
|
BaseDTOAssemblyNode<CredentialProgramInfo, CluInfo> results = credentialProgramAssembler.disassemble(credentialProgramInfo, operation); |
971 |
2
|
invokeServiceCalls(results); |
972 |
2
|
return results.getBusinessDTORef(); |
973 |
|
} |
974 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
975 |
9
|
private ProgramRequirementInfo processProgramRequirement(ProgramRequirementInfo programRequirementInfo, NodeOperation operation) throws AssemblyException {... |
976 |
9
|
BaseDTOAssemblyNode<ProgramRequirementInfo, CluInfo> results = programRequirementAssembler.disassemble(programRequirementInfo, operation); |
977 |
9
|
invokeServiceCalls(results); |
978 |
9
|
return results.getBusinessDTORef(); |
979 |
|
} |
980 |
|
|
|
|
| 50% |
Uncovered Elements: 2 (4) |
Complexity: 3 |
Complexity Density: 0.75 |
|
981 |
24
|
private void invokeServiceCalls(BaseDTOAssemblyNode<?, CluInfo> results) throws AssemblyException{... |
982 |
|
|
983 |
24
|
try { |
984 |
24
|
programServiceMethodInvoker.invokeServiceCalls(results); |
985 |
|
} catch (AssemblyException e) { |
986 |
0
|
throw e; |
987 |
|
} catch (Exception e) { |
988 |
0
|
throw new AssemblyException(e); |
989 |
|
} |
990 |
|
} |
991 |
|
|
992 |
|
|
993 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
994 |
1
|
public void setLuService(LuService luService) {... |
995 |
1
|
this.luService = luService; |
996 |
|
} |
997 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
998 |
0
|
public LuService getLuService() {... |
999 |
0
|
return luService; |
1000 |
|
} |
1001 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1002 |
1
|
public void setDictionaryService(DictionaryService dictionaryService) {... |
1003 |
1
|
this.dictionaryService = dictionaryService; |
1004 |
|
} |
1005 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1006 |
0
|
public DictionaryService getDictionaryService() {... |
1007 |
0
|
return dictionaryService; |
1008 |
|
} |
1009 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1010 |
0
|
public void setSearchManager(SearchManager searchManager) {... |
1011 |
0
|
this.searchManager = searchManager; |
1012 |
|
} |
1013 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1014 |
0
|
public SearchManager getSearchManager() {... |
1015 |
0
|
return searchManager; |
1016 |
|
} |
1017 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1018 |
1
|
public void setMajorDisciplineAssembler(MajorDisciplineAssembler majorDisciplineAssembler) {... |
1019 |
1
|
this.majorDisciplineAssembler = majorDisciplineAssembler; |
1020 |
|
} |
1021 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1022 |
0
|
public MajorDisciplineAssembler getMajorDisciplineAssembler() {... |
1023 |
0
|
return majorDisciplineAssembler; |
1024 |
|
} |
1025 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1026 |
1
|
public void setCredentialProgramAssembler(... |
1027 |
|
CredentialProgramAssembler credentialProgramAssembler) { |
1028 |
1
|
this.credentialProgramAssembler = credentialProgramAssembler; |
1029 |
|
} |
1030 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1031 |
0
|
public CredentialProgramAssembler getCredentialProgramAssembler() {... |
1032 |
0
|
return credentialProgramAssembler; |
1033 |
|
} |
1034 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1035 |
1
|
public void setProgramRequirementAssembler(ProgramRequirementAssembler programRequirementAssembler) {... |
1036 |
1
|
this.programRequirementAssembler = programRequirementAssembler; |
1037 |
|
} |
1038 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1039 |
0
|
public ProgramRequirementAssembler getProgramRequirementAssembler() {... |
1040 |
0
|
return programRequirementAssembler; |
1041 |
|
} |
1042 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1043 |
1
|
public void setProgramServiceMethodInvoker(BusinessServiceMethodInvoker serviceMethodInvoker) {... |
1044 |
1
|
this.programServiceMethodInvoker = serviceMethodInvoker; |
1045 |
|
} |
1046 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1047 |
0
|
public BusinessServiceMethodInvoker getProgramServiceMethodInvoker() {... |
1048 |
0
|
return programServiceMethodInvoker; |
1049 |
|
} |
1050 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1051 |
1
|
public void setValidatorFactory(ValidatorFactory validatorFactory) {... |
1052 |
1
|
this.validatorFactory = validatorFactory; |
1053 |
|
} |
1054 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1055 |
0
|
public ValidatorFactory getValidatorFactory() {... |
1056 |
0
|
return validatorFactory; |
1057 |
|
} |
1058 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1059 |
1
|
public void setCoreProgramAssembler(CoreProgramAssembler coreProgramAssembler) {... |
1060 |
1
|
this.coreProgramAssembler = coreProgramAssembler; |
1061 |
|
} |
1062 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1063 |
0
|
public CoreProgramAssembler getCoreProgramAssembler() {... |
1064 |
0
|
return coreProgramAssembler; |
1065 |
|
} |
1066 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1067 |
2
|
private StatusInfo getStatus(){... |
1068 |
2
|
StatusInfo status = new StatusInfo(); |
1069 |
2
|
status.setSuccess(true); |
1070 |
2
|
return status; |
1071 |
|
} |
1072 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1073 |
4
|
private CoreProgramInfo processCoreProgramInfo(CoreProgramInfo coreProgramInfo, NodeOperation operation) throws AssemblyException {... |
1074 |
|
|
1075 |
4
|
BaseDTOAssemblyNode<CoreProgramInfo, CluInfo> results = coreProgramAssembler.disassemble(coreProgramInfo, operation); |
1076 |
4
|
invokeServiceCalls(results); |
1077 |
4
|
return results.getBusinessDTORef(); |
1078 |
|
} |
1079 |
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 4 |
Complexity Density: 0.5 |
|
1080 |
3
|
@Override... |
1081 |
|
@Transactional(readOnly=false) |
1082 |
|
public CoreProgramInfo createCoreProgram(CoreProgramInfo coreProgramInfo) throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
1083 |
3
|
checkForMissingParameter(coreProgramInfo, "CoreProgramInfo"); |
1084 |
|
|
1085 |
|
|
1086 |
3
|
List<ValidationResultInfo> validationResults = validateCoreProgram("OBJECT", coreProgramInfo); |
1087 |
3
|
if (null != validationResults && validationResults.size() > 0) { |
1088 |
0
|
throw new DataValidationErrorException("Validation error!", validationResults); |
1089 |
|
} |
1090 |
|
|
1091 |
3
|
try { |
1092 |
3
|
return processCoreProgramInfo(coreProgramInfo, NodeOperation.CREATE); |
1093 |
|
} catch (AssemblyException e) { |
1094 |
0
|
LOG.error("Error disassembling CoreProgram", e); |
1095 |
0
|
throw new OperationFailedException("Error disassembling CoreProgram"); |
1096 |
|
} |
1097 |
|
} |
1098 |
|
|
|
|
| 62.5% |
Uncovered Elements: 6 (16) |
Complexity: 7 |
Complexity Density: 0.44 |
|
1099 |
2
|
@Override... |
1100 |
|
@Transactional(readOnly=false) |
1101 |
|
public CoreProgramInfo createNewCoreProgramVersion( |
1102 |
|
String coreProgramId, String versionComment) |
1103 |
|
throws DoesNotExistException, InvalidParameterException, |
1104 |
|
MissingParameterException, OperationFailedException, |
1105 |
|
PermissionDeniedException, VersionMismatchException, |
1106 |
|
DataValidationErrorException { |
1107 |
|
|
1108 |
2
|
VersionDisplayInfo currentVersion = luService.getCurrentVersion(LuServiceConstants.CLU_NAMESPACE_URI, coreProgramId); |
1109 |
2
|
CoreProgramInfo originalCoreProgram = getCoreProgram(currentVersion.getId()); |
1110 |
|
|
1111 |
|
|
1112 |
2
|
CluInfo newVersionClu = luService.createNewCluVersion(coreProgramId, versionComment); |
1113 |
|
|
1114 |
2
|
try { |
1115 |
2
|
BaseDTOAssemblyNode<CoreProgramInfo, CluInfo> results; |
1116 |
|
|
1117 |
|
|
1118 |
2
|
coreProgramAssembler.assemble(newVersionClu, originalCoreProgram, true); |
1119 |
|
|
1120 |
|
|
1121 |
2
|
processCopy(originalCoreProgram, currentVersion.getId()); |
1122 |
|
|
1123 |
|
|
1124 |
2
|
results = coreProgramAssembler.disassemble(originalCoreProgram, NodeOperation.UPDATE); |
1125 |
|
|
1126 |
|
|
1127 |
2
|
programServiceMethodInvoker.invokeServiceCalls(results); |
1128 |
|
|
1129 |
2
|
return results.getBusinessDTORef(); |
1130 |
|
} catch(AssemblyException e) { |
1131 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1132 |
|
} catch (AlreadyExistsException e) { |
1133 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1134 |
|
} catch (DependentObjectsExistException e) { |
1135 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1136 |
|
} catch (CircularRelationshipException e) { |
1137 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1138 |
|
} catch (UnsupportedActionException e) { |
1139 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1140 |
|
} catch (CircularReferenceException e) { |
1141 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1142 |
|
} |
1143 |
|
} |
1144 |
|
|
1145 |
|
|
1146 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1147 |
1
|
@Override... |
1148 |
|
@Transactional(readOnly=false) |
1149 |
|
public StatusInfo deleteCoreProgram(String coreProgramId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
1150 |
|
|
1151 |
|
|
1152 |
|
|
1153 |
|
|
1154 |
|
|
1155 |
|
|
1156 |
|
|
1157 |
|
|
1158 |
|
|
1159 |
|
|
1160 |
|
|
1161 |
1
|
throw new OperationFailedException("Deletion of CoreProgram is not supported."); |
1162 |
|
} |
1163 |
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
1164 |
7
|
@Override... |
1165 |
|
public CoreProgramInfo getCoreProgram(String coreProgramId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
1166 |
7
|
CoreProgramInfo coreProgramInfo = null; |
1167 |
|
|
1168 |
7
|
try { |
1169 |
7
|
CluInfo clu = luService.getClu(coreProgramId); |
1170 |
7
|
if ( ! ProgramAssemblerConstants.CORE_PROGRAM.equals(clu.getType()) ) { |
1171 |
1
|
throw new DoesNotExistException("Specified CLU is not a CoreProgram"); |
1172 |
|
} |
1173 |
6
|
coreProgramInfo = coreProgramAssembler.assemble(clu, null, false); |
1174 |
|
} catch (AssemblyException e) { |
1175 |
0
|
LOG.error("Error assembling CoreProgram", e); |
1176 |
0
|
throw new OperationFailedException("Error assembling CoreProgram"); |
1177 |
|
} |
1178 |
6
|
return coreProgramInfo; |
1179 |
|
|
1180 |
|
|
1181 |
|
|
1182 |
|
|
1183 |
|
|
1184 |
|
|
1185 |
|
|
1186 |
|
} |
1187 |
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 4 |
Complexity Density: 0.5 |
|
1188 |
1
|
@Override... |
1189 |
|
@Transactional(readOnly=false) |
1190 |
|
public CoreProgramInfo updateCoreProgram(CoreProgramInfo coreProgramInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, VersionMismatchException, OperationFailedException, PermissionDeniedException { |
1191 |
1
|
checkForMissingParameter(coreProgramInfo, "CoreProgramInfo"); |
1192 |
|
|
1193 |
|
|
1194 |
1
|
List<ValidationResultInfo> validationResults = validateCoreProgram("OBJECT", coreProgramInfo); |
1195 |
1
|
if (null != validationResults && validationResults.size() > 0) { |
1196 |
0
|
throw new DataValidationErrorException("Validation error!", validationResults); |
1197 |
|
} |
1198 |
|
|
1199 |
1
|
try { |
1200 |
|
|
1201 |
1
|
return processCoreProgramInfo(coreProgramInfo, NodeOperation.UPDATE); |
1202 |
|
|
1203 |
|
} catch (AssemblyException e) { |
1204 |
0
|
LOG.error("Error disassembling CoreProgram", e); |
1205 |
0
|
throw new OperationFailedException("Error disassembling CoreProgram"); |
1206 |
|
} |
1207 |
|
} |
1208 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
1209 |
4
|
@Override... |
1210 |
|
public List<ValidationResultInfo> validateCoreProgram(String validationType, CoreProgramInfo coreProgramInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException { |
1211 |
4
|
List<ValidationResultInfo> validationResults = new ArrayList<ValidationResultInfo>(); |
1212 |
|
|
1213 |
4
|
ObjectStructureDefinition objStructure = this.getObjectStructure(CoreProgramInfo.class.getName()); |
1214 |
4
|
Validator validator = validatorFactory.getValidator(); |
1215 |
4
|
validationResults.addAll(validator.validateObject(coreProgramInfo, objStructure)); |
1216 |
|
|
1217 |
4
|
return validationResults; |
1218 |
|
} |
1219 |
|
|
1220 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 7 |
Complexity Density: 0.44 |
|
1221 |
0
|
@Override... |
1222 |
|
@Transactional(readOnly=false) |
1223 |
|
public CredentialProgramInfo createNewCredentialProgramVersion( |
1224 |
|
String credentialProgramId, String versionComment) |
1225 |
|
throws DoesNotExistException, InvalidParameterException, |
1226 |
|
MissingParameterException, OperationFailedException, |
1227 |
|
PermissionDeniedException, VersionMismatchException, |
1228 |
|
DataValidationErrorException { |
1229 |
|
|
1230 |
0
|
VersionDisplayInfo currentVersion = luService.getCurrentVersion(LuServiceConstants.CLU_NAMESPACE_URI, credentialProgramId); |
1231 |
0
|
CredentialProgramInfo originaCredentialProgram = getCredentialProgram(currentVersion.getId()); |
1232 |
|
|
1233 |
|
|
1234 |
0
|
CluInfo newVersionClu = luService.createNewCluVersion(credentialProgramId, versionComment); |
1235 |
|
|
1236 |
0
|
try { |
1237 |
0
|
BaseDTOAssemblyNode<CredentialProgramInfo, CluInfo> results; |
1238 |
|
|
1239 |
|
|
1240 |
0
|
credentialProgramAssembler.assemble(newVersionClu, originaCredentialProgram, true); |
1241 |
|
|
1242 |
|
|
1243 |
0
|
processCopy(originaCredentialProgram, currentVersion.getId()); |
1244 |
|
|
1245 |
|
|
1246 |
0
|
results = credentialProgramAssembler.disassemble(originaCredentialProgram, NodeOperation.UPDATE); |
1247 |
|
|
1248 |
|
|
1249 |
0
|
programServiceMethodInvoker.invokeServiceCalls(results); |
1250 |
|
|
1251 |
0
|
return results.getBusinessDTORef(); |
1252 |
|
} catch(AssemblyException e) { |
1253 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1254 |
|
} catch (AlreadyExistsException e) { |
1255 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1256 |
|
} catch (DependentObjectsExistException e) { |
1257 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1258 |
|
} catch (CircularRelationshipException e) { |
1259 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1260 |
|
} catch (UnsupportedActionException e) { |
1261 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1262 |
|
} catch (CircularReferenceException e) { |
1263 |
0
|
throw new OperationFailedException("Error creating new MajorDiscipline version",e); |
1264 |
|
} |
1265 |
|
} |
1266 |
|
|
1267 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1268 |
1
|
@Override... |
1269 |
|
@Transactional(readOnly=false) |
1270 |
|
public StatusInfo setCurrentCoreProgramVersion(String coreProgramId, |
1271 |
|
Date currentVersionStart) throws DoesNotExistException, |
1272 |
|
InvalidParameterException, MissingParameterException, |
1273 |
|
IllegalVersionSequencingException, OperationFailedException, |
1274 |
|
PermissionDeniedException { |
1275 |
1
|
StatusInfo status = luService.setCurrentCluVersion(coreProgramId, currentVersionStart); |
1276 |
|
|
1277 |
1
|
return status; |
1278 |
|
} |
1279 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1280 |
0
|
@Override... |
1281 |
|
@Transactional(readOnly=false) |
1282 |
|
public StatusInfo setCurrentCredentialProgramVersion( |
1283 |
|
String credentialProgramId, Date currentVersionStart) |
1284 |
|
throws DoesNotExistException, InvalidParameterException, |
1285 |
|
MissingParameterException, IllegalVersionSequencingException, |
1286 |
|
OperationFailedException, PermissionDeniedException { |
1287 |
0
|
StatusInfo status = luService.setCurrentCluVersion(credentialProgramId, currentVersionStart); |
1288 |
|
|
1289 |
0
|
return status; |
1290 |
|
} |
1291 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1292 |
1
|
@Override... |
1293 |
|
public VersionDisplayInfo getCurrentVersion(String refObjectTypeURI, |
1294 |
|
String refObjectId) throws DoesNotExistException, |
1295 |
|
InvalidParameterException, MissingParameterException, |
1296 |
|
OperationFailedException, PermissionDeniedException { |
1297 |
1
|
if(ProgramServiceConstants.PROGRAM_NAMESPACE_MAJOR_DISCIPLINE_URI.equals(refObjectTypeURI)){ |
1298 |
0
|
return luService.getCurrentVersion(LuServiceConstants.CLU_NAMESPACE_URI, refObjectId); |
1299 |
|
} |
1300 |
1
|
throw new InvalidParameterException("Object type: " + refObjectTypeURI + " is not known to this implementation"); |
1301 |
|
} |
1302 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1303 |
1
|
@Override... |
1304 |
|
public VersionDisplayInfo getCurrentVersionOnDate(String refObjectTypeURI, |
1305 |
|
String refObjectId, Date date) throws DoesNotExistException, |
1306 |
|
InvalidParameterException, MissingParameterException, |
1307 |
|
OperationFailedException, PermissionDeniedException { |
1308 |
1
|
if(ProgramServiceConstants.PROGRAM_NAMESPACE_MAJOR_DISCIPLINE_URI.equals(refObjectTypeURI)){ |
1309 |
0
|
return luService.getCurrentVersionOnDate(LuServiceConstants.CLU_NAMESPACE_URI, refObjectId, date); |
1310 |
|
} |
1311 |
1
|
throw new InvalidParameterException("Object type: " + refObjectTypeURI + " is not known to this implementation"); |
1312 |
|
} |
1313 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1314 |
1
|
@Override... |
1315 |
|
public VersionDisplayInfo getFirstVersion(String refObjectTypeURI, |
1316 |
|
String refObjectId) throws DoesNotExistException, |
1317 |
|
InvalidParameterException, MissingParameterException, |
1318 |
|
OperationFailedException, PermissionDeniedException { |
1319 |
1
|
if(ProgramServiceConstants.PROGRAM_NAMESPACE_MAJOR_DISCIPLINE_URI.equals(refObjectTypeURI)){ |
1320 |
0
|
return luService.getFirstVersion(LuServiceConstants.CLU_NAMESPACE_URI, refObjectId); |
1321 |
|
} |
1322 |
1
|
throw new InvalidParameterException("Object type: " + refObjectTypeURI + " is not known to this implementation"); |
1323 |
|
|
1324 |
|
} |
1325 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1326 |
0
|
@Override... |
1327 |
|
public VersionDisplayInfo getLatestVersion(String refObjectTypeURI, |
1328 |
|
String refObjectId) throws DoesNotExistException, |
1329 |
|
InvalidParameterException, MissingParameterException, |
1330 |
|
OperationFailedException, PermissionDeniedException { |
1331 |
0
|
if(ProgramServiceConstants.PROGRAM_NAMESPACE_MAJOR_DISCIPLINE_URI.equals(refObjectTypeURI)){ |
1332 |
0
|
return luService.getLatestVersion(LuServiceConstants.CLU_NAMESPACE_URI, refObjectId); |
1333 |
|
} |
1334 |
0
|
throw new InvalidParameterException("Object type: " + refObjectTypeURI + " is not known to this implementation"); |
1335 |
|
|
1336 |
|
} |
1337 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1338 |
1
|
@Override... |
1339 |
|
public VersionDisplayInfo getVersionBySequenceNumber( |
1340 |
|
String refObjectTypeURI, String refObjectId, Long sequence) |
1341 |
|
throws DoesNotExistException, InvalidParameterException, |
1342 |
|
MissingParameterException, OperationFailedException, |
1343 |
|
PermissionDeniedException { |
1344 |
1
|
if(ProgramServiceConstants.PROGRAM_NAMESPACE_MAJOR_DISCIPLINE_URI.equals(refObjectTypeURI)){ |
1345 |
0
|
return luService.getVersionBySequenceNumber(LuServiceConstants.CLU_NAMESPACE_URI, refObjectId, sequence); |
1346 |
|
} |
1347 |
1
|
throw new InvalidParameterException("Object type: " + refObjectTypeURI + " is not known to this implementation"); |
1348 |
|
} |
1349 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1350 |
1
|
@Override... |
1351 |
|
public List<VersionDisplayInfo> getVersions(String refObjectTypeURI, |
1352 |
|
String refObjectId) throws DoesNotExistException, |
1353 |
|
InvalidParameterException, MissingParameterException, |
1354 |
|
OperationFailedException, PermissionDeniedException { |
1355 |
1
|
if(ProgramServiceConstants.PROGRAM_NAMESPACE_MAJOR_DISCIPLINE_URI.equals(refObjectTypeURI)){ |
1356 |
0
|
return luService.getVersions(LuServiceConstants.CLU_NAMESPACE_URI, refObjectId); |
1357 |
|
} |
1358 |
1
|
throw new InvalidParameterException("Object type: " + refObjectTypeURI + " is not known to this implementation"); |
1359 |
|
} |
1360 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1361 |
1
|
@Override... |
1362 |
|
public List<VersionDisplayInfo> getVersionsInDateRange( |
1363 |
|
String refObjectTypeURI, String refObjectId, Date from, Date to) |
1364 |
|
throws DoesNotExistException, InvalidParameterException, |
1365 |
|
MissingParameterException, OperationFailedException, |
1366 |
|
PermissionDeniedException { |
1367 |
1
|
if(ProgramServiceConstants.PROGRAM_NAMESPACE_MAJOR_DISCIPLINE_URI.equals(refObjectTypeURI)){ |
1368 |
0
|
return luService.getVersionsInDateRange(LuServiceConstants.CLU_NAMESPACE_URI, refObjectId, from, to); |
1369 |
|
} |
1370 |
1
|
throw new InvalidParameterException("Object type: " + refObjectTypeURI + " is not known to this implementation"); |
1371 |
|
} |
1372 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1373 |
1
|
public void setAtpService(AtpService atpService) {... |
1374 |
1
|
this.atpService = atpService; |
1375 |
|
} |
1376 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1377 |
0
|
public AtpService getAtpService() {... |
1378 |
0
|
return atpService; |
1379 |
|
} |
1380 |
|
|
|
|
| 76.2% |
Uncovered Elements: 5 (21) |
Complexity: 6 |
Complexity Density: 0.46 |
|
1381 |
9
|
private void validateMajorDisciplineAtps(MajorDisciplineInfo majorDisciplineInfo, List<ValidationResultInfo> validationResults) throws InvalidParameterException, MissingParameterException, OperationFailedException{... |
1382 |
|
|
1383 |
9
|
String startTerm = majorDisciplineInfo.getStartTerm(); |
1384 |
|
|
1385 |
9
|
if(!isEmpty(majorDisciplineInfo.getAttributes().get("endInstAdmitTerm"))){ |
1386 |
0
|
compareAtps(startTerm, majorDisciplineInfo.getAttributes().get("endInstAdmitTerm"), validationResults, "End Inst Admin Term", "endInstAdmitTerm"); |
1387 |
|
} |
1388 |
|
|
1389 |
9
|
if(!isEmpty(majorDisciplineInfo.getEndProgramEntryTerm())){ |
1390 |
9
|
compareAtps(startTerm, majorDisciplineInfo.getEndProgramEntryTerm(), validationResults, "End Program Entry Term", "endProgramEntryTerm"); |
1391 |
|
} |
1392 |
|
|
1393 |
9
|
if(!isEmpty(majorDisciplineInfo.getEndTerm())){ |
1394 |
9
|
compareAtps(startTerm, majorDisciplineInfo.getEndTerm(), validationResults, "End Program Enroll Term", "endTerm"); |
1395 |
|
} |
1396 |
|
|
1397 |
9
|
List<ProgramVariationInfo> variations = majorDisciplineInfo.getVariations(); |
1398 |
9
|
if(variations != null && !variations.isEmpty()){ |
1399 |
9
|
int idx = 0; |
1400 |
9
|
for(ProgramVariationInfo variation : variations){ |
1401 |
19
|
validateVariationAtps(variation, validationResults, idx); |
1402 |
19
|
idx ++; |
1403 |
|
} |
1404 |
|
} |
1405 |
|
} |
1406 |
|
|
1407 |
|
|
|
|
| 69.2% |
Uncovered Elements: 4 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
1408 |
19
|
private void validateVariationAtps(ProgramVariationInfo programVariationInfo, List<ValidationResultInfo> validationResults, int idx) throws InvalidParameterException, MissingParameterException, OperationFailedException{... |
1409 |
|
|
1410 |
19
|
String startTerm = programVariationInfo.getStartTerm(); |
1411 |
|
|
1412 |
19
|
if(!isEmpty(programVariationInfo.getAttributes().get("endInstAdmitTerm"))){ |
1413 |
0
|
compareAtps(startTerm, programVariationInfo.getAttributes().get("endInstAdmitTerm"), validationResults, "End Inst Admin Term", "variations/" + idx + "/endInstAdmitTerm"); |
1414 |
|
} |
1415 |
|
|
1416 |
19
|
if(!isEmpty(programVariationInfo.getEndProgramEntryTerm())){ |
1417 |
19
|
compareAtps(startTerm, programVariationInfo.getEndProgramEntryTerm(), validationResults, "End Program Entry Term", "variations/" + idx + "/endProgramEntryTerm"); |
1418 |
|
} |
1419 |
|
|
1420 |
19
|
if(!isEmpty(programVariationInfo.getEndTerm())){ |
1421 |
19
|
compareAtps(startTerm, programVariationInfo.getEndTerm(), validationResults, "End Program Enroll Term", "variations/" + idx + "/endTerm"); |
1422 |
|
} |
1423 |
|
} |
1424 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1425 |
56
|
private AtpInfo getAtpInfo(String atpKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException{... |
1426 |
56
|
if(atpKey==null){ |
1427 |
0
|
return null; |
1428 |
|
} |
1429 |
56
|
return atpService.getAtp(atpKey); |
1430 |
|
} |
1431 |
|
|
|
|
| 31.6% |
Uncovered Elements: 13 (19) |
Complexity: 7 |
Complexity Density: 0.54 |
|
1432 |
56
|
private void compareAtps(String aptKey1, String aptKey2, List<ValidationResultInfo> validationResults, String field, String path) throws InvalidParameterException, MissingParameterException, OperationFailedException{... |
1433 |
56
|
AtpInfo atpInfo1 = null; |
1434 |
56
|
AtpInfo atpInfo2 = null; |
1435 |
|
|
1436 |
56
|
try{ |
1437 |
56
|
atpInfo1 = getAtpInfo(aptKey1); |
1438 |
0
|
atpInfo2 = getAtpInfo(aptKey2); |
1439 |
|
}catch(DoesNotExistException e){} |
1440 |
|
|
1441 |
56
|
if(atpInfo1 != null && atpInfo1 != null){ |
1442 |
0
|
if(atpInfo1.getStartDate()!= null && atpInfo2.getStartDate() != null){ |
1443 |
0
|
boolean compareResult = ValidatorUtils.compareValues(atpInfo2.getStartDate(), atpInfo1.getStartDate(), DataType.DATE, "greater_than_equal", true, new ServerDateParser()); |
1444 |
0
|
if(!compareResult){ |
1445 |
0
|
ValidationResultInfo vri = new ValidationResultInfo(); |
1446 |
0
|
vri.setElement(path); |
1447 |
0
|
vri.setError(field + " should be greater than Start Term"); |
1448 |
0
|
validationResults.add(vri); |
1449 |
|
} |
1450 |
|
} |
1451 |
|
} |
1452 |
|
|
1453 |
|
} |
1454 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1455 |
84
|
private boolean isEmpty(String value){... |
1456 |
84
|
return value == null || (value != null && "".equals(value)); |
1457 |
|
} |
1458 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1459 |
1
|
public void setDocumentService(DocumentService documentService) {... |
1460 |
1
|
this.documentService = documentService; |
1461 |
|
} |
1462 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1463 |
0
|
public DocumentService getDocumentService() {... |
1464 |
0
|
return documentService; |
1465 |
|
} |
1466 |
|
|
1467 |
|
} |