public static void writeCompletionNeutralRule(CompletionNeutralRule completionNeutralRule, XMLStreamWriter xtw) throws XMLStreamException { if (completionNeutralRule != null) { xtw.writeStartElement(ELEMENT_EXTENSION_ELEMENTS); xtw.writeStartElement(FLOWABLE_EXTENSIONS_PREFIX, ELEMENT_COMPLETION_NEUTRAL_RULE, FLOWABLE_EXTENSIONS_NAMESPACE); if (StringUtils.isNotBlank(completionNeutralRule.getCondition())) { xtw.writeStartElement(ELEMENT_CONDITION); xtw.writeCData(completionNeutralRule.getCondition()); xtw.writeEndElement(); } xtw.writeEndElement(); xtw.writeEndElement(); } } }
protected void readCompletionNeutralRule(XMLStreamReader xtr, ConversionHelper conversionHelper) { if (conversionHelper.getCurrentCmmnElement() instanceof PlanItemControl) { CompletionNeutralRule completionNeutralRule = new CompletionNeutralRule(); completionNeutralRule.setName(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_NAME)); xtr.next(); if (xtr.isCharacters()) { completionNeutralRule.setCondition(xtr.getText());
protected boolean isCompletionNeutralPlanItemInstance(PlanItemInstanceEntity planItemInstanceEntity) { PlanItemControl planItemControl = planItemInstanceEntity.getPlanItem().getItemControl(); if (planItemControl != null && planItemControl.getCompletionNeutralRule() != null) { boolean isCompletionNeutral = true; // Having a required rule means required by default, unless the condition says otherwise String condition = planItemControl.getCompletionNeutralRule().getCondition(); if (StringUtils.isNotEmpty(condition)) { isCompletionNeutral = evaluateBooleanExpression(commandContext, planItemInstanceEntity, condition); } return isCompletionNeutral; } return false; }