View Javadoc

1   /**
2    * Copyright 2012 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   *
15   */
16  package org.kuali.student.enrollment.class1.state.impl;
17  
18  
19  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
20  import org.kuali.student.enrollment.courseofferingset.dto.SocInfo;
21  import org.kuali.student.enrollment.courseofferingset.service.CourseOfferingSetService;
22  import org.kuali.student.r2.common.dto.ContextInfo;
23  import org.kuali.student.r2.common.dto.StatusInfo;
24  import org.kuali.student.r2.common.exceptions.DoesNotExistException;
25  import org.kuali.student.r2.common.exceptions.InvalidParameterException;
26  import org.kuali.student.r2.common.exceptions.MissingParameterException;
27  import org.kuali.student.r2.common.exceptions.OperationFailedException;
28  import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
29  import org.kuali.student.r2.common.util.constants.CourseOfferingSetServiceConstants;
30  import org.kuali.student.r2.core.class1.state.service.StateHelper;
31  
32  import javax.xml.namespace.QName;
33  
34  public class SOCSchedStateHelperImpl implements StateHelper {
35      private CourseOfferingSetService courseOfferingSetService;
36  
37      public SOCSchedStateHelperImpl(){}
38  
39      protected CourseOfferingSetService getCourseOfferingSetService(){
40          if (courseOfferingSetService == null){
41               courseOfferingSetService = (CourseOfferingSetService) GlobalResourceLoader.getService(new QName(CourseOfferingSetServiceConstants.NAMESPACE, CourseOfferingSetServiceConstants.SERVICE_NAME_LOCAL_PART));
42          }
43          return  courseOfferingSetService;
44      }
45  
46      @Override
47      public StatusInfo updateState(String entityId, String nextStateKey, ContextInfo context) {
48          return null;  //To change body of implemented methods use File | Settings | File Templates.
49      }
50  
51      @Override
52      public String getStateKey(String entityId, ContextInfo context) throws InvalidParameterException, MissingParameterException, DoesNotExistException, OperationFailedException, PermissionDeniedException {
53          SocInfo soc = getCourseOfferingSetService().getSoc(entityId, context);
54          return soc.getSchedulingStateKey();
55      }
56  }