@Override protected void writePlanItemDefinitionSpecificAttributes(Stage stage, XMLStreamWriter xtw) throws Exception { super.writePlanItemDefinitionSpecificAttributes(stage, xtw); if (StringUtils.isNotEmpty(stage.getFormKey())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_FORM_KEY, stage.getFormKey()); } if (stage.isAutoComplete()) { xtw.writeAttribute(ATTRIBUTE_IS_AUTO_COMPLETE, Boolean.toString(stage.isAutoComplete())); } if (StringUtils.isNotEmpty(stage.getAutoCompleteCondition())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_AUTO_COMPLETE_CONDITION, stage.getAutoCompleteCondition()); } if (stage.getDisplayOrder() != null) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_DISPLAY_ORDER, String.valueOf(stage.getDisplayOrder())); } if (!stage.isIncludeInStageOverview()) { // if it's missing, it's true by default xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_INCLUDE_IN_STAGE_OVERVIEW, "false"); } }
protected boolean isStageCompletable(PlanItemInstanceEntity stagePlanItemInstanceEntity, Stage stage) { boolean allRequiredChildrenInEndState = isEndStateReachedForAllRequiredChildPlanItems(stagePlanItemInstanceEntity); if (allRequiredChildrenInEndState) { stagePlanItemInstanceEntity.setCompleteable(true); } if (stagePlanItemInstanceEntity.isCompleteable()) { if (stage.isAutoComplete()) { return true; } else { return isAvailableChildPlanCompletionNeutralOrNotActive(stagePlanItemInstanceEntity); } } else { return false; } }
protected boolean isPlanModelComplete() { boolean allRequiredChildrenInEndState = isEndStateReachedForAllRequiredChildPlanItems(caseInstanceEntity); if (allRequiredChildrenInEndState) { caseInstanceEntity.setCompleteable(true); } boolean isAutoComplete = CaseDefinitionUtil.getCase(caseInstanceEntity.getCaseDefinitionId()).getPlanModel().isAutoComplete(); if (caseInstanceEntity.isCompleteable()) { if (isAutoComplete) { return true; } else { return isAvailableChildPlanCompletionNeutralOrNotActive(caseInstanceEntity); } } else { return false; } }