use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.
the class BaseBpmnXMLConverter method writeFormProperties.
protected boolean writeFormProperties(FlowElement flowElement, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
List<FormProperty> propertyList = null;
if (flowElement instanceof UserTask) {
propertyList = ((UserTask) flowElement).getFormProperties();
} else if (flowElement instanceof StartEvent) {
propertyList = ((StartEvent) flowElement).getFormProperties();
}
if (propertyList != null) {
for (FormProperty property : propertyList) {
if (StringUtils.isNotEmpty(property.getId())) {
if (didWriteExtensionStartElement == false) {
xtw.writeStartElement(ELEMENT_EXTENSIONS);
didWriteExtensionStartElement = true;
}
xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_FORMPROPERTY, ACTIVITI_EXTENSIONS_NAMESPACE);
writeDefaultAttribute(ATTRIBUTE_FORM_ID, property.getId(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_NAME, property.getName(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_TYPE, property.getType(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_EXPRESSION, property.getExpression(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_VARIABLE, property.getVariable(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_DEFAULT, property.getDefaultExpression(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_DATEPATTERN, property.getDatePattern(), xtw);
if (property.isReadable() == false) {
writeDefaultAttribute(ATTRIBUTE_FORM_READABLE, ATTRIBUTE_VALUE_FALSE, xtw);
}
if (property.isWriteable() == false) {
writeDefaultAttribute(ATTRIBUTE_FORM_WRITABLE, ATTRIBUTE_VALUE_FALSE, xtw);
}
if (property.isRequired()) {
writeDefaultAttribute(ATTRIBUTE_FORM_REQUIRED, ATTRIBUTE_VALUE_TRUE, xtw);
}
for (FormValue formValue : property.getFormValues()) {
if (StringUtils.isNotEmpty(formValue.getId())) {
xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_VALUE, ACTIVITI_EXTENSIONS_NAMESPACE);
xtw.writeAttribute(ATTRIBUTE_ID, formValue.getId());
xtw.writeAttribute(ATTRIBUTE_NAME, formValue.getName());
xtw.writeEndElement();
}
}
xtw.writeEndElement();
}
}
}
return didWriteExtensionStartElement;
}
use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.
the class StartEventXMLConverter method writeAdditionalAttributes.
@Override
protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
StartEvent startEvent = (StartEvent) element;
writeQualifiedAttribute(ATTRIBUTE_EVENT_START_INITIATOR, startEvent.getInitiator(), xtw);
writeQualifiedAttribute(ATTRIBUTE_FORM_FORMKEY, startEvent.getFormKey(), xtw);
}
use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.
the class StartEventXMLConverter method convertXMLToElement.
@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
String formKey = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_FORM_FORMKEY);
StartEvent startEvent = null;
if (StringUtils.isNotEmpty(formKey)) {
if (model.getStartEventFormTypes() != null && model.getStartEventFormTypes().contains(formKey)) {
startEvent = new AlfrescoStartEvent();
}
}
if (startEvent == null) {
startEvent = new StartEvent();
}
BpmnXMLUtil.addXMLLocation(startEvent, xtr);
startEvent.setInitiator(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_EVENT_START_INITIATOR));
startEvent.setFormKey(formKey);
parseChildElements(getXMLElementName(), startEvent, model, xtr);
return startEvent;
}
use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.
the class StartEventXMLConverter method writeAdditionalChildElements.
@Override
protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
StartEvent startEvent = (StartEvent) element;
writeEventDefinitions(startEvent, startEvent.getEventDefinitions(), model, xtw);
}
use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.
the class AbstractActivitiTestCase method createTwoTasksTestProcess.
public BpmnModel createTwoTasksTestProcess() {
BpmnModel model = new BpmnModel();
org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();
model.addProcess(process);
process.setId("twoTasksProcess");
process.setName("The two tasks process");
StartEvent startEvent = new StartEvent();
startEvent.setId("start");
process.addFlowElement(startEvent);
UserTask userTask = new UserTask();
userTask.setName("The First Task");
userTask.setId("task1");
userTask.setAssignee("kermit");
process.addFlowElement(userTask);
UserTask userTask2 = new UserTask();
userTask2.setName("The Second Task");
userTask2.setId("task2");
userTask2.setAssignee("kermit");
process.addFlowElement(userTask2);
EndEvent endEvent = new EndEvent();
endEvent.setId("theEnd");
process.addFlowElement(endEvent);
process.addFlowElement(new SequenceFlow("start", "task1"));
process.addFlowElement(new SequenceFlow("start", "task2"));
process.addFlowElement(new SequenceFlow("task1", "theEnd"));
process.addFlowElement(new SequenceFlow("task2", "theEnd"));
return model;
}
Aggregations