use of org.jbpm.compiler.xml.ProcessBuildData in project jbpm by kiegroup.
the class ProcessHandler method start.
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
final String id = attrs.getValue("id");
final String name = attrs.getValue("name");
final String version = attrs.getValue("version");
final String type = attrs.getValue("type");
final String packageName = attrs.getValue("package-name");
final String routerLayout = attrs.getValue("routerLayout");
RuleFlowProcess process = new RuleFlowProcess();
process.setId(id);
process.setName(name);
process.setVersion(version);
process.setType(type);
process.setPackageName(packageName);
if (routerLayout != null) {
process.setMetaData("routerLayout", new Integer(routerLayout));
}
((ProcessBuildData) parser.getData()).addProcess(process);
return process;
}
use of org.jbpm.compiler.xml.ProcessBuildData in project jbpm by kiegroup.
the class TaskHandler method handleNode.
protected void handleNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
super.handleNode(node, element, uri, localName, parser);
itemDefinitions = (Map<String, ItemDefinition>) ((ProcessBuildData) parser.getData()).getMetaData("ItemDefinitions");
dataTypeInputs.clear();
dataTypeOutputs.clear();
WorkItemNode workItemNode = (WorkItemNode) node;
String name = getTaskName(element);
Work work = new WorkImpl();
work.setName(name);
workItemNode.setWork(work);
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("ioSpecification".equals(nodeName)) {
readIoSpecification(xmlNode, dataInputs, dataOutputs);
} else if ("dataInputAssociation".equals(nodeName)) {
readDataInputAssociation(xmlNode, workItemNode, dataInputs);
} else if ("dataOutputAssociation".equals(nodeName)) {
readDataOutputAssociation(xmlNode, workItemNode, dataOutputs);
}
xmlNode = xmlNode.getNextSibling();
}
workItemNode.setMetaData("DataInputs", new HashMap<String, String>(dataTypeInputs));
workItemNode.setMetaData("DataOutputs", new HashMap<String, String>(dataTypeOutputs));
handleScript(workItemNode, element, "onEntry");
handleScript(workItemNode, element, "onExit");
String compensation = element.getAttribute("isForCompensation");
if (compensation != null) {
boolean isForCompensation = Boolean.parseBoolean(compensation);
if (isForCompensation) {
workItemNode.setMetaData("isForCompensation", isForCompensation);
}
}
}
use of org.jbpm.compiler.xml.ProcessBuildData in project jbpm by kiegroup.
the class PropertyHandler method start.
@SuppressWarnings("unchecked")
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
final String id = attrs.getValue("id");
final String name = attrs.getValue("name");
final String itemSubjectRef = attrs.getValue("itemSubjectRef");
Object parent = parser.getParent();
if (parent instanceof ContextContainer) {
ContextContainer contextContainer = (ContextContainer) parent;
VariableScope variableScope = (VariableScope) contextContainer.getDefaultContext(VariableScope.VARIABLE_SCOPE);
List variables = variableScope.getVariables();
Variable variable = new Variable();
// if name is given use it as variable name instead of id
if (name != null && name.length() > 0) {
variable.setName(name);
} else {
variable.setName(id);
}
variable.setMetaData("ItemSubjectRef", itemSubjectRef);
variables.add(variable);
((ProcessBuildData) parser.getData()).setMetaData("Variable", variable);
return variable;
}
return new Variable();
}
use of org.jbpm.compiler.xml.ProcessBuildData in project jbpm by kiegroup.
the class SignalHandler method start.
@SuppressWarnings("unchecked")
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
// according to the (Semantic.)xsd, both the name and structureRef are optional
String id = attrs.getValue("id");
// referred to by the signalEventDefinition.signalRef attr
String name = attrs.getValue("name");
String structureRef = attrs.getValue("structureRef");
ProcessBuildData buildData = (ProcessBuildData) parser.getData();
Map<String, Signal> signals = (Map<String, Signal>) buildData.getMetaData("Signals");
if (signals == null) {
signals = new HashMap<String, Signal>();
buildData.setMetaData("Signals", signals);
}
Signal s = new Signal(id, name, structureRef);
signals.put(id, s);
return s;
}
use of org.jbpm.compiler.xml.ProcessBuildData in project jbpm by kiegroup.
the class BoundaryEventHandler method end.
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
final Element element = parser.endElementBuilder();
Node node = (Node) parser.getCurrent();
String attachedTo = element.getAttribute("attachedToRef");
Attr cancelActivityAttr = element.getAttributeNode("cancelActivity");
boolean cancelActivity = Boolean.parseBoolean(cancelActivityAttr.getValue());
// determine type of event definition, so the correct type of node can be generated
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("escalationEventDefinition".equals(nodeName)) {
// reuse already created EventNode
handleEscalationNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
break;
} else if ("errorEventDefinition".equals(nodeName)) {
// reuse already created EventNode
handleErrorNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
break;
} else if ("timerEventDefinition".equals(nodeName)) {
// reuse already created EventNode
handleTimerNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
break;
} else if ("compensateEventDefinition".equals(nodeName)) {
// reuse already created EventNode
handleCompensationNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
break;
} else if ("signalEventDefinition".equals(nodeName)) {
// reuse already created EventNode
handleSignalNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
break;
} else if ("conditionalEventDefinition".equals(nodeName)) {
handleConditionNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
break;
} else if ("messageEventDefinition".equals(nodeName)) {
handleMessageNode(node, element, uri, localName, parser, attachedTo, cancelActivity);
break;
}
xmlNode = xmlNode.getNextSibling();
}
NodeContainer nodeContainer = (NodeContainer) parser.getParent();
nodeContainer.addNode(node);
((ProcessBuildData) parser.getData()).addNode(node);
return node;
}
Aggregations