| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.lum.statement.config.context; |
| 17 | |
|
| 18 | |
import java.util.Map; |
| 19 | |
|
| 20 | |
import org.kuali.student.common.exceptions.OperationFailedException; |
| 21 | |
import org.kuali.student.core.statement.dto.ReqComponentInfo; |
| 22 | |
import org.kuali.student.core.statement.naturallanguage.AbstractContext; |
| 23 | |
import org.kuali.student.lum.statement.config.context.util.NLHelper; |
| 24 | |
import org.kuali.student.lum.statement.typekey.ReqComponentFieldTypes; |
| 25 | |
|
| 26 | 10 | public class BasicContextImpl extends AbstractContext<ReqComponentInfo> { |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
public final static String NL_HELPER_TOKEN = "NLHelper"; |
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
public final static String OPERATOR_TOKEN = "relationalOperator"; |
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
public final static String INTEGER_VALUE_TOKEN = "intValue"; |
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | 43 | public BasicContextImpl() { |
| 46 | 43 | } |
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
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 | |
} |