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.CaseExport.java
public static void writeCase(Case caseModel, XMLStreamWriter xtw) throws Exception { // start process element xtw.writeStartElement(ELEMENT_CASE); xtw.writeAttribute(ATTRIBUTE_ID, caseModel.getId()); if (StringUtils.isNotEmpty(caseModel.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, caseModel.getName()); }//from w ww .j a v a 2 s .c om if (StringUtils.isNotEmpty(caseModel.getInitiatorVariableName())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_INITIATOR_VARIABLE_NAME, caseModel.getInitiatorVariableName()); } if (StringUtils.isNotEmpty(caseModel.getDocumentation())) { xtw.writeStartElement(ELEMENT_DOCUMENTATION); xtw.writeCharacters(caseModel.getDocumentation()); xtw.writeEndElement(); } }
From source file:org.flowable.cmmn.converter.export.CaseTaskExport.java
public static void writeCaseTask(CaseTask caseTask, XMLStreamWriter xtw) throws Exception { // start case task element xtw.writeStartElement(ELEMENT_CASE_TASK); writeCommonTaskAttributes(xtw, caseTask); if (StringUtils.isNotEmpty(caseTask.getCaseRef())) { xtw.writeAttribute(ATTRIBUTE_CASE_REF, caseTask.getCaseRef()); }/*from w ww . j av a 2s . c o m*/ // end case task element xtw.writeEndElement(); }
From source file:org.flowable.cmmn.converter.export.CriteriaExport.java
public static void writeCriteriaElements(PlanItem planItem, XMLStreamWriter xtw) throws Exception { for (Criterion criterion : planItem.getEntryCriteria()) { // start entry criterion element xtw.writeStartElement(ELEMENT_ENTRY_CRITERION); xtw.writeAttribute(ATTRIBUTE_ID, criterion.getId()); if (StringUtils.isNotEmpty(criterion.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, criterion.getName()); }// w w w .j a va2 s . co m if (StringUtils.isNotEmpty(criterion.getSentryRef())) { xtw.writeAttribute(ATTRIBUTE_SENTRY_REF, criterion.getSentryRef()); } // end entry criterion element xtw.writeEndElement(); } for (Criterion criterion : planItem.getExitCriteria()) { // start entry criterion element xtw.writeStartElement(ELEMENT_EXIT_CRITERION); xtw.writeAttribute(ATTRIBUTE_ID, criterion.getId()); if (StringUtils.isNotEmpty(criterion.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, criterion.getName()); } if (StringUtils.isNotEmpty(criterion.getSentryRef())) { xtw.writeAttribute(ATTRIBUTE_SENTRY_REF, criterion.getSentryRef()); } // end entry criterion element xtw.writeEndElement(); } }
From source file:org.flowable.cmmn.converter.export.DecisionTaskExport.java
public static void writeDecisionTask(DecisionTask decisionTask, XMLStreamWriter xtw) throws Exception { // start decision task element xtw.writeStartElement(ELEMENT_DECISION_TASK); writeCommonTaskAttributes(xtw, decisionTask); writeExtensions(decisionTask, xtw);/*from w w w . j a v a 2s .com*/ if (StringUtils.isNotEmpty(decisionTask.getDecisionRef()) || StringUtils.isNotEmpty(decisionTask.getDecisionRefExpression())) { xtw.writeStartElement(ELEMENT_DECISION_REF_EXPRESSION); xtw.writeCData(StringUtils.isNotEmpty(decisionTask.getDecisionRef()) ? decisionTask.getDecisionRef() : decisionTask.getDecisionRefExpression()); xtw.writeEndElement(); } // end decision task element xtw.writeEndElement(); }
From source file:org.flowable.cmmn.converter.export.DefinitionsRootExport.java
public static void writeRootElement(CmmnModel model, XMLStreamWriter xtw, String encoding) throws Exception { xtw.writeStartDocument(encoding, "1.0"); // start definitions root element xtw.writeStartElement(ELEMENT_DEFINITIONS); xtw.setDefaultNamespace(CMMN_NAMESPACE); xtw.writeDefaultNamespace(CMMN_NAMESPACE); xtw.writeNamespace(XSI_PREFIX, XSI_NAMESPACE); xtw.writeNamespace(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE); xtw.writeNamespace(CMMNDI_PREFIX, CMMNDI_NAMESPACE); xtw.writeNamespace(OMGDC_PREFIX, OMGDC_NAMESPACE); xtw.writeNamespace(OMGDI_PREFIX, OMGDI_NAMESPACE); for (String prefix : model.getNamespaces().keySet()) { if (!defaultNamespaces.contains(prefix) && StringUtils.isNotEmpty(prefix)) xtw.writeNamespace(prefix, model.getNamespaces().get(prefix)); }//from w w w. j a v a 2 s. c o m if (StringUtils.isNotEmpty(model.getTargetNamespace())) { xtw.writeAttribute(ATTRIBUTE_TARGET_NAMESPACE, model.getTargetNamespace()); } else { xtw.writeAttribute(ATTRIBUTE_TARGET_NAMESPACE, CASE_NAMESPACE); } }
From source file:org.flowable.cmmn.converter.export.FieldExport.java
public static boolean writeFieldExtensions(List<FieldExtension> fieldExtensions, boolean didWriteExtensionElement, XMLStreamWriter xtw) throws XMLStreamException { if (fieldExtensions.size() > 0) { if (!didWriteExtensionElement) { xtw.writeStartElement(CmmnXmlConstants.ELEMENT_EXTENSION_ELEMENTS); didWriteExtensionElement = true; }/*from w w w .j a v a2s . c o m*/ for (FieldExtension fieldExtension : fieldExtensions) { xtw.writeStartElement(CmmnXmlConstants.FLOWABLE_EXTENSIONS_PREFIX, CmmnXmlConstants.ELEMENT_FIELD, CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE); xtw.writeAttribute(CmmnXmlConstants.ATTRIBUTE_NAME, fieldExtension.getFieldName()); if (StringUtils.isNotEmpty(fieldExtension.getStringValue())) { xtw.writeStartElement(CmmnXmlConstants.FLOWABLE_EXTENSIONS_PREFIX, CmmnXmlConstants.ELEMENT_FIELD_STRING, CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE); xtw.writeCData(fieldExtension.getStringValue()); } else { xtw.writeStartElement(CmmnXmlConstants.FLOWABLE_EXTENSIONS_PREFIX, CmmnXmlConstants.ATTRIBUTE_FIELD_EXPRESSION, CmmnXmlConstants.FLOWABLE_EXTENSIONS_NAMESPACE); xtw.writeCData(fieldExtension.getExpression()); } xtw.writeEndElement(); xtw.writeEndElement(); } } return didWriteExtensionElement; }
From source file:org.flowable.cmmn.converter.export.HumanTaskExport.java
public static void writeHumanTask(HumanTask humanTask, XMLStreamWriter xtw) throws Exception { // start human task element xtw.writeStartElement(ELEMENT_HUMAN_TASK); writeCommonTaskAttributes(xtw, humanTask); if (StringUtils.isNotEmpty(humanTask.getAssignee())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_ASSIGNEE, humanTask.getAssignee()); }/*from w w w . j a v a 2 s. c o m*/ if (StringUtils.isNotEmpty(humanTask.getOwner())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_OWNER, humanTask.getOwner()); } if (humanTask.getCandidateUsers() != null && humanTask.getCandidateUsers().size() > 0) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_CANDIDATE_USERS, convertListToCommaSeparatedString(humanTask.getCandidateUsers())); } if (humanTask.getCandidateGroups() != null && humanTask.getCandidateGroups().size() > 0) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_CANDIDATE_GROUPS, convertListToCommaSeparatedString(humanTask.getCandidateGroups())); } if (StringUtils.isNotEmpty(humanTask.getFormKey())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_FORM_KEY, humanTask.getFormKey()); } // end human task element xtw.writeEndElement(); }
From source file:org.flowable.cmmn.converter.export.PlanItemControlExport.java
public static void writeItemControl(PlanItemControl planItemControl, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_ITEM_CONTROL); writeItemControlContent(planItemControl, xtw); xtw.writeEndElement();// www.j ava2 s . co m }
From source file:org.flowable.cmmn.converter.export.PlanItemControlExport.java
public static void writeDefaultControl(PlanItemControl planItemControl, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_DEFAULT_CONTROL); writeItemControlContent(planItemControl, xtw); xtw.writeEndElement();/*from www. j a v a 2s . c om*/ }
From source file:org.flowable.cmmn.converter.export.PlanItemControlExport.java
public static void writeRequiredRule(RequiredRule requiredRule, XMLStreamWriter xtw) throws XMLStreamException { if (requiredRule != null) { xtw.writeStartElement(ELEMENT_REQUIRED_RULE); if (StringUtils.isNotEmpty(requiredRule.getCondition())) { xtw.writeStartElement(ELEMENT_CONDITION); xtw.writeCData(requiredRule.getCondition()); xtw.writeEndElement();//from w w w . j a va2 s. c o m } xtw.writeEndElement(); } }