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.enrollment.examoffering.dto.ExamOfferingInfo;
23 import org.kuali.student.enrollment.examoffering.dto.ExamOfferingRelationInfo;
24 import org.kuali.student.enrollment.examoffering.service.ExamOfferingService;
25 import org.kuali.student.r2.common.dto.ContextInfo;
26 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
27 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
28 import org.kuali.student.r2.common.exceptions.MissingParameterException;
29 import org.kuali.student.r2.common.exceptions.OperationFailedException;
30 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
31 import org.kuali.student.r2.common.util.constants.CourseOfferingServiceConstants;
32 import org.kuali.student.r2.common.util.constants.ExamOfferingServiceConstants;
33 import org.kuali.student.r2.core.class1.state.service.RelatedObjectHelper;
34
35 import javax.xml.namespace.QName;
36 import java.util.HashMap;
37 import java.util.List;
38 import java.util.Map;
39
40
41
42
43
44
45 public class RelatedObjectHelperFOtoEOImpl implements RelatedObjectHelper {
46
47 private ExamOfferingService examOfferingService;
48
49 @Override
50 public Map<String, String> getRelatedObjectsIdAndState(String formatOfferingId, ContextInfo contextInfo)
51 throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
52
53 Map<String, String> idsAndStatesMap = new HashMap<String, String>();
54
55 List<ExamOfferingRelationInfo> eoRelations = this.getExamOfferingService().getExamOfferingRelationsByFormatOffering(formatOfferingId, contextInfo);
56 for(ExamOfferingRelationInfo eoRelation : eoRelations){
57 ExamOfferingInfo examOffering = this.getExamOfferingService().getExamOffering(eoRelation.getExamOfferingId(), contextInfo);
58 idsAndStatesMap.put(examOffering.getId(), examOffering.getStateKey());
59 }
60
61 return idsAndStatesMap;
62 }
63
64 protected ExamOfferingService getExamOfferingService(){
65 if (examOfferingService == null){
66 examOfferingService = (ExamOfferingService) GlobalResourceLoader.getService(new QName(ExamOfferingServiceConstants.NAMESPACE, ExamOfferingServiceConstants.SERVICE_NAME_LOCAL_PART));
67 }
68 return examOfferingService;
69 }
70
71 }