use of org.activiti.bpmn.model.DataSpec in project Activiti by Activiti.
the class AbstractBpmnParseHandler method createIOSpecification.
protected IOSpecification createIOSpecification(BpmnParse bpmnParse, org.activiti.bpmn.model.IOSpecification specificationModel) {
IOSpecification ioSpecification = new IOSpecification();
for (DataSpec dataInputElement : specificationModel.getDataInputs()) {
ItemDefinition itemDefinition = bpmnParse.getItemDefinitions().get(dataInputElement.getItemSubjectRef());
Data dataInput = new Data(bpmnParse.getTargetNamespace() + ":" + dataInputElement.getId(), dataInputElement.getId(), itemDefinition);
ioSpecification.addInput(dataInput);
}
for (DataSpec dataOutputElement : specificationModel.getDataOutputs()) {
ItemDefinition itemDefinition = bpmnParse.getItemDefinitions().get(dataOutputElement.getItemSubjectRef());
Data dataOutput = new Data(bpmnParse.getTargetNamespace() + ":" + dataOutputElement.getId(), dataOutputElement.getId(), itemDefinition);
ioSpecification.addOutput(dataOutput);
}
for (String dataInputRef : specificationModel.getDataInputRefs()) {
DataRef dataRef = new DataRef(dataInputRef);
ioSpecification.addInputRef(dataRef);
}
for (String dataOutputRef : specificationModel.getDataOutputRefs()) {
DataRef dataRef = new DataRef(dataOutputRef);
ioSpecification.addOutputRef(dataRef);
}
return ioSpecification;
}
use of org.activiti.bpmn.model.DataSpec in project Activiti by Activiti.
the class IOSpecificationParser method parseChildElement.
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
if (!(parentElement instanceof Activity) && !(parentElement instanceof Process))
return;
IOSpecification ioSpecification = new IOSpecification();
BpmnXMLUtil.addXMLLocation(ioSpecification, xtr);
boolean readyWithIOSpecification = false;
try {
while (!readyWithIOSpecification && xtr.hasNext()) {
xtr.next();
if (xtr.isStartElement() && ELEMENT_DATA_INPUT.equalsIgnoreCase(xtr.getLocalName())) {
DataSpec dataSpec = new DataSpec();
BpmnXMLUtil.addXMLLocation(dataSpec, xtr);
dataSpec.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID));
dataSpec.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME));
dataSpec.setItemSubjectRef(parseItemSubjectRef(xtr.getAttributeValue(null, ATTRIBUTE_ITEM_SUBJECT_REF), model));
ioSpecification.getDataInputs().add(dataSpec);
} else if (xtr.isStartElement() && ELEMENT_DATA_OUTPUT.equalsIgnoreCase(xtr.getLocalName())) {
DataSpec dataSpec = new DataSpec();
BpmnXMLUtil.addXMLLocation(dataSpec, xtr);
dataSpec.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID));
dataSpec.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME));
dataSpec.setItemSubjectRef(parseItemSubjectRef(xtr.getAttributeValue(null, ATTRIBUTE_ITEM_SUBJECT_REF), model));
ioSpecification.getDataOutputs().add(dataSpec);
} else if (xtr.isStartElement() && ELEMENT_DATA_INPUT_REFS.equalsIgnoreCase(xtr.getLocalName())) {
String dataInputRefs = xtr.getElementText();
if (StringUtils.isNotEmpty(dataInputRefs)) {
ioSpecification.getDataInputRefs().add(dataInputRefs.trim());
}
} else if (xtr.isStartElement() && ELEMENT_DATA_OUTPUT_REFS.equalsIgnoreCase(xtr.getLocalName())) {
String dataOutputRefs = xtr.getElementText();
if (StringUtils.isNotEmpty(dataOutputRefs)) {
ioSpecification.getDataOutputRefs().add(dataOutputRefs.trim());
}
} else if (xtr.isEndElement() && getElementName().equalsIgnoreCase(xtr.getLocalName())) {
readyWithIOSpecification = true;
}
}
} catch (Exception e) {
LOGGER.warn("Error parsing ioSpecification child elements", e);
}
if (parentElement instanceof Process) {
((Process) parentElement).setIoSpecification(ioSpecification);
} else {
((Activity) parentElement).setIoSpecification(ioSpecification);
}
}
use of org.activiti.bpmn.model.DataSpec in project Activiti by Activiti.
the class WebServiceActivityBehavior method initializeIoSpecification.
protected void initializeIoSpecification(IOSpecification activityIoSpecification, DelegateExecution execution, BpmnModel bpmnModel) {
for (DataSpec dataSpec : activityIoSpecification.getDataInputs()) {
ItemDefinition itemDefinition = itemDefinitionMap.get(dataSpec.getItemSubjectRef());
execution.setVariable(dataSpec.getId(), itemDefinition.createInstance());
}
for (DataSpec dataSpec : activityIoSpecification.getDataOutputs()) {
ItemDefinition itemDefinition = itemDefinitionMap.get(dataSpec.getItemSubjectRef());
execution.setVariable(dataSpec.getId(), itemDefinition.createInstance());
}
}
Aggregations