List of usage examples for javax.xml.stream XMLStreamWriter writeStartElement
public void writeStartElement(String localName) throws XMLStreamException;
From source file:org.flowable.cmmn.converter.export.PlanItemControlExport.java
public static void writeRepetitionRule(RepetitionRule repetitionRule, XMLStreamWriter xtw) throws XMLStreamException { if (repetitionRule != null) { xtw.writeStartElement(ELEMENT_REPETITION_RULE); if (StringUtils.isNotEmpty(repetitionRule.getRepetitionCounterVariableName())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_REPETITION_COUNTER_VARIABLE_NAME, repetitionRule.getRepetitionCounterVariableName()); }/*from w ww .j a v a 2 s.co m*/ if (StringUtils.isNotEmpty(repetitionRule.getCondition())) { xtw.writeStartElement(ELEMENT_CONDITION); xtw.writeCData(repetitionRule.getCondition()); xtw.writeEndElement(); } xtw.writeEndElement(); } }
From source file:org.flowable.cmmn.converter.export.PlanItemControlExport.java
public static void writeManualActivationRule(ManualActivationRule manualActivationRule, XMLStreamWriter xtw) throws XMLStreamException { if (manualActivationRule != null) { xtw.writeStartElement(ELEMENT_MANUAL_ACTIVATION_RULE); if (StringUtils.isNotEmpty(manualActivationRule.getCondition())) { xtw.writeStartElement(ELEMENT_CONDITION); xtw.writeCData(manualActivationRule.getCondition()); xtw.writeEndElement();//w w w . ja v a 2 s . c o m } xtw.writeEndElement(); } }
From source file:org.flowable.cmmn.converter.export.PlanItemControlExport.java
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();/*from ww w. ja v a2 s . c om*/ } xtw.writeEndElement(); xtw.writeEndElement(); } }
From source file:org.flowable.cmmn.converter.export.PlanItemExport.java
public static void writePlanItem(PlanItem planItem, XMLStreamWriter xtw) throws Exception { // start plan item element xtw.writeStartElement(ELEMENT_PLAN_ITEM); xtw.writeAttribute(ATTRIBUTE_ID, planItem.getId()); if (StringUtils.isNotEmpty(planItem.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, planItem.getName()); }/*w ww . ja v a 2s .c o m*/ if (StringUtils.isNotEmpty(planItem.getDefinitionRef())) { xtw.writeAttribute(ATTRIBUTE_DEFINITION_REF, planItem.getDefinitionRef()); } if (StringUtils.isNotEmpty(planItem.getDocumentation())) { xtw.writeStartElement(ELEMENT_DOCUMENTATION); xtw.writeCharacters(planItem.getDocumentation()); xtw.writeEndElement(); } if (planItem.getItemControl() != null) { xtw.writeStartElement(ELEMENT_ITEM_CONTROL); RepetitionRule repetitionRule = planItem.getItemControl().getRepetitionRule(); if (repetitionRule != null) { xtw.writeStartElement(ELEMENT_REPETITION_RULE); if (StringUtils.isNotEmpty(repetitionRule.getRepetitionCounterVariableName())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_REPETITION_COUNTER_VARIABLE_NAME, repetitionRule.getRepetitionCounterVariableName()); } if (StringUtils.isNotEmpty(repetitionRule.getCondition())) { xtw.writeStartElement(ELEMENT_CONDITION); xtw.writeCData(repetitionRule.getCondition()); xtw.writeEndElement(); } xtw.writeEndElement(); } xtw.writeEndElement(); } CriteriaExport.writeCriteriaElements(planItem, xtw); // end plan item element xtw.writeEndElement(); }
From source file:org.flowable.cmmn.converter.export.ProcessTaskExport.java
public static void writeProcessTask(ProcessTask processTask, XMLStreamWriter xtw) throws Exception { // start process task element xtw.writeStartElement(ELEMENT_PROCESS_TASK); writeCommonTaskAttributes(xtw, processTask); if (StringUtils.isNotEmpty(processTask.getProcessRef()) || StringUtils.isNotEmpty(processTask.getProcessRefExpression())) { xtw.writeStartElement(ELEMENT_PROCESS_REF_EXPRESSION); xtw.writeCData(StringUtils.isNotEmpty(processTask.getProcessRef()) ? processTask.getProcessRef() : processTask.getProcessRefExpression()); xtw.writeEndElement();//ww w . java 2s . co m } // end process task element xtw.writeEndElement(); }
From source file:org.flowable.cmmn.converter.export.SentryExport.java
public static void writeSentry(Sentry sentry, XMLStreamWriter xtw) throws Exception { // start sentry element xtw.writeStartElement(ELEMENT_SENTRY); xtw.writeAttribute(ATTRIBUTE_ID, sentry.getId()); if (StringUtils.isNotEmpty(sentry.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, sentry.getName()); }/*from w w w . ja va 2 s .c om*/ for (SentryOnPart sentryOnPart : sentry.getOnParts()) { // start sentry on part element xtw.writeStartElement(ELEMENT_PLAN_ITEM_ON_PART); xtw.writeAttribute(ATTRIBUTE_ID, sentryOnPart.getId()); xtw.writeAttribute(ATTRIBUTE_SOURCE_REF, sentryOnPart.getSourceRef()); // start standard event element xtw.writeStartElement(ELEMENT_STANDARD_EVENT); xtw.writeCharacters(sentryOnPart.getStandardEvent()); xtw.writeEndElement(); // end sentry on part element xtw.writeEndElement(); } // If part if (sentry.getSentryIfPart() != null) { xtw.writeStartElement(ELEMENT_IF_PART); xtw.writeStartElement(ELEMENT_CONDITION); xtw.writeCData(sentry.getSentryIfPart().getCondition()); xtw.writeEndElement(); xtw.writeEndElement(); } // end plan item element xtw.writeEndElement(); }
From source file:org.flowable.cmmn.converter.export.ServiceTaskExport.java
public static void writeTask(ServiceTask task, XMLStreamWriter xtw) throws Exception { // start task element xtw.writeStartElement(ELEMENT_TASK); writeCommonTaskAttributes(xtw, task); if (StringUtils.isNotEmpty(task.getType())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_TYPE, task.getType());//from w w w . j a v a 2s . c o m if (ServiceTask.JAVA_TASK.equals(task.getType())) { if (StringUtils.isNotEmpty(task.getImplementation())) { if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(task.getImplementationType())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_CLASS, task.getImplementation()); } else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION .equals(task.getImplementationType())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_EXPRESSION, task.getImplementation()); } else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION .equals(task.getImplementationType())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_DELEGATE_EXPRESSION, task.getImplementation()); } } if (StringUtils.isNotEmpty(task.getResultVariableName())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_RESULT_VARIABLE_NAME, task.getResultVariableName()); } } } if (HttpServiceTask.HTTP_TASK.equals(task.getType())) { if (StringUtils.isNotEmpty(task.getImplementation())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_CLASS, task.getImplementation()); } } writeExtensions(task, xtw); // end task element xtw.writeEndElement(); }
From source file:org.flowable.cmmn.converter.export.ServiceTaskExport.java
public static void writeExtensions(TaskWithFieldExtensions task, XMLStreamWriter xtw) throws XMLStreamException { if (task.getFieldExtensions().size() > 0) { xtw.writeStartElement(ELEMENT_EXTENSIONS); for (FieldExtension fieldExtension : task.getFieldExtensions()) { xtw.writeStartElement(FLOWABLE_EXTENSIONS_PREFIX, ELEMENT_FIELD, FLOWABLE_EXTENSIONS_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_NAME, fieldExtension.getFieldName()); if (StringUtils.isNotEmpty(fieldExtension.getStringValue())) { xtw.writeStartElement(FLOWABLE_EXTENSIONS_PREFIX, ELEMENT_FIELD_STRING, FLOWABLE_EXTENSIONS_NAMESPACE); xtw.writeCData(fieldExtension.getStringValue()); } else { xtw.writeStartElement(FLOWABLE_EXTENSIONS_PREFIX, ATTRIBUTE_FIELD_EXPRESSION, FLOWABLE_EXTENSIONS_NAMESPACE); xtw.writeCData(fieldExtension.getExpression()); }/*from w w w. ja v a 2s .c o m*/ xtw.writeEndElement(); xtw.writeEndElement(); } xtw.writeEndElement(); } }
From source file:org.flowable.cmmn.converter.export.StageExport.java
public static void writeStage(Stage stage, XMLStreamWriter xtw) throws Exception { // start plan model or stage element if (stage.isPlanModel()) { xtw.writeStartElement(ELEMENT_PLAN_MODEL); } else {/*from ww w .ja va 2s . co m*/ xtw.writeStartElement(ELEMENT_STAGE); } xtw.writeAttribute(ATTRIBUTE_ID, stage.getId()); if (StringUtils.isNotEmpty(stage.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, stage.getName()); } if (StringUtils.isNotEmpty(stage.getDocumentation())) { xtw.writeStartElement(ELEMENT_DOCUMENTATION); xtw.writeCharacters(stage.getDocumentation()); xtw.writeEndElement(); } for (PlanItem planItem : stage.getPlanItems()) { PlanItemExport.writePlanItem(planItem, xtw); } for (Sentry sentry : stage.getSentries()) { SentryExport.writeSentry(sentry, xtw); } for (PlanItemDefinition planItemDefinition : stage.getPlanItemDefinitions()) { PlanItemDefinitionExport.writePlanItemDefinition(planItemDefinition, xtw); } if (stage.isPlanModel() && stage.getExitCriteria() != null && !stage.getExitCriteria().isEmpty()) { for (Criterion exitCriterion : stage.getExitCriteria()) { xtw.writeStartElement(ELEMENT_EXIT_CRITERION); xtw.writeAttribute(ATTRIBUTE_ID, exitCriterion.getId()); if (StringUtils.isNotEmpty(exitCriterion.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, exitCriterion.getName()); } if (StringUtils.isNotEmpty(exitCriterion.getSentryRef())) { xtw.writeAttribute(ATTRIBUTE_SENTRY_REF, exitCriterion.getSentryRef()); } // end entry criterion element xtw.writeEndElement(); } } // end plan model or stage element xtw.writeEndElement(); }
From source file:org.flowable.cmmn.converter.export.TimerEventListenerExport.java
public static void writeTimerEventListener(TimerEventListener timerEventListener, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_TIMER_EVENT_LISTENER); writeCommonPlanItemDefinitionAttributes(timerEventListener, xtw); if (StringUtils.isNotEmpty(timerEventListener.getTimerExpression())) { xtw.writeStartElement(ELEMENT_TIMER_EXPRESSION); xtw.writeCData(timerEventListener.getTimerExpression()); xtw.writeEndElement();// ww w .j av a 2 s .c om } if (StringUtils.isNotEmpty(timerEventListener.getTimerStartTriggerSourceRef())) { xtw.writeStartElement(ELEMENT_PLAN_ITEM_START_TRIGGER); xtw.writeAttribute(ATTRIBUTE_PLAN_ITEM_START_TRIGGER_SRC_REF, timerEventListener.getTimerStartTriggerSourceRef()); xtw.writeStartElement(ELEMENT_STANDARD_EVENT); xtw.writeCData(timerEventListener.getTimerStartTriggerStandardEvent()); xtw.writeEndElement(); xtw.writeEndElement(); } xtw.writeEndElement(); }