1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.enrollment.class1.state.impl;
17
18 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
19 import org.kuali.student.enrollment.courseoffering.dto.ActivityOfferingInfo;
20 import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService;
21 import org.kuali.student.r2.common.dto.ContextInfo;
22 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
23 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
24 import org.kuali.student.r2.common.exceptions.MissingParameterException;
25 import org.kuali.student.r2.common.exceptions.OperationFailedException;
26 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
27 import org.kuali.student.r2.common.util.constants.CourseOfferingServiceConstants;
28 import org.kuali.student.r2.core.class1.state.service.RelatedObjectHelper;
29
30 import javax.xml.namespace.QName;
31 import java.util.HashMap;
32 import java.util.Map;
33
34 public class RelatedObjectHelperAOtoAOSchedImpl implements RelatedObjectHelper {
35
36 private CourseOfferingService courseOfferingService;
37
38 public RelatedObjectHelperAOtoAOSchedImpl(){}
39
40 @Override
41 public Map<String, String> getRelatedObjectsIdAndState(String entityId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
42
43 ActivityOfferingInfo activityOfferingInfo = getCourseOfferingService().getActivityOffering(entityId, contextInfo);
44 Map<String,String> stateKeys = new HashMap<String, String>();
45 stateKeys.put(activityOfferingInfo.getId(), activityOfferingInfo.getSchedulingStateKey());
46 return stateKeys;
47 }
48
49 protected CourseOfferingService getCourseOfferingService(){
50 if (courseOfferingService == null){
51 courseOfferingService = (CourseOfferingService) GlobalResourceLoader.getService(new QName(CourseOfferingServiceConstants.NAMESPACE, CourseOfferingServiceConstants.SERVICE_NAME_LOCAL_PART));
52 }
53 return courseOfferingService;
54 }
55
56 }