1 | |
package org.kuali.student.enrollment.class2.courseregistration.service.assembler; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.List; |
5 | |
import java.util.Map; |
6 | |
|
7 | |
import org.kuali.student.enrollment.courseoffering.dto.ActivityOfferingInfo; |
8 | |
import org.kuali.student.enrollment.courseoffering.dto.CourseOfferingInfo; |
9 | |
import org.kuali.student.enrollment.courseoffering.dto.RegistrationGroupInfo; |
10 | |
import org.kuali.student.enrollment.courseregistration.dto.ActivityRegistrationInfo; |
11 | |
import org.kuali.student.enrollment.courseregistration.dto.CourseRegistrationInfo; |
12 | |
import org.kuali.student.enrollment.courseregistration.dto.RegGroupRegistrationInfo; |
13 | |
import org.kuali.student.enrollment.lpr.dto.LuiPersonRelationInfo; |
14 | |
import org.kuali.student.r2.common.assembler.RelationshipDTOAssembler; |
15 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
16 | |
import org.kuali.student.r2.lum.lrc.infc.ResultValuesGroup; |
17 | |
|
18 | 0 | public class CourseRegistrationAssembler { |
19 | |
|
20 | |
public CourseRegistrationInfo assemble(LuiPersonRelationInfo baseDTO, CourseOfferingInfo courseOfferingInfo, ContextInfo context) { |
21 | 0 | CourseRegistrationInfo courseRegInfo = new CourseRegistrationInfo(); |
22 | 0 | RelationshipDTOAssembler<LuiPersonRelationInfo, CourseRegistrationInfo> commonAssembler = new RelationshipDTOAssembler<LuiPersonRelationInfo, CourseRegistrationInfo>(); |
23 | 0 | courseRegInfo = commonAssembler.assemble(baseDTO, courseRegInfo, context); |
24 | |
|
25 | 0 | courseRegInfo.setStudentId(baseDTO.getPersonId()); |
26 | |
|
27 | |
|
28 | 0 | courseRegInfo.setCourseOffering(courseOfferingInfo); |
29 | 0 | return courseRegInfo; |
30 | |
} |
31 | |
|
32 | |
public CourseRegistrationInfo assemble(LuiPersonRelationInfo courseRegLPR, CourseOfferingInfo courseOfferingInfo, Map<LuiPersonRelationInfo, ActivityOfferingInfo> activityRegLPRs, |
33 | |
LuiPersonRelationInfo regGroupRegLPR, RegistrationGroupInfo regGroupInfo, ContextInfo context) { |
34 | |
|
35 | 0 | CourseRegistrationInfo courseRegInfo = assemble(courseRegLPR, courseOfferingInfo, context); |
36 | 0 | courseRegInfo.setRegGroupRegistration(assembleRegGroup(regGroupRegLPR, activityRegLPRs, regGroupInfo, context)); |
37 | 0 | return courseRegInfo; |
38 | |
} |
39 | |
|
40 | |
public LuiPersonRelationInfo disassemble(CourseRegistrationInfo businessDTO, ContextInfo context) { |
41 | 0 | return null; |
42 | |
} |
43 | |
|
44 | |
|
45 | |
public CourseRegistrationInfo assemble(LuiPersonRelationInfo baseDTO, ResultValuesGroup resultValuesGroup, ContextInfo context) { |
46 | 0 | CourseRegistrationInfo courseRegInfo = new CourseRegistrationInfo(); |
47 | |
|
48 | 0 | courseRegInfo.setId(baseDTO.getId()); |
49 | 0 | courseRegInfo.setStudentId(baseDTO.getPersonId()); |
50 | 0 | if (resultValuesGroup != null){ |
51 | 0 | courseRegInfo.setGradingOptionKey(resultValuesGroup.getKey()); |
52 | |
} |
53 | 0 | return courseRegInfo; |
54 | |
} |
55 | |
|
56 | |
public List<CourseRegistrationInfo> assembleList(List<LuiPersonRelationInfo> baseDTOs, ContextInfo context) { |
57 | 0 | return new ArrayList<CourseRegistrationInfo>(); |
58 | |
} |
59 | |
|
60 | |
public List<CourseRegistrationInfo> assembleList(List<String> luiPersonRelationIdsForLui) { |
61 | 0 | return new ArrayList<CourseRegistrationInfo>(); |
62 | |
} |
63 | |
|
64 | |
private RegGroupRegistrationInfo assembleRegGroup(LuiPersonRelationInfo regGroupRegLPR, Map<LuiPersonRelationInfo, ActivityOfferingInfo> activityLprInfoMap, RegistrationGroupInfo regGroupInfo, |
65 | |
ContextInfo context) { |
66 | |
|
67 | 0 | RegGroupRegistrationInfo regGroupRegistrationInfo = new RegGroupRegistrationInfo(); |
68 | 0 | RelationshipDTOAssembler<LuiPersonRelationInfo, RegGroupRegistrationInfo> commonAssembler = new RelationshipDTOAssembler<LuiPersonRelationInfo, RegGroupRegistrationInfo>(); |
69 | 0 | regGroupRegistrationInfo = commonAssembler.assemble(regGroupRegLPR, regGroupRegistrationInfo, context); |
70 | 0 | regGroupRegistrationInfo.setStudentId(regGroupRegLPR.getPersonId()); |
71 | 0 | regGroupRegistrationInfo.setActivityRegistrations(assembleActivityRegistrations(activityLprInfoMap, context)); |
72 | 0 | regGroupRegistrationInfo.setRegistrationGroup(regGroupInfo); |
73 | |
|
74 | 0 | return regGroupRegistrationInfo; |
75 | |
} |
76 | |
|
77 | |
private List<ActivityRegistrationInfo> assembleActivityRegistrations( Map<LuiPersonRelationInfo, ActivityOfferingInfo> activityLprInfoMap , ContextInfo context) { |
78 | 0 | List<ActivityRegistrationInfo> activityRegistrations = new ArrayList<ActivityRegistrationInfo>(); |
79 | 0 | for ( Map.Entry<LuiPersonRelationInfo, ActivityOfferingInfo> entry : activityLprInfoMap.entrySet() ) { |
80 | 0 | ActivityRegistrationInfo activityRegistrationInfo = new ActivityRegistrationInfo(); |
81 | 0 | RelationshipDTOAssembler<LuiPersonRelationInfo, ActivityRegistrationInfo> commonAssembler = new RelationshipDTOAssembler<LuiPersonRelationInfo, ActivityRegistrationInfo>(); |
82 | 0 | activityRegistrationInfo = commonAssembler.assemble(entry.getKey() , activityRegistrationInfo, context); |
83 | 0 | activityRegistrationInfo.setActivityOffering(entry.getValue() ); |
84 | |
|
85 | 0 | activityRegistrationInfo.setStudentId(entry.getKey().getPersonId()); |
86 | 0 | activityRegistrations.add(activityRegistrationInfo); |
87 | |
|
88 | 0 | } |
89 | 0 | return activityRegistrations; |
90 | |
} |
91 | |
} |