View Javadoc

1   /**
2    * Copyright 2011 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.krms.termresolver;
17  
18  import org.kuali.rice.krms.api.engine.TermResolutionException;
19  import org.kuali.rice.krms.api.engine.TermResolver;
20  import org.kuali.student.krms.util.KSKRMSExecutionConstants;
21  
22  import java.util.Collections;
23  import java.util.Map;
24  import java.util.Set;
25  
26  
27  public class CompletedCourseTermResolver extends AbstractCourseTermResolver implements TermResolver<Boolean> {
28  
29      @Override
30      public String getOutput() {
31          return KSKRMSExecutionConstants.COMPLETED_COURSES_TERM_NAME;
32      }
33  
34      @Override
35      public Set<String> getParameterNames() {
36          return Collections.singleton(KSKRMSExecutionConstants.COURSE_CODE_TERM_PROPERTY);
37      }
38  
39      @Override
40      public int getCost() {
41          // TODO Analyze, though probably not much to check here
42          return 1;
43      }
44  
45      @Override
46      public Boolean resolve(Map<String, Object> resolvedPrereqs, Map<String, String> parameters) throws TermResolutionException {
47  
48          TermResolver<Boolean> completedCoursesTermResolver = new CompletedCoursesTermResolver();
49  
50          String courseCode = this.resolveCourseCode(parameters);
51  
52          parameters.put(KSKRMSExecutionConstants.COURSE_CODE_TERM_PROPERTY, courseCode);
53          return completedCoursesTermResolver.resolve(resolvedPrereqs, parameters);
54      }
55  }