1 | |
package org.kuali.student.enrollment.class2.acal.service.impl; |
2 | |
|
3 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
4 | |
import org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl; |
5 | |
import org.kuali.student.enrollment.acal.dto.TermInfo; |
6 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarService; |
7 | |
import org.kuali.student.enrollment.class2.acal.form.AcademicTermForm; |
8 | |
import org.kuali.student.enrollment.class2.acal.service.AcademicTermEditViewHelperService; |
9 | |
import org.kuali.student.r2.common.constants.CommonServiceConstants; |
10 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
11 | |
|
12 | |
import javax.xml.namespace.QName; |
13 | |
|
14 | 0 | public class AcademicTermEditViewHelperServiceImpl extends ViewHelperServiceImpl implements AcademicTermEditViewHelperService { |
15 | |
|
16 | |
private AcademicCalendarService acalService; |
17 | |
|
18 | |
public void saveTerm(AcademicTermForm academicTermForm,ContextInfo context) throws Exception { |
19 | |
|
20 | 0 | TermInfo termInfo = academicTermForm.getTermInfo(); |
21 | 0 | termInfo.setStartDate(academicTermForm.getStartDate()); |
22 | 0 | termInfo.setEndDate(academicTermForm.getEndDate()); |
23 | 0 | termInfo.setName(academicTermForm.getName()); |
24 | 0 | termInfo.setTypeKey(academicTermForm.getTermType()); |
25 | |
|
26 | 0 | TermInfo term = getAcalService().updateTerm(termInfo.getTypeKey(), termInfo, context); |
27 | |
|
28 | |
|
29 | |
|
30 | 0 | } |
31 | |
|
32 | |
public void buildTerm(String termId,AcademicTermForm academicTermForm,ContextInfo context) throws Exception { |
33 | |
|
34 | 0 | TermInfo term = getAcalService().getTerm(termId, context); |
35 | |
|
36 | 0 | academicTermForm.setTermInfo(term); |
37 | 0 | academicTermForm.setStartDate(term.getStartDate()); |
38 | 0 | academicTermForm.setEndDate(term.getEndDate()); |
39 | 0 | academicTermForm.setTermType(term.getTypeKey()); |
40 | 0 | academicTermForm.setName(term.getName()); |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | 0 | } |
46 | |
|
47 | |
public AcademicCalendarService getAcalService() { |
48 | 0 | if(acalService == null) { |
49 | 0 | acalService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName(CommonServiceConstants.REF_OBJECT_URI_GLOBAL_PREFIX + "acal", "AcademicCalendarService")); |
50 | |
} |
51 | 0 | return this.acalService; |
52 | |
} |
53 | |
|
54 | |
} |