use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class PvmAtomicOperationProcessEnd method eventNotificationsCompleted.
@Override
protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
execution.leaveActivityInstance();
PvmExecutionImpl superExecution = execution.getSuperExecution();
CmmnActivityExecution superCaseExecution = execution.getSuperCaseExecution();
SubProcessActivityBehavior subProcessActivityBehavior = null;
TransferVariablesActivityBehavior transferVariablesBehavior = null;
// copy variables before destroying the ended sub process instance
if (superExecution != null) {
PvmActivity activity = superExecution.getActivity();
subProcessActivityBehavior = (SubProcessActivityBehavior) activity.getActivityBehavior();
try {
subProcessActivityBehavior.passOutputVariables(superExecution, execution);
} catch (RuntimeException e) {
LOG.exceptionWhileCompletingSupProcess(execution, e);
throw e;
} catch (Exception e) {
LOG.exceptionWhileCompletingSupProcess(execution, e);
throw new ProcessEngineException("Error while completing sub process of execution " + execution, e);
}
} else if (superCaseExecution != null) {
CmmnActivity activity = superCaseExecution.getActivity();
transferVariablesBehavior = (TransferVariablesActivityBehavior) activity.getActivityBehavior();
try {
transferVariablesBehavior.transferVariables(execution, superCaseExecution);
} catch (RuntimeException e) {
LOG.exceptionWhileCompletingSupProcess(execution, e);
throw e;
} catch (Exception e) {
LOG.exceptionWhileCompletingSupProcess(execution, e);
throw new ProcessEngineException("Error while completing sub process of execution " + execution, e);
}
}
execution.destroy();
execution.remove();
// and trigger execution afterwards
if (superExecution != null) {
superExecution.setSubProcessInstance(null);
try {
subProcessActivityBehavior.completed(superExecution);
} catch (RuntimeException e) {
LOG.exceptionWhileCompletingSupProcess(execution, e);
throw e;
} catch (Exception e) {
LOG.exceptionWhileCompletingSupProcess(execution, e);
throw new ProcessEngineException("Error while completing sub process of execution " + execution, e);
}
} else if (superCaseExecution != null) {
superCaseExecution.complete();
}
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class CmmnExecution method isSentryPartsSatisfied.
protected boolean isSentryPartsSatisfied(String sentryId, List<? extends CmmnSentryPart> sentryParts) {
// if part will be evaluated in the end
CmmnSentryPart ifPart = null;
if (sentryParts != null && !sentryParts.isEmpty()) {
for (CmmnSentryPart sentryPart : sentryParts) {
if (PLAN_ITEM_ON_PART.equals(sentryPart.getType())) {
if (!sentryPart.isSatisfied()) {
return false;
}
} else if (VARIABLE_ON_PART.equals(sentryPart.getType())) {
if (!sentryPart.isSatisfied()) {
return false;
}
} else {
/* IF_PART.equals(sentryPart.getType) == true */
ifPart = sentryPart;
// once the ifPart has been satisfied the whole sentry is satisfied
if (ifPart.isSatisfied()) {
return true;
}
}
}
}
if (ifPart != null) {
CmmnExecution execution = ifPart.getCaseExecution();
ensureNotNull("Case execution of sentry '" + ifPart.getSentryId() + "': is null", execution);
CmmnActivity activity = ifPart.getCaseExecution().getActivity();
ensureNotNull("Case execution '" + id + "': has no current activity", "activity", activity);
CmmnSentryDeclaration sentryDeclaration = activity.getSentry(sentryId);
ensureNotNull("Case execution '" + id + "': has no declaration for sentry '" + sentryId + "'", "sentryDeclaration", sentryDeclaration);
CmmnIfPartDeclaration ifPartDeclaration = sentryDeclaration.getIfPart();
ensureNotNull("Sentry declaration '" + sentryId + "' has no definied ifPart, but there should be one defined for case execution '" + id + "'.", "ifPartDeclaration", ifPartDeclaration);
Expression condition = ifPartDeclaration.getCondition();
ensureNotNull("A condition was expected for ifPart of Sentry declaration '" + sentryId + "' for case execution '" + id + "'.", "condition", condition);
Object result = condition.getValue(this);
ensureInstanceOf("condition expression returns non-Boolean", "result", result, Boolean.class);
Boolean booleanResult = (Boolean) result;
ifPart.setSatisfied(booleanResult);
return booleanResult;
}
// ifPart then the whole sentry is satisfied.
return true;
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class CmmnExecution method checkAndFireEntryCriteria.
protected void checkAndFireEntryCriteria(List<String> satisfiedSentries) {
if (isAvailable() || isNew()) {
// do that only, when this child case execution
// is available
CmmnActivity activity = getActivity();
ensureNotNull(PvmException.class, "Case execution '" + getId() + "': has no current activity.", "activity", activity);
List<CmmnSentryDeclaration> criteria = activity.getEntryCriteria();
for (CmmnSentryDeclaration sentryDeclaration : criteria) {
if (sentryDeclaration != null && satisfiedSentries.contains(sentryDeclaration.getId())) {
if (isAvailable()) {
fireEntryCriteria();
} else {
entryCriterionSatisfied = true;
}
break;
}
}
}
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class CmmnExecution method createOnPart.
protected CmmnSentryPart createOnPart(CmmnSentryDeclaration sentryDeclaration, CmmnOnPartDeclaration onPartDeclaration) {
CmmnSentryPart sentryPart = createSentryPart(sentryDeclaration, PLAN_ITEM_ON_PART);
// set the standard event
String standardEvent = onPartDeclaration.getStandardEvent();
sentryPart.setStandardEvent(standardEvent);
// set source case execution
CmmnActivity source = onPartDeclaration.getSource();
ensureNotNull("The source of sentry '" + sentryDeclaration.getId() + "' is null.", "source", source);
String sourceActivityId = source.getId();
sentryPart.setSource(sourceActivityId);
return sentryPart;
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class PlanItemDefinitionActivityBehavior method isAtLeastOneEntryCriterionSatisfied.
// sentries //////////////////////////////////////////////////////////////////////////////
protected boolean isAtLeastOneEntryCriterionSatisfied(CmmnActivityExecution execution) {
if (execution.isEntryCriterionSatisfied()) {
return true;
}
CmmnActivity activity = getActivity(execution);
List<CmmnSentryDeclaration> criteria = activity.getEntryCriteria();
return !(criteria != null && !criteria.isEmpty());
}
Aggregations