@Test public void ok() { EvaluationFunction evFunction = engine.buildEvaluationFunction(FUNCTION_NAME) .withValueParam(PARAM_NAME, ValueType.STRING, new ValueEvaluation(YEAR_INTID)); assertEquals(YEAR_VALUE, evFunction.evaluate().getData()); }
@Override public ValueEvaluation evaluate() { try { checkContractCompliance(); ValueEvaluation paramIntId = valueParams.getParams(PARAM_INT_ID).get(0).getEvaluation(); String intId = (String) paramIntId.getData(); if (intId == null) { return errorResultParamNull(PARAM_INT_ID, paramIntId); } else if (intId.isEmpty()) { return errorResult(String.format("hodnota parametru %s je prázdná", PARAM_INT_ID)); } Integer value = engine.getProvidedVarsManager().getProvidedInteger(intId); if (value == null) { return errorResult(String.format("číslo s id %s není poskytováno", intId)); } else { return okResult(value); } } catch (ContractException e) { return errorResultContractNotMet(e); } catch (Throwable e) { return errorResultUnexpectedError(e); } }
EfGetProvidedInteger extends EvaluationFunction { @Override public ValueEvaluation evaluate() { try { checkContractCompliance(); ValueEvaluation paramIntId = valueParams.getParams(PARAM_INT_ID).get(0).getEvaluation(); String intId = (String) paramIntId.getData(); if (intId == null) { return errorResultParamNull(PARAM_INT_ID, paramIntId); } else if (intId.isEmpty()) { return errorResult(String.format("hodnota parametru %s je prázdná", PARAM_INT_ID)); } Integer value = engine.getProvidedVarsManager().getProvidedInteger(intId); if (value == null) { return errorResult(String.format("číslo s id %s není poskytováno", intId)); } else { return okResult(value); } } catch (ContractException e) { return errorResultContractNotMet(e); } catch (Throwable e) { return errorResultUnexpectedError(e); } } }
EfGetProvidedInteger extends EvaluationFunction { @Override public ValueEvaluation evaluate() { try { checkContractCompliance(); ValueEvaluation paramIntId = valueParams.getParams(PARAM_INT_ID).get(0).getEvaluation(); String intId = (String) paramIntId.getData(); if (intId == null) { return errorResultParamNull(PARAM_INT_ID, paramIntId); } else if (intId.isEmpty()) { return errorResult(String.format("hodnota parametru %s je prázdná", PARAM_INT_ID)); } Integer value = engine.getProvidedVarsManager().getProvidedInteger(intId); if (value == null) { return errorResult(String.format("číslo s id %s není poskytováno", intId)); } else { return okResult(value); } } catch (ContractException e) { return errorResultContractNotMet(e); } catch (Throwable e) { return errorResultUnexpectedError(e); } } EfGetProvidedInteger(String name, Engine engine); }
EfGetProvidedInteger extends EvaluationFunction { @Override public ValueEvaluation evaluate() { try { checkContractCompliance(); ValueEvaluation paramIntId = valueParams.getParams(PARAM_INT_ID).get(0).getEvaluation(); String intId = (String) paramIntId.getData(); if (intId == null) { return errorResultParamNull(PARAM_INT_ID, paramIntId); } else if (intId.isEmpty()) { return errorResult(String.format("hodnota parametru %s je prázdná", PARAM_INT_ID)); } Integer value = engine.getProvidedVarsManager().getProvidedInteger(intId); if (value == null) { return errorResult(String.format("číslo s id %s není poskytováno", intId)); } else { return okResult(value); } } catch (ContractException e) { return errorResultContractNotMet(e); } catch (Throwable e) { return errorResultUnexpectedError(e); } } EfGetProvidedInteger(String name, Engine engine); @Override ValueEvaluation evaluate(); }
EfGetProvidedInteger extends EvaluationFunction { @Override public ValueEvaluation evaluate() { try { checkContractCompliance(); ValueEvaluation paramIntId = valueParams.getParams(PARAM_INT_ID).get(0).getEvaluation(); String intId = (String) paramIntId.getData(); if (intId == null) { return errorResultParamNull(PARAM_INT_ID, paramIntId); } else if (intId.isEmpty()) { return errorResult(String.format("hodnota parametru %s je prázdná", PARAM_INT_ID)); } Integer value = engine.getProvidedVarsManager().getProvidedInteger(intId); if (value == null) { return errorResult(String.format("číslo s id %s není poskytováno", intId)); } else { return okResult(value); } } catch (ContractException e) { return errorResultContractNotMet(e); } catch (Throwable e) { return errorResultUnexpectedError(e); } } EfGetProvidedInteger(String name, Engine engine); @Override ValueEvaluation evaluate();  }