1
2
3
4
5 package org.kuali.student.enrollment.class2.courseofferingset.service.impl;
6
7 import java.util.*;
8 import org.kuali.student.enrollment.class2.courseofferingset.service.decorators.CourseOfferingSetServiceDecorator;
9 import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultInfo;
10 import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultItemInfo;
11 import org.kuali.student.r2.common.dto.ContextInfo;
12 import org.kuali.student.r2.common.util.RichTextHelper;
13 import org.kuali.student.r2.common.util.constants.CourseOfferingSetServiceConstants;
14
15 public class CourseOfferingSetServiceMockImplWithDataLoaded extends CourseOfferingSetServiceMockImpl {
16
17
18 public CourseOfferingSetServiceMockImplWithDataLoaded() {
19 super();
20 Integer year = 2001;
21 for (int i = 0; i < 10; i++) {
22 SocRolloverResultInfo result = new SocRolloverResultInfo();
23 result.setMessage(new RichTextHelper().toRichTextInfo("message plain " + i, "message formatted " + i));
24 result.setTypeKey(CourseOfferingSetServiceConstants.ROLLOVER_RESULT_TYPE_KEY);
25 result.setStateKey(CourseOfferingSetServiceConstants.SUBMITTED_RESULT_STATE_KEY);
26 result.setItemsExpected(5);
27 result.setItemsProcessed(2);
28 result.setCourseOfferingsSkipped(3);
29 result.setSourceSocId("sourceSocId" + i);
30 result.setTargetSocId("targetSocId" + i);
31 result.setSourceTermId("Fall " + year);
32 result.setTargetTermId("Fall " + ++year);
33 result.getOptionKeys().add("my first option");
34 result.getOptionKeys().add("my 2nd option");
35 try {
36 result = createSocRolloverResult(result.getTypeKey(), result, new ContextInfo());
37 List<SocRolloverResultItemInfo> socRolloverResultItemInfos = new ArrayList<SocRolloverResultItemInfo>();
38 SocRolloverResultItemInfo socRolloverResultItemInfo1 = new SocRolloverResultItemInfo();
39 socRolloverResultItemInfo1.setSocRolloverResultId(result.getSourceSocId() + result.getTargetSocId());
40 socRolloverResultItemInfo1.setMessage(new RichTextHelper().toRichTextInfo("Cancelled;Cancelled during source term", "Cancelled;Cancelled during source term"));
41 socRolloverResultItemInfo1.setSourceCourseOfferingId("ENG428");
42 socRolloverResultItemInfo1.setTargetCourseOfferingId("ENG428");
43 socRolloverResultItemInfo1.setTypeKey(CourseOfferingSetServiceConstants.ROLLOVER_RESULT_TYPE_KEY);
44 socRolloverResultItemInfos.add(socRolloverResultItemInfo1);
45 SocRolloverResultItemInfo socRolloverResultItemInfo2 = new SocRolloverResultItemInfo();
46 socRolloverResultItemInfo2.setSocRolloverResultId(result.getSourceSocId() + result.getTargetSocId());
47 socRolloverResultItemInfo2.setMessage(new RichTextHelper().toRichTextInfo("New version;New version of the course exists", "New version;New version of the course exists"));
48 socRolloverResultItemInfo2.setSourceCourseOfferingId("ENG364");
49 socRolloverResultItemInfo2.setTargetCourseOfferingId("ENG364");
50 socRolloverResultItemInfo2.setTypeKey(CourseOfferingSetServiceConstants.ROLLOVER_RESULT_TYPE_KEY);
51 socRolloverResultItemInfos.add(socRolloverResultItemInfo2);
52 SocRolloverResultItemInfo socRolloverResultItemInfo3 = new SocRolloverResultItemInfo();
53 socRolloverResultItemInfo3.setSocRolloverResultId(result.getSourceSocId() + result.getTargetSocId());
54 socRolloverResultItemInfo3.setMessage(new RichTextHelper().toRichTextInfo("Retired;No longer offered,as of January 1, 2012", "Retired;No longer offered,as of January 1, 2012"));
55 socRolloverResultItemInfo3.setSourceCourseOfferingId("MATH140");
56 socRolloverResultItemInfo3.setTargetCourseOfferingId("MATH140");
57 socRolloverResultItemInfo3.setTypeKey(CourseOfferingSetServiceConstants.ROLLOVER_RESULT_TYPE_KEY);
58 socRolloverResultItemInfos.add(socRolloverResultItemInfo3);
59 SocRolloverResultItemInfo socRolloverResultItemInfo4 = new SocRolloverResultItemInfo();
60 socRolloverResultItemInfo4.setSocRolloverResultId(result.getSourceSocId() + result.getTargetSocId());
61 socRolloverResultItemInfo4.setMessage(new RichTextHelper().toRichTextInfo("Cancelled;Cancelled during source term", "Cancelled;Cancelled during source term"));
62 socRolloverResultItemInfo4.setSourceCourseOfferingId("MATH140");
63 socRolloverResultItemInfo4.setTargetCourseOfferingId("MATH140");
64 socRolloverResultItemInfo4.setTypeKey(CourseOfferingSetServiceConstants.ROLLOVER_RESULT_TYPE_KEY);
65 socRolloverResultItemInfos.add(socRolloverResultItemInfo4);
66 createSocRolloverResultItems(result.getSourceSocId() + result.getTargetSocId(), CourseOfferingSetServiceConstants.ROLLOVER_RESULT_TYPE_KEY, socRolloverResultItemInfos, new ContextInfo());
67 } catch (Exception ex) {
68 throw new RuntimeException(ex);
69 }
70 }
71 }
72 }