Clover Coverage Report - KS LUM 1.1.0-M10-SNAPSHOT (Aggregated)
Coverage timestamp: Fri Dec 17 2010 06:40:47 EST
../../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
9   70   4   4.5
4   27   0.44   2
2     2  
1    
 
  BasicContextImpl       Line # 26 9 0% 4 0 100% 1.0
 
  (79)
 
1    /**
2    * Copyright 2010 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.lum.statement.config.context;
17   
18    import java.util.Map;
19   
20    import org.kuali.student.core.statement.dto.ReqComponentInfo;
21    import org.kuali.student.core.statement.naturallanguage.AbstractContext;
22    import org.kuali.student.core.exceptions.OperationFailedException;
23    import org.kuali.student.lum.statement.config.context.util.NLHelper;
24    import org.kuali.student.lum.statement.typekey.ReqComponentFieldTypes;
25   
 
26    public class BasicContextImpl extends AbstractContext<ReqComponentInfo> {
27    /**
28    * <code>NLHelper</code> token (key) references a static natural language
29    * helper class for use in templates.
30    * e.g. '$NLHelper.getProperGrammer($intValue, "course", "courses")'
31    */
32    public final static String NL_HELPER_TOKEN = "NLHelper";
33    /**
34    * Relational operator token.
35    */
36    public final static String OPERATOR_TOKEN = "relationalOperator";
37    /**
38    * An integer value token.
39    */
40    public final static String INTEGER_VALUE_TOKEN = "intValue";
41   
42    /**
43    * Constructor.
44    */
 
45  50 toggle public BasicContextImpl() {
46    }
47   
48    /**
49    * Creates the context map (template data) for the requirement component.
50    * Also, adds the field token map to the context map.
51    *
52    * @param reqComponent Requirement component
53    * @throws OperationFailedException Creating context map fails
54    */
 
55  90 toggle public Map<String, Object> createContextMap(ReqComponentInfo reqComponent) throws OperationFailedException {
56  90 String value = getReqComponentFieldValue(reqComponent, ReqComponentFieldTypes.INTEGER_VALUE1_KEY.getId());
57  90 String operator = getReqComponentFieldValue(reqComponent, ReqComponentFieldTypes.OPERATOR_KEY.getId());
58   
59  90 Map<String, Object> contextMap = super.createContextMap(reqComponent);
60  90 contextMap.put(NL_HELPER_TOKEN, NLHelper.class);
61  90 if(operator != null) {
62  26 contextMap.put(OPERATOR_TOKEN, operator);
63    }
64  90 if(value != null) {
65  48 contextMap.put(INTEGER_VALUE_TOKEN, Integer.valueOf(value));
66    }
67   
68  90 return contextMap;
69    }
70    }