public ProcessBuildData getProcessBuildData() { return (ProcessBuildData) this.parser.getData(); }
@SuppressWarnings("unchecked") public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); String id = attrs.getValue("id"); String externalRef = attrs.getValue("externalRef"); if (externalRef.contains(":")) { externalRef = externalRef.split(":")[1]; } logger.debug("Found process reference with id {} and external ref {}", id, externalRef); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, String> processes = (Map<String, String>) buildData.getMetaData("ProcessElements"); if (processes == null) { processes = new HashMap<String, String>(); buildData.setMetaData("ProcessElements", processes); } processes.put(id, externalRef); return null; }
@SuppressWarnings("unchecked") public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); String id = attrs.getValue("id"); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, Sentry> sentries = (Map<String, Sentry>) buildData.getMetaData("Sentries"); Sentry sentryStub = sentries.get(id); if (sentryStub == null) { sentryStub = new Sentry(id, null, null); sentries.put(id, sentryStub); } return sentryStub; }
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); final String type = attrs.getValue("importType"); final String location = attrs.getValue("location"); final String namespace = attrs.getValue("namespace"); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); if (type != null && location != null && namespace != null) { List<Bpmn2Import> typedImports = (List<Bpmn2Import>) buildData.getMetaData("Bpmn2Imports"); if (typedImports == null) { typedImports = new ArrayList< Bpmn2Import>(); buildData.setMetaData("Bpmn2Imports", typedImports); } typedImports.add(new Bpmn2Import(type, location, namespace)); } return null; }
@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"); String name = attrs.getValue("name"); // referred to by the signalEventDefinition.signalRef attr 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; }
protected String checkSignalAndConvertToRealSignalNam(ExtensibleXmlParser parser, String signalName) { ProcessBuildData buildData = ((ProcessBuildData) parser.getData()); Set<String> signalNames = (Set<String>) buildData.getMetaData(SIGNAL_NAMES); if( signalNames == null ) { signalNames = new HashSet<>(); buildData.setMetaData(SIGNAL_NAMES, signalNames); } signalNames.add(signalName); Map<String, Signal> signals = (Map<String, Signal>) buildData.getMetaData("Signals"); if (signals != null ) { if( signals.containsKey(signalName)) { Signal signal = signals.get(signalName); signalName = signal.getName(); if (signalName == null) { throw new IllegalArgumentException("Signal definition must have a name attribute"); } } } return signalName; } }
@SuppressWarnings("unchecked") public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); String id = attrs.getValue("id"); String escalationCode = attrs.getValue("escalationCode"); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, Escalation> escalations = (Map<String, Escalation>) buildData.getMetaData(ProcessHandler.ESCALATIONS); if (escalations == null) { escalations = new HashMap<String, Escalation>(); buildData.setMetaData(ProcessHandler.ESCALATIONS, escalations); } Escalation e = new Escalation(id, escalationCode); escalations.put(id, e); return e; }
@SuppressWarnings("unchecked") public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); String id = attrs.getValue("id"); String definitionRef = attrs.getValue("definitionRef"); logger.debug("Found plan item with id {} and definitionRef {}", id, definitionRef); // save plan item so they can be easily referenced later ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, PlanItem> planItems = (Map<String, PlanItem>) buildData.getMetaData("PlanItems"); if (planItems == null) { planItems = new HashMap<String, PlanItem>(); buildData.setMetaData("PlanItems", planItems); } PlanItem planItem = new PlanItem(id, definitionRef); planItems.put(definitionRef, planItem); return planItem; }
@SuppressWarnings("unchecked") public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); String id = attrs.getValue("id"); String name = attrs.getValue("name"); String implRef = attrs.getValue("implementationRef"); if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Interface name is required attribute"); } ProcessBuildData buildData = (ProcessBuildData) parser.getData(); List<Interface> interfaces = (List<Interface>) buildData.getMetaData("Interfaces"); if (interfaces == null) { interfaces = new ArrayList<Interface>(); buildData.setMetaData("Interfaces", interfaces); } Interface i = new Interface(id, name); if (implRef != null) { i.setImplementationRef(implRef); } interfaces.add(i); return i; }
@SuppressWarnings("unchecked") 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); WorkItemNode workItemNode = (WorkItemNode) node; String messageRef = element.getAttribute("messageRef"); Map<String, Message> messages = (Map<String, Message>) ((ProcessBuildData) parser.getData()).getMetaData("Messages"); if (messages == null) { throw new IllegalArgumentException("No messages found"); } Message message = messages.get(messageRef); if (message == null) { throw new IllegalArgumentException("Could not find message " + messageRef); } workItemNode.getWork().setParameter("MessageType", message.getType()); }
@SuppressWarnings("unchecked") public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); String id = attrs.getValue("id"); String type = attrs.getValue("structureRef"); if (type == null || type.trim().length() == 0) { type = "java.lang.Object"; } ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, ItemDefinition> itemDefinitions = (Map<String, ItemDefinition>) buildData.getMetaData("ItemDefinitions"); if (itemDefinitions == null) { itemDefinitions = new HashMap<String, ItemDefinition>(); buildData.setMetaData("ItemDefinitions", itemDefinitions); } ItemDefinition itemDefinition = new ItemDefinition(id); itemDefinition.setStructureRef(type); itemDefinitions.put(id, itemDefinition); return itemDefinition; }
@SuppressWarnings("unchecked") public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { Element element = parser.endElementBuilder(); String messageId = element.getTextContent(); Map<String, Message> messages = (Map<String, Message>) ((ProcessBuildData) parser.getData()).getMetaData("Messages"); if (messages == null) { throw new IllegalArgumentException("No messages found"); } Message message = messages.get(messageId); if (message == null) { throw new IllegalArgumentException("Could not find message " + messageId); } Operation operation = (Operation) parser.getParent(); operation.setMessage(message); return parser.getCurrent(); }
@SuppressWarnings("unchecked") public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); String id = attrs.getValue("id"); String errorCode = attrs.getValue("errorCode"); String structureRef = attrs.getValue("structureRef"); Definitions definitions = (Definitions) parser.getParent(); List<Error> errors = definitions.getErrors(); if (errors == null) { errors = new ArrayList<Error>(); definitions.setErrors(errors); ((ProcessBuildData) parser.getData()).setMetaData("Errors", errors); } Error e = new Error(id, errorCode, structureRef); errors.add(e); return e; }
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final Element element = parser.endElementBuilder(); Definitions definitions = (Definitions) parser.getCurrent(); String namespace = element.getAttribute("targetNamespace"); List<Process> processes = ((ProcessBuildData) parser.getData()).getProcesses(); Map<String, ItemDefinition> itemDefinitions = (Map<String, ItemDefinition>) ((ProcessBuildData) parser.getData()).getMetaData("ItemDefinitions"); List<Interface> interfaces = (List<Interface>) ((ProcessBuildData) parser.getData()).getMetaData("Interfaces"); for (Process process : processes) { RuleFlowProcess ruleFlowProcess = (RuleFlowProcess)process; ruleFlowProcess.setMetaData("TargetNamespace", namespace); postProcessItemDefinitions(ruleFlowProcess, itemDefinitions, parser.getClassLoader()); postProcessInterfaces(ruleFlowProcess, interfaces); } definitions.setTargetNamespace(namespace); return definitions; }
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final Element element = parser.endElementBuilder(); Definitions definitions = (Definitions) parser.getCurrent(); String id = element.getAttribute("id"); String namespace = element.getAttribute("targetNamespace"); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); List<Process> processes = ((ProcessBuildData) parser.getData()).getProcesses(); String namespaceN1 = (String) parser.getNamespaceURI("ns2"); for (Process process : processes) { RuleFlowProcess ruleFlowProcess = (RuleFlowProcess) process; ruleFlowProcess.setMetaData("TargetNamespace", namespace); postProcessNodes(ruleFlowProcess, ruleFlowProcess, buildData, parser); } definitions.setId(id); definitions.setTargetNamespace(namespace); return definitions; }
@SuppressWarnings("unchecked") 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); WorkItemNode workItemNode = (WorkItemNode) node; String messageRef = element.getAttribute("messageRef"); Map<String, Message> messages = (Map<String, Message>) ((ProcessBuildData) parser.getData()).getMetaData("Messages"); if (messages == null) { throw new IllegalArgumentException("No messages found"); } Message message = messages.get(messageRef); if (message == null) { throw new IllegalArgumentException("Could not find message " + messageRef); } workItemNode.getWork().setParameter("MessageId", message.getId()); workItemNode.getWork().setParameter("MessageType", message.getType()); }
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); MilestoneNode milestoneNode = (MilestoneNode) node; ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, PlanItem> planItems = (Map<String, PlanItem>) buildData.getMetaData("PlanItems"); PlanItem milestonePlanItem = planItems.get(milestoneNode.getMetaData("UniqueId")); if (milestonePlanItem != null && milestonePlanItem.getExitCriterion() != null) { milestoneNode.setConstraint(milestonePlanItem.getExitCriterion().getExpression()); } }
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final Element element = parser.endElementBuilder(); Node node = (Node) parser.getCurrent(); handleNode(node, element, uri, localName, parser); NodeContainer nodeContainer = (NodeContainer) parser.getParent(); nodeContainer.addNode(node); ((ProcessBuildData) parser.getData()).addNode(node); return node; }
@SuppressWarnings("unchecked") public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { parser.endElementBuilder(); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, Role> roles = (Map<String, Role>) buildData.getMetaData("Roles"); RuleFlowProcess process = (RuleFlowProcess) parser.getCurrent(); List<SequenceFlow> connections = (List<SequenceFlow>) process.getMetaData(CONNECTIONS); linkConnections(process, connections); linkBoundaryEvents(process); postProcessNodes(process, process, roles); return process; }
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser xmlPackageReader) throws SAXException { xmlPackageReader.startElementBuilder( localName, attrs ); WorkflowProcessImpl process = ( WorkflowProcessImpl ) xmlPackageReader.getParent(); ActionNode actionNode = new ActionNode(); final String name = attrs.getValue( "name" ); emptyAttributeCheck( localName, "name", name, xmlPackageReader ); actionNode.setName( name ); final String id = attrs.getValue( "id" ); emptyAttributeCheck( localName, "id", name, xmlPackageReader ); actionNode.setId( new Long(id) ); process.addNode( actionNode ); ((ProcessBuildData)xmlPackageReader.getData()).addNode( actionNode ); return actionNode; }