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