use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class GetDeploymentDmnModelInstanceCmd method execute.
public DmnModelInstance execute(CommandContext commandContext) {
ensureNotNull("decisionDefinitionId", decisionDefinitionId);
DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
DecisionDefinitionEntity decisionDefinition = deploymentCache.findDeployedDecisionDefinitionById(decisionDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadDecisionDefinition(decisionDefinition);
}
DmnModelInstance modelInstance = deploymentCache.findDmnModelInstanceForDecisionDefinition(decisionDefinitionId);
ensureNotNull(DmnModelInstanceNotFoundException.class, "No DMN model instance found for decision definition id " + decisionDefinitionId, "modelInstance", modelInstance);
return modelInstance;
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class DecisionDefinitionAuthorizationTest method testGetDmnModelInstance.
public void testGetDmnModelInstance() {
// given
String decisionDefinitionId = selectDecisionDefinitionByKey(DECISION_DEFINITION_KEY).getId();
createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ);
// when
DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId);
// then
assertNotNull(modelInstance);
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class DecisionDefinitionDeployerTest method createDmnModelInstanceNegativeHistoryTimeToLive.
protected static DmnModelInstance createDmnModelInstanceNegativeHistoryTimeToLive() {
DmnModelInstance modelInstance = Dmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setId(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
definitions.setName(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
definitions.setNamespace(DmnModelConstants.CAMUNDA_NS);
modelInstance.setDefinitions(definitions);
Decision decision = modelInstance.newInstance(Decision.class);
decision.setId("Decision-1");
decision.setName("foo");
decision.setCamundaHistoryTimeToLive(-5);
modelInstance.getDefinitions().addChildElement(decision);
return modelInstance;
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class DecisionDefinitionDeployerTest method createDmnModelInstance.
protected static DmnModelInstance createDmnModelInstance() {
DmnModelInstance modelInstance = Dmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setId(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
definitions.setName(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
definitions.setNamespace(DmnModelConstants.CAMUNDA_NS);
modelInstance.setDefinitions(definitions);
Decision decision = modelInstance.newInstance(Decision.class);
decision.setId("Decision-1");
decision.setName("foo");
decision.setCamundaHistoryTimeToLive(5);
modelInstance.getDefinitions().addChildElement(decision);
DecisionTable decisionTable = modelInstance.newInstance(DecisionTable.class);
decisionTable.setId(DmnModelConstants.DMN_ELEMENT_DECISION_TABLE);
decisionTable.setHitPolicy(HitPolicy.FIRST);
decision.addChildElement(decisionTable);
Input input = modelInstance.newInstance(Input.class);
input.setId("Input-1");
input.setLabel("Input");
decisionTable.addChildElement(input);
InputExpression inputExpression = modelInstance.newInstance(InputExpression.class);
inputExpression.setId("InputExpression-1");
Text inputExpressionText = modelInstance.newInstance(Text.class);
inputExpressionText.setTextContent("input");
inputExpression.setText(inputExpressionText);
inputExpression.setTypeRef("string");
input.setInputExpression(inputExpression);
Output output = modelInstance.newInstance(Output.class);
output.setName("output");
output.setLabel("Output");
output.setTypeRef("string");
decisionTable.addChildElement(output);
return modelInstance;
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class DecisionDefinitionDeployerTest method testDeployDmnModelInstanceNegativeHistoryTimeToLive.
@Test
public void testDeployDmnModelInstanceNegativeHistoryTimeToLive() throws Exception {
// given
DmnModelInstance dmnModelInstance = createDmnModelInstanceNegativeHistoryTimeToLive();
try {
testRule.deploy(repositoryService.createDeployment().addModelInstance("foo.dmn", dmnModelInstance));
fail("Exception for negative time to live value is expected.");
} catch (ProcessEngineException ex) {
assertTrue(ex.getCause().getMessage().contains("negative value is not allowed"));
}
}
Aggregations