1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.lum.course.service.assembler; |
17 |
|
|
18 |
|
import org.kuali.student.common.util.UUIDHelper; |
19 |
|
import org.kuali.student.core.assembly.BOAssembler; |
20 |
|
import org.kuali.student.core.assembly.BaseDTOAssemblyNode; |
21 |
|
import org.kuali.student.core.assembly.BaseDTOAssemblyNode.NodeOperation; |
22 |
|
import org.kuali.student.core.assembly.data.AssemblyException; |
23 |
|
import org.kuali.student.lum.course.dto.CourseJointInfo; |
24 |
|
import org.kuali.student.lum.lu.dto.CluCluRelationInfo; |
25 |
|
import org.kuali.student.lum.lu.dto.CluInfo; |
26 |
|
import org.kuali.student.lum.lu.service.LuService; |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@author |
32 |
|
|
33 |
|
|
|
|
| 5.4% |
Uncovered Elements: 35 (37) |
Complexity: 8 |
Complexity Density: 0.3 |
|
34 |
|
public class CourseJointAssembler implements BOAssembler<CourseJointInfo, CluCluRelationInfo> { |
35 |
|
|
36 |
|
LuService luService; |
37 |
|
|
38 |
|
|
39 |
|
@return |
40 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
41 |
0
|
public LuService getLuService() {... |
42 |
0
|
return luService; |
43 |
|
} |
44 |
|
|
45 |
|
|
46 |
|
@param |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
48 |
1
|
public void setLuService(LuService luService) {... |
49 |
1
|
this.luService = luService; |
50 |
|
} |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.29 |
|
52 |
0
|
@Override... |
53 |
|
public CourseJointInfo assemble(CluCluRelationInfo cluRel, CourseJointInfo jointInfo, boolean shallowBuild) throws AssemblyException { |
54 |
0
|
if(null == cluRel) { |
55 |
0
|
return null; |
56 |
|
} |
57 |
|
|
58 |
0
|
CourseJointInfo joint = (jointInfo != null) ? jointInfo : new CourseJointInfo(); |
59 |
|
|
60 |
0
|
CluInfo clu; |
61 |
0
|
try { |
62 |
0
|
clu = luService.getClu(cluRel.getRelatedCluId()); |
63 |
|
|
64 |
0
|
joint.setCourseId(clu.getId()); |
65 |
0
|
joint.setType(clu.getType()); |
66 |
0
|
joint.setSubjectArea(clu.getOfficialIdentifier().getDivision()); |
67 |
0
|
joint.setCourseTitle(clu.getOfficialIdentifier().getLongName()); |
68 |
0
|
joint.setCourseNumberSuffix(clu.getOfficialIdentifier().getSuffixCode()); |
69 |
0
|
joint.setRelationId(cluRel.getId()); |
70 |
|
|
71 |
|
} catch (Exception e) { |
72 |
0
|
throw new AssemblyException("Error getting related clus", e); |
73 |
|
} |
74 |
|
|
75 |
0
|
return joint; |
76 |
|
} |
77 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
78 |
0
|
@Override... |
79 |
|
public BaseDTOAssemblyNode<CourseJointInfo, CluCluRelationInfo> disassemble( |
80 |
|
CourseJointInfo joint, NodeOperation operation) throws AssemblyException { |
81 |
|
|
82 |
0
|
if(null == joint){ |
83 |
|
|
84 |
0
|
throw new AssemblyException("Activity can not be null"); |
85 |
|
} |
86 |
|
|
87 |
0
|
BaseDTOAssemblyNode<CourseJointInfo, CluCluRelationInfo> result = new BaseDTOAssemblyNode<CourseJointInfo, CluCluRelationInfo>(this); |
88 |
0
|
result.setBusinessDTORef(joint); |
89 |
0
|
result.setOperation(operation); |
90 |
|
|
91 |
0
|
CluCluRelationInfo cluRel = new CluCluRelationInfo(); |
92 |
0
|
cluRel.setId(UUIDHelper.genStringUUID(joint.getRelationId())); |
93 |
0
|
cluRel.setRelatedCluId(joint.getCourseId()); |
94 |
0
|
cluRel.setType(CourseAssemblerConstants.JOINT_RELATION_TYPE); |
95 |
0
|
result.setNodeData(cluRel); |
96 |
|
|
97 |
|
|
98 |
0
|
return result; |
99 |
|
} |
100 |
|
} |