1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.student.enrollment.class2.courseoffering.keyvalue;
18
19 import org.kuali.rice.core.api.util.ConcreteKeyValue;
20 import org.kuali.rice.core.api.util.KeyValue;
21 import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
22 import org.kuali.rice.krad.uif.view.ViewModel;
23 import org.kuali.rice.krad.web.form.MaintenanceDocumentForm;
24 import org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingWrapper;
25 import org.kuali.student.enrollment.courseoffering.dto.CourseOfferingInfo;
26 import org.kuali.student.r2.lum.course.dto.CourseCrossListingInfo;
27 import org.kuali.student.r2.lum.course.dto.CourseInfo;
28
29 import java.io.Serializable;
30 import java.util.ArrayList;
31 import java.util.List;
32
33
34
35
36
37 public class populateCrossCourseListKeyValues extends UifKeyValuesFinderBase implements Serializable {
38
39 @Override
40 public List<KeyValue> getKeyValues(ViewModel model) {
41 MaintenanceDocumentForm coForm = (MaintenanceDocumentForm) model;
42 CourseOfferingWrapper wrapper = (CourseOfferingWrapper)coForm.getDocument().getNewMaintainableObject().getDataObject();
43
44 List<KeyValue> keyValues = new ArrayList<KeyValue>();
45 CourseOfferingInfo courseOffering = wrapper.getCourseOfferingInfo();
46 CourseInfo CoInfo = wrapper.getCourse();
47
48 if (CoInfo != null && CoInfo.getCrossListings() != null && CoInfo.getCrossListings().size() > 0) {
49
50 for (CourseCrossListingInfo courseInfo : CoInfo.getCrossListings()) {
51 if(courseInfo.getCode() != null) {
52 if(courseOffering.getCourseNumberSuffix() == null) {
53 keyValues.add(new ConcreteKeyValue(courseInfo.getCode(), courseInfo.getCode()));
54 } else {
55 keyValues.add(new ConcreteKeyValue(courseInfo.getCode()+courseOffering.getCourseNumberSuffix(), courseInfo.getCode()+courseOffering.getCourseNumberSuffix()));
56 }
57 }
58 }
59 }
60
61 return keyValues;
62 }
63 }