1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.student.r2.lum.statement.config.context;
17  
18  import java.util.Map;
19  
20  import org.kuali.student.r2.lum.statement.config.context.util.NLHelper;
21  import org.kuali.student.r2.common.exceptions.OperationFailedException;
22  import org.kuali.student.r1.core.statement.dto.ReqComponentInfo;
23  import org.kuali.student.r1.core.statement.naturallanguage.AbstractContext;
24  import org.kuali.student.r1.lum.statement.typekey.ReqComponentFieldTypes;
25  import org.kuali.student.r2.common.dto.ContextInfo;
26  
27  public class BasicContextImpl extends AbstractContext<ReqComponentInfo> {
28  	
29  
30  
31  
32  
33  	public final static String NL_HELPER_TOKEN = "NLHelper";
34  	
35  
36  
37  	public final static String OPERATOR_TOKEN = "relationalOperator";
38  	
39  
40  
41  	public final static String INTEGER_VALUE_TOKEN = "intValue";
42  
43  	
44  
45  
46  	public BasicContextImpl() {
47  	}
48  	
49      
50  
51  
52  
53  
54  
55  
56  
57  
58  
59      public Map<String, Object> createContextMap(ReqComponentInfo reqComponent, ContextInfo contextInfo) throws OperationFailedException {
60      	String value = getReqComponentFieldValue(reqComponent, ReqComponentFieldTypes.INTEGER_VALUE1_KEY.getId());
61      	String operator = getReqComponentFieldValue(reqComponent, ReqComponentFieldTypes.OPERATOR_KEY.getId());
62      	
63      	Map<String, Object> contextMap = super.createContextMap(reqComponent,contextInfo);
64          contextMap.put(NL_HELPER_TOKEN, NLHelper.class);
65  		if(operator != null) {
66  	        contextMap.put(OPERATOR_TOKEN, operator);
67  		}
68  		if(value != null) {
69  			contextMap.put(INTEGER_VALUE_TOKEN, Integer.valueOf(value));
70  		}
71  
72          return contextMap;
73      }
74  }