List of usage examples for javax.xml.stream XMLStreamWriter writeEndElement
public void writeEndElement() throws XMLStreamException;
From source file:org.activiti.designer.export.bpmn20.export.FormPropertiesExport.java
public static void createFormPropertiesXML(List<FormProperty> propertyList, XMLStreamWriter xtw) throws Exception { for (FormProperty formProperty : propertyList) { xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "formProperty", ACTIVITI_EXTENSIONS_NAMESPACE); xtw.writeAttribute("id", formProperty.getId()); if (StringUtils.isNotEmpty(formProperty.getName())) { xtw.writeAttribute("name", formProperty.getName()); }//from ww w. j a v a2 s.co m if (StringUtils.isNotEmpty(formProperty.getType())) { xtw.writeAttribute("type", formProperty.getType()); } if (StringUtils.isNotEmpty(formProperty.getValue())) { xtw.writeAttribute("value", formProperty.getValue()); } if (StringUtils.isNotEmpty(formProperty.getExpression())) { xtw.writeAttribute("expression", formProperty.getExpression()); } if (StringUtils.isNotEmpty(formProperty.getVariable())) { xtw.writeAttribute("variable", formProperty.getVariable()); } if (StringUtils.isNotEmpty(formProperty.getDefaultExpression())) { xtw.writeAttribute("default", formProperty.getDefaultExpression()); } if (StringUtils.isNotEmpty(formProperty.getDatePattern())) { xtw.writeAttribute("datePattern", formProperty.getDatePattern()); } if (formProperty.getRequired() != null) { xtw.writeAttribute("required", formProperty.getRequired().toString().toLowerCase()); } if (formProperty.getReadable() != null) { xtw.writeAttribute("readable", formProperty.getReadable().toString().toLowerCase()); } if (formProperty.getWriteable() != null) { xtw.writeAttribute("writable", formProperty.getWriteable().toString().toLowerCase()); } if (formProperty.getFormValues().size() > 0) { for (FormValue formValue : formProperty.getFormValues()) { xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "value", ACTIVITI_EXTENSIONS_NAMESPACE); xtw.writeAttribute("id", formValue.getId()); xtw.writeAttribute("name", formValue.getName()); xtw.writeEndElement(); } } xtw.writeEndElement(); } }
From source file:org.activiti.designer.export.bpmn20.export.IntermediateCatchEventExport.java
public static void createIntermediateEvent(Object object, XMLStreamWriter xtw) throws Exception { IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) object; List<EventDefinition> eventDefinitionList = catchEvent.getEventDefinitions(); if (eventDefinitionList.size() == 1) { if (eventDefinitionList.get(0) instanceof TimerEventDefinition) { TimerEventDefinition timerDef = (TimerEventDefinition) eventDefinitionList.get(0); // start TimerIntermediateCatchEvent element xtw.writeStartElement("intermediateCatchEvent"); xtw.writeAttribute("id", catchEvent.getId()); if (catchEvent.getName() != null) { xtw.writeAttribute("name", catchEvent.getName()); }/*from w w w. j a va2 s. c om*/ xtw.writeStartElement("timerEventDefinition"); if (StringUtils.isNotEmpty(timerDef.getTimeDuration())) { xtw.writeStartElement("timeDuration"); xtw.writeCharacters(timerDef.getTimeDuration()); xtw.writeEndElement(); } else if (StringUtils.isNotEmpty(timerDef.getTimeDate())) { xtw.writeStartElement("timeDate"); xtw.writeCharacters(timerDef.getTimeDate()); xtw.writeEndElement(); } else if (StringUtils.isNotEmpty(timerDef.getTimeCycle())) { xtw.writeStartElement("timeCycle"); xtw.writeCharacters(timerDef.getTimeCycle()); xtw.writeEndElement(); } xtw.writeEndElement(); // end TimerIntermediateCatchEvent element xtw.writeEndElement(); } else if (eventDefinitionList.get(0) instanceof SignalEventDefinition) { SignalEventDefinition signalDef = (SignalEventDefinition) eventDefinitionList.get(0); // start SignalIntermediateCatchEvent element xtw.writeStartElement("intermediateCatchEvent"); xtw.writeAttribute("id", catchEvent.getId()); if (catchEvent.getName() != null) { xtw.writeAttribute("name", catchEvent.getName()); } xtw.writeStartElement("signalEventDefinition"); if (StringUtils.isNotEmpty(signalDef.getSignalRef())) { xtw.writeAttribute("signalRef", signalDef.getSignalRef()); } xtw.writeEndElement(); // end SignalIntermediateCatchEvent element xtw.writeEndElement(); } } }
From source file:org.activiti.designer.export.bpmn20.export.IntermediateThrowEventExport.java
public static void createIntermediateEvent(Object object, XMLStreamWriter xtw) throws Exception { ThrowEvent throwEvent = (ThrowEvent) object; // start IntermediateThrowEvent element xtw.writeStartElement("intermediateThrowEvent"); xtw.writeAttribute("id", throwEvent.getId()); if (throwEvent.getName() != null) { xtw.writeAttribute("name", throwEvent.getName()); }/*from www . j av a 2s. c om*/ List<EventDefinition> eventDefinitionList = throwEvent.getEventDefinitions(); if (eventDefinitionList.size() == 1) { if (eventDefinitionList.get(0) instanceof SignalEventDefinition) { SignalEventDefinition signalDef = (SignalEventDefinition) eventDefinitionList.get(0); xtw.writeStartElement("signalEventDefinition"); if (StringUtils.isNotEmpty(signalDef.getSignalRef())) { xtw.writeAttribute("signalRef", signalDef.getSignalRef()); } xtw.writeEndElement(); } } // end IntermediateThrowEvent element xtw.writeEndElement(); }
From source file:org.activiti.designer.export.bpmn20.export.MailTaskExport.java
private static void writeAlfrescoScriptMailTask(AlfrescoMailTask mailTask, XMLStreamWriter xtw) throws Exception { // start AlfrescoMailTask element xtw.writeStartElement("serviceTask"); xtw.writeAttribute("id", mailTask.getId()); if (mailTask.getName() != null) { xtw.writeAttribute("name", mailTask.getName()); }/*from w ww . ja va 2s .co m*/ xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "class", "org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate"); DefaultFlowExport.createDefaultFlow(mailTask, xtw); AsyncActivityExport.createAsyncAttribute(mailTask, xtw); xtw.writeStartElement("extensionElements"); ExecutionListenerExport.createExecutionListenerXML(mailTask.getExecutionListeners(), false, xtw); xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "field", ACTIVITI_EXTENSIONS_NAMESPACE); xtw.writeAttribute("name", "script"); xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "string", ACTIVITI_EXTENSIONS_NAMESPACE); xtw.writeCharacters(createMailScript(mailTask)); xtw.writeEndElement(); xtw.writeEndElement(); xtw.writeEndElement(); MultiInstanceExport.createMultiInstance(mailTask, xtw); // end AlfrescoMailTask element xtw.writeEndElement(); }
From source file:org.activiti.designer.export.bpmn20.export.MailTaskExport.java
private static void writeServiceMailTask(MailTask mailTask, XMLStreamWriter xtw) throws Exception { // start MailTask element xtw.writeStartElement("serviceTask"); xtw.writeAttribute("id", mailTask.getId()); if (mailTask.getName() != null) { xtw.writeAttribute("name", mailTask.getName()); }// ww w . j a va 2s . c o m DefaultFlowExport.createDefaultFlow(mailTask, xtw); AsyncActivityExport.createAsyncAttribute(mailTask, xtw); xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "type", "mail"); xtw.writeStartElement("extensionElements"); ExecutionListenerExport.createExecutionListenerXML(mailTask.getExecutionListeners(), false, xtw); if (StringUtils.isNotEmpty(mailTask.getTo())) { writeField("to", mailTask.getTo(), xtw); } if (StringUtils.isNotEmpty(mailTask.getFrom())) { writeField("from", mailTask.getFrom(), xtw); } if (StringUtils.isNotEmpty(mailTask.getSubject())) { writeField("subject", mailTask.getSubject(), xtw); } if (StringUtils.isNotEmpty(mailTask.getCc())) { writeField("cc", mailTask.getCc(), xtw); } if (StringUtils.isNotEmpty(mailTask.getBcc())) { writeField("bcc", mailTask.getBcc(), xtw); } if (StringUtils.isNotEmpty(mailTask.getCharset())) { writeField("charset", mailTask.getCharset(), xtw); } if (StringUtils.isNotEmpty(mailTask.getHtml())) { writeCDataField("html", mailTask.getHtml(), xtw); } if (StringUtils.isNotEmpty(mailTask.getText())) { writeCDataField("text", mailTask.getText(), xtw); } xtw.writeEndElement(); MultiInstanceExport.createMultiInstance(mailTask, xtw); // end MailTask element xtw.writeEndElement(); }
From source file:org.activiti.designer.export.bpmn20.export.MailTaskExport.java
private static void writeField(String name, String expression, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "field", ACTIVITI_EXTENSIONS_NAMESPACE); xtw.writeAttribute("name", name); xtw.writeAttribute("expression", expression); xtw.writeEndElement(); }
From source file:org.activiti.designer.export.bpmn20.export.MailTaskExport.java
private static void writeCDataField(String name, String text, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "field", ACTIVITI_EXTENSIONS_NAMESPACE); xtw.writeAttribute("name", name); xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "expression", ACTIVITI_EXTENSIONS_NAMESPACE); xtw.writeCData(text);//from ww w .j a va 2 s .co m xtw.writeEndElement(); xtw.writeEndElement(); }
From source file:org.activiti.designer.export.bpmn20.export.MultiInstanceExport.java
public static void createMultiInstance(Object object, XMLStreamWriter xtw) throws Exception { Activity activity = (Activity) object; if (activity.getLoopCharacteristics() == null) return;//from w w w . ja v a2s . c o m MultiInstanceLoopCharacteristics multiInstanceDef = (MultiInstanceLoopCharacteristics) activity .getLoopCharacteristics(); if (StringUtils.isNotEmpty(multiInstanceDef.getInputDataItem()) || StringUtils.isNotEmpty(multiInstanceDef.getLoopCardinality()) || StringUtils.isNotEmpty(multiInstanceDef.getCompletionCondition())) { // start multiInstance element xtw.writeStartElement("multiInstanceLoopCharacteristics"); xtw.writeAttribute("isSequential", "" + multiInstanceDef.isSequential()); if (StringUtils.isNotEmpty(multiInstanceDef.getInputDataItem())) { xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "collection", multiInstanceDef.getInputDataItem()); } if (StringUtils.isNotEmpty(multiInstanceDef.getElementVariable())) { xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "elementVariable", multiInstanceDef.getElementVariable()); } if (StringUtils.isNotEmpty(multiInstanceDef.getLoopCardinality())) { xtw.writeStartElement("loopCardinality"); xtw.writeCharacters(multiInstanceDef.getLoopCardinality()); xtw.writeEndElement(); } if (StringUtils.isNotEmpty(multiInstanceDef.getCompletionCondition())) { xtw.writeStartElement("completionCondition"); xtw.writeCharacters(multiInstanceDef.getCompletionCondition()); xtw.writeEndElement(); } // end multiInstance element xtw.writeEndElement(); } }
From source file:org.activiti.designer.export.bpmn20.export.ScriptTaskExport.java
public static void createScriptTask(Object object, XMLStreamWriter xtw) throws Exception { ScriptTask scriptTask = (ScriptTask) object; // start ScriptTask element xtw.writeStartElement("scriptTask"); xtw.writeAttribute("id", scriptTask.getId()); if (scriptTask.getName() != null) { xtw.writeAttribute("name", scriptTask.getName()); }// w ww .j a v a2 s .com DefaultFlowExport.createDefaultFlow(scriptTask, xtw); AsyncActivityExport.createAsyncAttribute(scriptTask, xtw); if (StringUtils.isNotEmpty(scriptTask.getScriptFormat())) { xtw.writeAttribute("scriptFormat", scriptTask.getScriptFormat()); } ExecutionListenerExport.createExecutionListenerXML(scriptTask.getExecutionListeners(), true, xtw); xtw.writeStartElement("script"); if (StringUtils.isNotEmpty(scriptTask.getScript())) { xtw.writeCData(scriptTask.getScript()); } xtw.writeEndElement(); MultiInstanceExport.createMultiInstance(object, xtw); // end ScriptTask element xtw.writeEndElement(); }
From source file:org.activiti.designer.export.bpmn20.export.SequenceFlowExport.java
public static void createSequenceFlow(Object object, XMLStreamWriter xtw) throws Exception { SequenceFlow sequenceFlow = (SequenceFlow) object; // start SequenceFlow element xtw.writeStartElement("sequenceFlow"); xtw.writeAttribute("id", sequenceFlow.getId()); if (sequenceFlow.getName() == null) { xtw.writeAttribute("name", ""); } else {/*from w w w .ja va 2 s. co m*/ xtw.writeAttribute("name", sequenceFlow.getName()); } xtw.writeAttribute("sourceRef", sequenceFlow.getSourceRef().getId()); xtw.writeAttribute("targetRef", sequenceFlow.getTargetRef().getId()); ExecutionListenerExport.createExecutionListenerXML(sequenceFlow.getExecutionListeners(), true, xtw); if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { String condition = sequenceFlow.getConditionExpression(); // start conditionExpression element xtw.writeStartElement("conditionExpression"); xtw.writeAttribute("xsi", XSI_NAMESPACE, "type", "tFormalExpression"); xtw.writeCData(condition); // end conditionExpression element xtw.writeEndElement(); } // end SequenceFlow element xtw.writeEndElement(); }