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 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; }
@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 name = attrs.getValue("name"); String type = attrs.getValue("structureRef"); if (type == null || type.trim().length() == 0) { type = "java.lang.Object"; } ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, FileItemDefinition> itemDefinitions = (Map<String, FileItemDefinition>) buildData.getMetaData("FileItemDefinitions"); if (itemDefinitions == null) { itemDefinitions = new HashMap<String, FileItemDefinition>(); buildData.setMetaData("FileItemDefinitions", itemDefinitions); } FileItemDefinition itemDefinition = new FileItemDefinition(id); itemDefinition.setName(name); itemDefinition.setStructureRef(type); itemDefinitions.put(id, itemDefinition); return itemDefinition; }
@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"); logger.debug("Found case role with id {} and name {}", id, name); RuleFlowProcess process = ((RuleFlowProcess) parser.getParent(RuleFlowProcess.class)); String caseRoles = (String) process.getMetaData("customCaseRoles"); if (caseRoles == null) { caseRoles = name; } else { caseRoles += "," + name; } process.setMetaData("customCaseRoles", caseRoles); // save case roles so they can be easily referenced later for human task performer ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, Role> roles = (Map<String, Role>) buildData.getMetaData("Roles"); if (roles == null) { roles = new HashMap<String, Role>(); buildData.setMetaData("Roles", roles); } Role role = new Role(id, name); roles.put(id, role); return role; }
@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(); 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; }
@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; }
private void postProcessNodes(RuleFlowProcess process, NodeContainer container, ProcessBuildData buildData, ExtensibleXmlParser parser) { for (Node node : container.getNodes()) { if (node instanceof SubProcessNode) { Map<String, String> processes = (Map<String, String>) buildData.getMetaData("ProcessElements"); if (processes != null) { SubProcessNode subprocessNode = (SubProcessNode) node; subprocessNode.setProcessId(processes.getOrDefault(subprocessNode.getProcessId(), subprocessNode.getProcessId())); } } else if (node instanceof RuleSetNode) { Map<String, Decision> decisions = (Map<String, Decision>) buildData.getMetaData("DecisionElements"); RuleSetNode ruleSetNode = (RuleSetNode) node; if (decisions != null && decisions.containsKey(ruleSetNode.getRuleFlowGroup())) { Decision decision = decisions.get(ruleSetNode.getRuleFlowGroup()); ruleSetNode.setRuleFlowGroup(null); ruleSetNode.setLanguage(RuleSetNode.DMN_LANG); ruleSetNode.setNamespace((String) parser.getNamespaceURI(decision.getNamespace())); ruleSetNode.setModel(decision.getModel()); ruleSetNode.setDecision(decision.getDecision()); } } if (node instanceof NodeContainer) { postProcessNodes(process, (NodeContainer) node, buildData, parser); } } }
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { final Element element = parser.endElementBuilder(); Node node = (Node) parser.getCurrent(); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, PlanItem> planItems = (Map<String, PlanItem>) buildData.getMetaData("PlanItems"); PlanItem planItem = planItems.get(node.getMetaData().get("UniqueId")); if (planItem != null && planItem.getEntryCriterion() != null) { if ("autostart".equalsIgnoreCase(planItem.getEntryCriterion().getExpression())) { node.setMetaData("customAutoStart", "true"); } else { node.setMetaData("customActivationExpression", planItem.getEntryCriterion().getExpression()); node.setMetaData("customActivationFragmentName", node.getName()); } } handleNode(node, element, uri, localName, parser); NodeContainer nodeContainer = (NodeContainer) parser.getParent(); nodeContainer.addNode(node); ((ProcessBuildData) parser.getData()).addNode(node); return node; }
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); DynamicNode stageNode = (DynamicNode) node; // by default it should not autocomplete as it's adhoc stageNode.setAutoComplete(false); stageNode.setLanguage("rule"); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, PlanItem> planItems = (Map<String, PlanItem>) buildData.getMetaData("PlanItems"); PlanItem stagePlanItem = planItems.get(stageNode.getMetaData("UniqueId")); if (stagePlanItem != null && stagePlanItem.getEntryCriterion() != null) { if ("autostart".equalsIgnoreCase(stagePlanItem.getEntryCriterion().getExpression())) { stageNode.setMetaData("customAutoStart", "true"); } else { stageNode.setActivationExpression(stagePlanItem.getEntryCriterion().getExpression()); } } if (stagePlanItem != null && stagePlanItem.getExitCriterion() != null) { if (AUTOCOMPLETE_EXPRESSIONS.contains(stagePlanItem.getExitCriterion().getExpression())) { stageNode.setAutoComplete(true); } else { stageNode.setCompletionExpression(stagePlanItem.getExitCriterion().getExpression()); } } }