1 | |
package org.kuali.student.enrollment.courseoffering.service; |
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.OfferingInstructorInfo; |
8 | |
import org.kuali.student.r2.common.dto.AttributeInfo; |
9 | |
import org.kuali.student.r2.common.dto.CurrencyAmountInfo; |
10 | |
import org.kuali.student.r2.common.dto.MetaInfo; |
11 | |
import org.kuali.student.r2.common.dto.RichTextInfo; |
12 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
13 | |
import org.kuali.student.r2.common.infc.ValidationResult.ErrorLevel; |
14 | |
import org.kuali.student.r2.core.versionmanagement.dto.VersionDisplayInfo; |
15 | |
import org.kuali.student.r2.lum.lrc.dto.ResultValuesGroupInfo; |
16 | |
import org.kuali.student.r2.lum.clu.dto.AffiliatedOrgInfo; |
17 | |
import org.kuali.student.r2.lum.clu.dto.ExpenditureInfo; |
18 | |
import org.kuali.student.r2.lum.clu.dto.FeeInfo; |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | 0 | public class R1ToR2CopyHelper { |
26 | |
|
27 | |
public ExpenditureInfo copyCourseExpenditure(org.kuali.student.lum.course.dto.CourseExpenditureInfo r1) { |
28 | 0 | if (r1 == null) { |
29 | 0 | return null; |
30 | |
} |
31 | 0 | ExpenditureInfo r2 = new ExpenditureInfo(); |
32 | |
|
33 | 0 | r2.setId(r1.toString()); |
34 | 0 | r2.setAffiliatedOrgs(copyAffiliatedOrgList(r1.getAffiliatedOrgs())); |
35 | 0 | r2.setAttributes(copyAttributes(r1.getAttributes())); |
36 | 0 | return r2; |
37 | |
} |
38 | |
|
39 | |
public List<AffiliatedOrgInfo> copyAffiliatedOrgList(List<org.kuali.student.lum.lu.dto.AffiliatedOrgInfo> r1List) { |
40 | 0 | if (r1List == null) { |
41 | 0 | return null; |
42 | |
} |
43 | 0 | List<AffiliatedOrgInfo> r2List = new ArrayList<AffiliatedOrgInfo>(r1List.size()); |
44 | 0 | for (org.kuali.student.lum.lu.dto.AffiliatedOrgInfo r1 : r1List) { |
45 | 0 | r2List.add(copyAffiliatedOrg(r1)); |
46 | |
} |
47 | 0 | return r2List; |
48 | |
} |
49 | |
|
50 | |
public AffiliatedOrgInfo copyAffiliatedOrg(org.kuali.student.lum.lu.dto.AffiliatedOrgInfo r1) { |
51 | 0 | if (r1 == null) { |
52 | 0 | return null; |
53 | |
} |
54 | 0 | AffiliatedOrgInfo r2 = new AffiliatedOrgInfo(); |
55 | 0 | r2.setId(r1.getId()); |
56 | |
|
57 | 0 | r2.setEffectiveDate(r1.getEffectiveDate()); |
58 | 0 | r2.setExpirationDate(r1.getExpirationDate()); |
59 | 0 | r2.setOrgId(r1.getOrgId()); |
60 | 0 | r2.setPercentage(r1.getPercentage()); |
61 | 0 | return r2; |
62 | |
} |
63 | |
|
64 | |
public List<AttributeInfo> copyAttributes(Map<String, String> r1Map) { |
65 | 0 | if (r1Map == null) { |
66 | 0 | return null; |
67 | |
} |
68 | 0 | List<AttributeInfo> r2List = new ArrayList<AttributeInfo>(r1Map.size()); |
69 | 0 | for (String key : r1Map.keySet()) { |
70 | 0 | AttributeInfo r2 = new AttributeInfo(); |
71 | 0 | r2.setId(key); |
72 | 0 | r2.setKey(key); |
73 | 0 | r2.setValue(r1Map.get(key)); |
74 | 0 | r2List.add(r2); |
75 | 0 | } |
76 | 0 | return r2List; |
77 | |
} |
78 | |
|
79 | |
public ValidationResultInfo copyValidationResult(org.kuali.student.common.validation.dto.ValidationResultInfo r1) { |
80 | 0 | if (r1 == null) { |
81 | 0 | return null; |
82 | |
} |
83 | 0 | ValidationResultInfo r2 = new ValidationResultInfo(); |
84 | 0 | r2.setElement(r1.getElement()); |
85 | 0 | r2.setMessage(r1.getMessage()); |
86 | 0 | switch (r1.getErrorLevel()) { |
87 | |
case ERROR: |
88 | 0 | r2.setErrorLevel(ErrorLevel.ERROR); |
89 | |
case OK: |
90 | 0 | r2.setErrorLevel(ErrorLevel.OK); |
91 | |
case WARN: |
92 | 0 | r2.setErrorLevel(ErrorLevel.WARN); |
93 | |
} |
94 | 0 | return r2; |
95 | |
} |
96 | |
|
97 | |
public List<ValidationResultInfo> copyValidationResultList(List<org.kuali.student.common.validation.dto.ValidationResultInfo> r1list) { |
98 | 0 | if (r1list == null) { |
99 | 0 | return null; |
100 | |
} |
101 | 0 | List<ValidationResultInfo> list = new ArrayList<ValidationResultInfo>(r1list.size()); |
102 | 0 | for (org.kuali.student.common.validation.dto.ValidationResultInfo r1 : r1list) { |
103 | 0 | list.add(copyValidationResult(r1)); |
104 | |
} |
105 | 0 | return list; |
106 | |
} |
107 | |
|
108 | |
public List<FeeInfo> copyCourseFeeList(List<org.kuali.student.lum.course.dto.CourseFeeInfo> r1List) { |
109 | 0 | if (r1List == null) { |
110 | 0 | return null; |
111 | |
} |
112 | 0 | List<FeeInfo> r2List = new ArrayList<FeeInfo>(r1List.size()); |
113 | 0 | for (org.kuali.student.lum.course.dto.CourseFeeInfo r1 : r1List) { |
114 | 0 | r2List.add(copyCourseFee(r1)); |
115 | |
} |
116 | 0 | return r2List; |
117 | |
} |
118 | |
|
119 | |
public FeeInfo copyCourseFee(org.kuali.student.lum.course.dto.CourseFeeInfo r1) { |
120 | 0 | if (r1 == null) { |
121 | 0 | return null; |
122 | |
} |
123 | 0 | FeeInfo r2 = new FeeInfo(); |
124 | 0 | r2.setId(r1.getId()); |
125 | 0 | r2.setAttributes(copyAttributes(r1.getAttributes())); |
126 | 0 | r2.setDescr(copyRichText(r1.getDescr())); |
127 | 0 | r2.setFeeAmounts(copyCurrencyAmountList(r1.getFeeAmounts())); |
128 | 0 | return r2; |
129 | |
} |
130 | |
|
131 | |
public RichTextInfo copyRichText(org.kuali.student.common.dto.RichTextInfo r1) { |
132 | 0 | if (r1 == null) { |
133 | 0 | return null; |
134 | |
} |
135 | 0 | RichTextInfo r2 = new RichTextInfo(); |
136 | 0 | r2.setFormatted(r1.getFormatted()); |
137 | 0 | r2.setPlain(r1.getPlain()); |
138 | 0 | return r2; |
139 | |
} |
140 | |
|
141 | |
public List<CurrencyAmountInfo> copyCurrencyAmountList(List<org.kuali.student.common.dto.CurrencyAmountInfo> r1List) { |
142 | 0 | if (r1List == null) { |
143 | 0 | return null; |
144 | |
} |
145 | 0 | List<CurrencyAmountInfo> r2List = new ArrayList<CurrencyAmountInfo>(r1List.size()); |
146 | 0 | for (org.kuali.student.common.dto.CurrencyAmountInfo r1 : r1List) { |
147 | 0 | r2List.add(copyCurrencyAmountInfo(r1)); |
148 | |
} |
149 | 0 | return r2List; |
150 | |
} |
151 | |
|
152 | |
public CurrencyAmountInfo copyCurrencyAmountInfo(org.kuali.student.common.dto.CurrencyAmountInfo r1) { |
153 | 0 | if (r1 == null) { |
154 | 0 | return null; |
155 | |
} |
156 | 0 | CurrencyAmountInfo r2 = new CurrencyAmountInfo(); |
157 | |
|
158 | 0 | r2.setCurrencyTypeKey(r1.getCurrencyTypeKey()); |
159 | 0 | r2.setCurrencyQuantity(r1.getCurrencyQuantity()); |
160 | |
|
161 | 0 | return r2; |
162 | |
} |
163 | |
|
164 | |
public MetaInfo copyMetaInfo(org.kuali.student.common.dto.MetaInfo r1) { |
165 | 0 | if (r1 == null) { |
166 | 0 | return null; |
167 | |
} |
168 | 0 | MetaInfo r2 = new MetaInfo(); |
169 | 0 | r2.setCreateId(r1.getCreateId()); |
170 | 0 | r2.setCreateTime(r1.getCreateTime()); |
171 | 0 | r2.setUpdateId(r1.getUpdateId()); |
172 | 0 | r2.setUpdateTime(r1.getUpdateTime()); |
173 | 0 | r2.setVersionInd(r1.getVersionInd()); |
174 | 0 | return r2; |
175 | |
} |
176 | |
|
177 | |
public List<ResultValuesGroupInfo> copyResultValuesGroupList(List<org.kuali.student.lum.lrc.dto.ResultComponentInfo> r1List) { |
178 | 0 | if (r1List == null) { |
179 | 0 | return null; |
180 | |
} |
181 | 0 | List<ResultValuesGroupInfo> r2List = new ArrayList<ResultValuesGroupInfo>(r1List.size()); |
182 | 0 | for (org.kuali.student.lum.lrc.dto.ResultComponentInfo r1 : r1List) { |
183 | 0 | r2List.add(copyResultValuesGroup(r1)); |
184 | |
} |
185 | 0 | return r2List; |
186 | |
} |
187 | |
|
188 | |
public ResultValuesGroupInfo copyResultValuesGroup(org.kuali.student.lum.lrc.dto.ResultComponentInfo r1) { |
189 | 0 | if (r1 == null) { |
190 | 0 | return null; |
191 | |
} |
192 | 0 | ResultValuesGroupInfo r2 = new ResultValuesGroupInfo(); |
193 | 0 | r2.setAttributes(copyAttributes(r1.getAttributes())); |
194 | 0 | r2.setDescr(copyRichText(r1.getDesc())); |
195 | |
|
196 | 0 | r2.setEffectiveDate(r1.getEffectiveDate()); |
197 | 0 | r2.setExpirationDate(r1.getExpirationDate()); |
198 | 0 | r2.setKey(r1.getId()); |
199 | 0 | r2.setMeta(copyMetaInfo(r1.getMetaInfo())); |
200 | 0 | r2.setName(r1.getName()); |
201 | 0 | r2.setResultValueKeys(r1.getResultValues()); |
202 | |
|
203 | 0 | r2.setResultValueRange(null); |
204 | 0 | r2.setStateKey(r1.getState()); |
205 | 0 | r2.setTypeKey(r1.getType()); |
206 | 0 | return r2; |
207 | |
|
208 | |
} |
209 | |
|
210 | |
public List<OfferingInstructorInfo> copyInstructors(List<org.kuali.student.lum.lu.dto.CluInstructorInfo> r1List) { |
211 | 0 | if (r1List == null) { |
212 | 0 | return null; |
213 | |
} |
214 | 0 | List<OfferingInstructorInfo> r2List = new ArrayList<OfferingInstructorInfo>(r1List.size()); |
215 | 0 | for (org.kuali.student.lum.lu.dto.CluInstructorInfo r1 : r1List) { |
216 | 0 | r2List.add(copyInstructor(r1)); |
217 | |
} |
218 | 0 | return r2List; |
219 | |
} |
220 | |
|
221 | |
public OfferingInstructorInfo copyInstructor(org.kuali.student.lum.lu.dto.CluInstructorInfo r1) { |
222 | 0 | if (r1 == null) { |
223 | 0 | return null; |
224 | |
} |
225 | 0 | OfferingInstructorInfo r2 = new OfferingInstructorInfo(); |
226 | 0 | r2.setAttributes(copyAttributes(r1.getAttributes())); |
227 | 0 | r2.setPersonId(r1.getPersonId()); |
228 | |
|
229 | 0 | return r2; |
230 | |
} |
231 | |
|
232 | |
public VersionDisplayInfo copyVersionDisplay(org.kuali.student.common.versionmanagement.dto.VersionDisplayInfo r1) { |
233 | 0 | if (r1 == null) { |
234 | 0 | return null; |
235 | |
} |
236 | 0 | VersionDisplayInfo r2 = new VersionDisplayInfo(); |
237 | 0 | r2.setId(r1.getId()); |
238 | 0 | r2.setRefObjectUri(r1.getObjectTypeURI()); |
239 | 0 | r2.setCurrentVersionStart(r1.getCurrentVersionStart()); |
240 | 0 | r2.setCurrentVersionEnd(r1.getCurrentVersionEnd()); |
241 | 0 | r2.setSequenceNumber(r1.getSequenceNumber()); |
242 | 0 | r2.setVersionComment(r1.getVersionComment()); |
243 | 0 | r2.setVersionIndId(r1.getVersionIndId()); |
244 | 0 | r2.setVersionedFromId(r1.getVersionedFromId()); |
245 | 0 | return r2; |
246 | |
} |
247 | |
|
248 | |
public List<VersionDisplayInfo> copyVersionDisplays(List<org.kuali.student.common.versionmanagement.dto.VersionDisplayInfo> r1List) { |
249 | 0 | if (r1List == null) { |
250 | 0 | return null; |
251 | |
} |
252 | 0 | List<VersionDisplayInfo> r2List = new ArrayList<VersionDisplayInfo>(r1List.size()); |
253 | 0 | for (org.kuali.student.common.versionmanagement.dto.VersionDisplayInfo r1 : r1List) { |
254 | 0 | r2List.add(copyVersionDisplay(r1)); |
255 | |
} |
256 | 0 | return r2List; |
257 | |
} |
258 | |
} |