@Override protected DmnDecisionRequirementsGraphImpl createDmnElement() { return new DecisionRequirementsDefinitionEntity(); }
protected void resetPreviousDecisionRequirementsDefinitionId() { previousDecisionRequirementsDefinitionId = null; ensurePreviousDecisionRequirementsDefinitionIdInitialized(); }
public static boolean isDecisionRequirementsDefinitionPersistable(DecisionRequirementsDefinitionEntity definition) { // persist no decision requirements definition for a single decision return definition.getDecisions().size() > 1; }
@Override public ResourceDefinitionEntity getPreviousDefinition() { DecisionRequirementsDefinitionEntity previousDecisionDefinition = null; String previousDecisionDefinitionId = getPreviousDecisionRequirementsDefinitionId(); if (previousDecisionDefinitionId != null) { previousDecisionDefinition = loadDecisionRequirementsDefinition(previousDecisionDefinitionId); if (previousDecisionDefinition == null) { resetPreviousDecisionRequirementsDefinitionId(); previousDecisionDefinitionId = getPreviousDecisionRequirementsDefinitionId(); if (previousDecisionDefinitionId != null) { previousDecisionDefinition = loadDecisionRequirementsDefinition(previousDecisionDefinitionId); } } } return previousDecisionDefinition; }
@Override protected List<DecisionDefinitionEntity> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties) { List<DecisionDefinitionEntity> decisions = new ArrayList<DecisionDefinitionEntity>(); // get the decisions from the deployed drd instead of parse the DMN again DecisionRequirementsDefinitionEntity deployedDrd = findDeployedDrdForResource(deployment, resource.getName()); if (deployedDrd == null) { throw LOG.exceptionNoDrdForResource(resource.getName()); } Collection<DmnDecision> decisionsOfDrd = deployedDrd.getDecisions(); for (DmnDecision decisionOfDrd : decisionsOfDrd) { DecisionDefinitionEntity decisionEntity = (DecisionDefinitionEntity) decisionOfDrd; if (DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) { decisionEntity.setDecisionRequirementsDefinitionId(deployedDrd.getId()); decisionEntity.setDecisionRequirementsDefinitionKey(deployedDrd.getKey()); } decisions.add(decisionEntity); } if (!DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) { deployment.removeArtifact(deployedDrd); } return decisions; }
public void checkReadDecisionRequirementsDefinition(DecisionRequirementsDefinitionEntity decisionRequirementsDefinition) { if (decisionRequirementsDefinition != null && !getTenantManager().isAuthenticatedTenant(decisionRequirementsDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("get the decision requirements definition '"+ decisionRequirementsDefinition.getId() + "'"); } }
protected DecisionRequirementsDefinitionEntity findDeployedDrdForResource(DeploymentEntity deployment, String resourceName) { List<DecisionRequirementsDefinitionEntity> deployedDrds = deployment.getDeployedArtifacts(DecisionRequirementsDefinitionEntity.class); if (deployedDrds != null) { for (DecisionRequirementsDefinitionEntity deployedDrd : deployedDrds) { if (deployedDrd.getResourceName().equals(resourceName)) { return deployedDrd; } } } return null; }
public void checkReadDecisionRequirementsDefinition(DecisionRequirementsDefinitionEntity decisionRequirementsDefinition) { getAuthorizationManager().checkAuthorization(READ, DECISION_REQUIREMENTS_DEFINITION, decisionRequirementsDefinition.getKey()); }
@Override public ResourceDefinitionEntity getPreviousDefinition() { DecisionRequirementsDefinitionEntity previousDecisionDefinition = null; String previousDecisionDefinitionId = getPreviousDecisionRequirementsDefinitionId(); if (previousDecisionDefinitionId != null) { previousDecisionDefinition = loadDecisionRequirementsDefinition(previousDecisionDefinitionId); if (previousDecisionDefinition == null) { resetPreviousDecisionRequirementsDefinitionId(); previousDecisionDefinitionId = getPreviousDecisionRequirementsDefinitionId(); if (previousDecisionDefinitionId != null) { previousDecisionDefinition = loadDecisionRequirementsDefinition(previousDecisionDefinitionId); } } } return previousDecisionDefinition; }
@Override protected List<DecisionDefinitionEntity> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties) { List<DecisionDefinitionEntity> decisions = new ArrayList<DecisionDefinitionEntity>(); // get the decisions from the deployed drd instead of parse the DMN again DecisionRequirementsDefinitionEntity deployedDrd = findDeployedDrdForResource(deployment, resource.getName()); if (deployedDrd == null) { throw LOG.exceptionNoDrdForResource(resource.getName()); } Collection<DmnDecision> decisionsOfDrd = deployedDrd.getDecisions(); for (DmnDecision decisionOfDrd : decisionsOfDrd) { DecisionDefinitionEntity decisionEntity = (DecisionDefinitionEntity) decisionOfDrd; if (DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) { decisionEntity.setDecisionRequirementsDefinitionId(deployedDrd.getId()); decisionEntity.setDecisionRequirementsDefinitionKey(deployedDrd.getKey()); } decisions.add(decisionEntity); } if (!DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) { deployment.removeArtifact(deployedDrd); } return decisions; }
public void checkReadDecisionRequirementsDefinition(DecisionRequirementsDefinitionEntity decisionRequirementsDefinition) { if (decisionRequirementsDefinition != null && !getTenantManager().isAuthenticatedTenant(decisionRequirementsDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("get the decision requirements definition '"+ decisionRequirementsDefinition.getId() + "'"); } }
protected DecisionRequirementsDefinitionEntity findDeployedDrdForResource(DeploymentEntity deployment, String resourceName) { List<DecisionRequirementsDefinitionEntity> deployedDrds = deployment.getDeployedArtifacts(DecisionRequirementsDefinitionEntity.class); if (deployedDrds != null) { for (DecisionRequirementsDefinitionEntity deployedDrd : deployedDrds) { if (deployedDrd.getResourceName().equals(resourceName)) { return deployedDrd; } } } return null; }
public void checkReadDecisionRequirementsDefinition(DecisionRequirementsDefinitionEntity decisionRequirementsDefinition) { getAuthorizationManager().checkAuthorization(READ, DECISION_REQUIREMENTS_DEFINITION, decisionRequirementsDefinition.getKey()); }
@Override public ResourceDefinitionEntity getPreviousDefinition() { DecisionRequirementsDefinitionEntity previousDecisionDefinition = null; String previousDecisionDefinitionId = getPreviousDecisionRequirementsDefinitionId(); if (previousDecisionDefinitionId != null) { previousDecisionDefinition = loadDecisionRequirementsDefinition(previousDecisionDefinitionId); if (previousDecisionDefinition == null) { resetPreviousDecisionRequirementsDefinitionId(); previousDecisionDefinitionId = getPreviousDecisionRequirementsDefinitionId(); if (previousDecisionDefinitionId != null) { previousDecisionDefinition = loadDecisionRequirementsDefinition(previousDecisionDefinitionId); } } } return previousDecisionDefinition; }
@Override protected List<DecisionDefinitionEntity> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties) { List<DecisionDefinitionEntity> decisions = new ArrayList<DecisionDefinitionEntity>(); // get the decisions from the deployed drd instead of parse the DMN again DecisionRequirementsDefinitionEntity deployedDrd = findDeployedDrdForResource(deployment, resource.getName()); if (deployedDrd == null) { throw LOG.exceptionNoDrdForResource(resource.getName()); } Collection<DmnDecision> decisionsOfDrd = deployedDrd.getDecisions(); for (DmnDecision decisionOfDrd : decisionsOfDrd) { DecisionDefinitionEntity decisionEntity = (DecisionDefinitionEntity) decisionOfDrd; if (DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) { decisionEntity.setDecisionRequirementsDefinitionId(deployedDrd.getId()); decisionEntity.setDecisionRequirementsDefinitionKey(deployedDrd.getKey()); } decisions.add(decisionEntity); } if (!DecisionRequirementsDefinitionDeployer.isDecisionRequirementsDefinitionPersistable(deployedDrd)) { deployment.removeArtifact(deployedDrd); } return decisions; }
public void checkReadDecisionRequirementsDefinition(DecisionRequirementsDefinitionEntity decisionRequirementsDefinition) { if (decisionRequirementsDefinition != null && !getTenantManager().isAuthenticatedTenant(decisionRequirementsDefinition.getTenantId())) { throw LOG.exceptionCommandWithUnauthorizedTenant("get the decision requirements definition '"+ decisionRequirementsDefinition.getId() + "'"); } }
public String getPreviousDecisionRequirementsDefinitionId() { ensurePreviousDecisionRequirementsDefinitionIdInitialized(); return previousDecisionRequirementsDefinitionId; }
protected DecisionRequirementsDefinitionEntity findDeployedDrdForResource(DeploymentEntity deployment, String resourceName) { List<DecisionRequirementsDefinitionEntity> deployedDrds = deployment.getDeployedArtifacts(DecisionRequirementsDefinitionEntity.class); if (deployedDrds != null) { for (DecisionRequirementsDefinitionEntity deployedDrd : deployedDrds) { if (deployedDrd.getResourceName().equals(resourceName)) { return deployedDrd; } } } return null; }
@Override protected DmnDecisionRequirementsGraphImpl createDmnElement() { return new DecisionRequirementsDefinitionEntity(); }
public static boolean isDecisionRequirementsDefinitionPersistable(DecisionRequirementsDefinitionEntity definition) { // persist no decision requirements definition for a single decision return definition.getDecisions().size() > 1; }