public void setCompletionCondition(String expression) { FormalExpression formalExpression = bpmn2.createFormalExpression(); formalExpression.setBody(asCData(expression)); this.miloop.setCompletionCondition(formalExpression); } }
private Assignment assignment(String from, String to) { Assignment assignment = bpmn2.createAssignment(); FormalExpression fromExpr = bpmn2.createFormalExpression(); fromExpr.setBody(asCData(from)); assignment.setFrom(fromExpr); FormalExpression toExpr = bpmn2.createFormalExpression(); toExpr.setBody(to); assignment.setTo(toExpr); return assignment; }
FormalExpression timeDateExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); timeDateExpression.setBody(timeDate); timerEventDef.setTimeDate(timeDateExpression); FormalExpression timeDurationExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); timeDurationExpression.setBody(timeDuration); timerEventDef.setTimeDuration(timeDurationExpression); FormalExpression timeCycleExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); timeCycleExpression.setBody(timeCycle); if (timeCycleLanguage != null && timeCycleLanguage.length() > 0) {
public void setActors(Actors actors) { for (String actor : fromActorString(actors.getValue())) { PotentialOwner potentialOwner = bpmn2.createPotentialOwner(); potentialOwner.setId(UUID.randomUUID().toString()); FormalExpression formalExpression = bpmn2.createFormalExpression(); formalExpression.setBody(actor); ResourceAssignmentExpression resourceAssignmentExpression = bpmn2.createResourceAssignmentExpression(); resourceAssignmentExpression.setExpression(formalExpression); potentialOwner.setResourceAssignmentExpression(resourceAssignmentExpression); task.getResources().add(potentialOwner); } }
public void setConditionExpression(ScriptTypeValue scriptTypeValue) { String language = scriptTypeValue.getLanguage(); String script = scriptTypeValue.getScript(); if (script != null && !script.isEmpty()) { FormalExpression formalExpression = bpmn2.createFormalExpression(); String uri = Scripts.scriptLanguageToUri(language); formalExpression.setLanguage(uri); formalExpression.setBody(asCData(script)); sequenceFlow.setConditionExpression(formalExpression); } } }
FormalExpression expr = Bpmn2Factory.eINSTANCE.createFormalExpression(); expr.setBody(""); newFlow.setConditionExpression(expr);
protected void applyAdHocSubProcessProperties(AdHocSubProcess ahsp, Map<String, String> properties) { if (properties.get("adhocordering") != null) { if (properties.get("adhocordering").equals("Parallel")) { ahsp.setOrdering(AdHocOrdering.PARALLEL); } else { ahsp.setOrdering(AdHocOrdering.SEQUENTIAL); } } String adHocCompletionCondition = properties.get("adhoccompletioncondition"); if (adHocCompletionCondition != null) { ScriptTypeValue value = new ScriptTypeTypeSerializer().parse(adHocCompletionCondition); FormalExpression completionConditionExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); String completionExpression = value.getScript(); if (completionExpression == null || completionExpression.isEmpty()) { //default to autocomplete completionExpression = "autocomplete"; } completionConditionExpression.setBody(wrapInCDATABlock(completionExpression)); String languageFormat = Utils.getScriptLanguageFormat(value.getLanguage()); if (languageFormat == null) { //default to mvel languageFormat = "mvel"; } completionConditionExpression.setLanguage(languageFormat); ahsp.setCompletionCondition(completionConditionExpression); } }
protected void applyConditionalEventProperties(ConditionalEventDefinition event, Map<String, String> properties) { FormalExpression conditionExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); ScriptTypeValue value = new ScriptTypeTypeSerializer().parse(properties.get("conditionexpression")); if (value.getLanguage() != null && !value.getLanguage().isEmpty()) { String languageFormat = Utils.getScriptLanguageFormat(value.getLanguage()); if (languageFormat == null) { //default to drools languageFormat = "http://www.jboss.org/drools/rule"; } conditionExpression.setLanguage(languageFormat); } if (value.getScript() != null && !value.getScript().isEmpty()) { String scriptStr = value.getScript().replaceAll("\\\\n", "\n"); conditionExpression.setBody(wrapInCDATABlock(scriptStr)); } event.setCondition(conditionExpression); }
protected void applySequenceFlowCondition(SequenceFlow sequenceFlow, Map<String, String> properties) { String conditionExpression = properties.get("conditionexpression"); if (conditionExpression != null && !conditionExpression.isEmpty()) { ScriptTypeValue value = new ScriptTypeTypeSerializer().parse(conditionExpression); if (value.getScript() != null && !value.getScript().isEmpty()) { FormalExpression expr = Bpmn2Factory.eINSTANCE.createFormalExpression(); expr.setBody(wrapInCDATABlock(value.getScript())); if (value.getLanguage() != null && !value.getLanguage().isEmpty()) { String languageFormat = Utils.getScriptLanguageFormat(value.getLanguage()); if (languageFormat == null) { //default to mvel languageFormat = "http://www.mvel.org/2.0"; } expr.setLanguage(languageFormat); } sequenceFlow.setConditionExpression(expr); } } }
public void addTimer(TimerSettings timerSettings) { TimerEventDefinition eventDefinition = bpmn2.createTimerEventDefinition(); TimerSettingsValue timerSettingsValue = timerSettings.getValue(); String date = timerSettingsValue.getTimeDate(); if (date != null) { FormalExpression timeDate = bpmn2.createFormalExpression(); timeDate.setBody(date); eventDefinition.setTimeDate(timeDate); } String duration = timerSettingsValue.getTimeDuration(); if (duration != null) { FormalExpression timeDuration = bpmn2.createFormalExpression(); timeDuration.setBody(duration); eventDefinition.setTimeDuration(timeDuration); } String cycle = timerSettingsValue.getTimeCycle(); String cycleLanguage = timerSettingsValue.getTimeCycleLanguage(); if (cycle != null && cycleLanguage != null) { FormalExpression timeCycleExpression = bpmn2.createFormalExpression(); timeCycleExpression.setBody(cycle); timeCycleExpression.setLanguage(cycleLanguage); eventDefinition.setTimeCycle(timeCycleExpression); } addEventDefinition(eventDefinition); }
taskNameDataInputAssociation.setTargetRef(taskNameDataInput); Assignment taskNameAssignment = Bpmn2Factory.eINSTANCE.createAssignment(); FormalExpression fromExp = Bpmn2Factory.eINSTANCE.createFormalExpression(); fromExp.setBody(properties.get("taskname").replaceAll("&", "").replaceAll(" ", "")); taskNameAssignment.setFrom(fromExp); FormalExpression toExp = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExp.setBody(task.getId() + "_TaskNameInputX"); taskNameAssignment.setTo(toExp); FormalExpression fromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); if (assignmentParts.length > 1) { String replacer = decodeAssociationValue(assignmentParts[1]); FormalExpression toExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExpression.setBody(dia.getTargetRef().getId()); a.setFrom(fromExpression);
public DataInputAssociation getDataInputAssociation() { DataInputAssociation dataInputAssociation = bpmn2.createDataInputAssociation(); Assignment assignment = bpmn2.createAssignment(); String id = getDataInput().getId(); FormalExpression toExpr = bpmn2.createFormalExpression(); toExpr.setBody(id); assignment.setTo(toExpr); FormalExpression fromExpr = bpmn2.createFormalExpression(); // this should be handled **outside** the marshallers! String decodedExpression = decode(expression); String cdataExpression = asCData(decodedExpression); fromExpr.setBody(cdataExpression); assignment.setFrom(fromExpr); dataInputAssociation .getAssignment().add(assignment); dataInputAssociation .setTargetRef(getDataInput()); return dataInputAssociation; }
FormalExpression fromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); if (assignmentParts.length > 1) { String replacer = decodeAssociationValue(assignmentParts[1]); fromExpression.setBody(""); FormalExpression toExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExpression.setBody(dia.getTargetRef().getId()); a.setFrom(fromExpression);
FormalExpression fromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); if (assignmentParts.length > 1) { String replacer = decodeAssociationValue(assignmentParts[1]); fromExpression.setBody(""); FormalExpression toExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExpression.setBody(dia.getTargetRef().getId()); a.setFrom(fromExpression);
public void setAdHocCompletionCondition(AdHocCompletionCondition adHocCompletionCondition) { FormalExpression e = bpmn2.createFormalExpression(); ScriptTypeValue s = adHocCompletionCondition.getValue(); e.setLanguage(scriptLanguageToUri(s.getLanguage())); e.setBody(asCData(s.getScript())); process.setCompletionCondition(e); } }
public void addCondition(ConditionExpression condition) { ConditionalEventDefinition conditionalEventDefinition = bpmn2.createConditionalEventDefinition(); FormalExpression conditionExpression = bpmn2.createFormalExpression(); String languageFormat = Scripts.scriptLanguageToUri(condition.getValue().getLanguage(), Scripts.LANGUAGE.DROOLS.format()); conditionExpression.setLanguage(languageFormat); String conditionScript = condition.getValue().getScript(); if (conditionScript != null && !conditionScript.isEmpty()) { conditionExpression.setBody(asCData(conditionScript)); } conditionalEventDefinition.setCondition(conditionExpression); addEventDefinition(conditionalEventDefinition); }
FormalExpression fromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); if (assignmentParts.length > 1) { String replacer = decodeAssociationValue(assignmentParts[1]); fromExpression.setBody(""); FormalExpression toExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExpression.setBody(dia.getTargetRef().getId()); a.setFrom(fromExpression); FormalExpression expr = Bpmn2Factory.eINSTANCE.createFormalExpression(); expr.setBody(wrapInCDATABlock(completionConditionStr)); loopCharacteristics.setCompletionCondition(expr);
PotentialOwner po = Bpmn2Factory.eINSTANCE.createPotentialOwner(); ResourceAssignmentExpression rae = Bpmn2Factory.eINSTANCE.createResourceAssignmentExpression(); FormalExpression fe = Bpmn2Factory.eINSTANCE.createFormalExpression(); fe.setBody(actor); rae.setExpression(fe); dia.setTargetRef(foundInput); Assignment a = Bpmn2Factory.eINSTANCE.createAssignment(); FormalExpression groupFromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); groupFromExpression.setBody(wrapInCDATABlock(properties.get("groupid"))); FormalExpression groupToExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); groupToExpression.setBody(foundInput.getId()); a.setFrom(groupFromExpression); dia.setTargetRef(foundInput); Assignment a = Bpmn2Factory.eINSTANCE.createAssignment(); FormalExpression skippableFromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); skippableFromExpression.setBody(skippableStr); FormalExpression skippableToExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); skippableToExpression.setBody(foundInput.getId()); a.setFrom(skippableFromExpression); dia.setTargetRef(foundInput); Assignment a = Bpmn2Factory.eINSTANCE.createAssignment(); FormalExpression commentFromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); commentFromExpression.setBody(wrapInCDATABlock(properties.get("subject"))); FormalExpression commentToExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); commentToExpression.setBody(foundInput.getId()); a.setFrom(commentFromExpression);
@Test public void urlEncodeConstants() throws UnsupportedEncodingException { String decoded = "<<<#!!!#>>>"; String expected = URLEncoder.encode(decoded, "UTF-8"); Assignment assignment = bpmn2.createAssignment(); FormalExpression from = bpmn2.createFormalExpression(); from.setBody(decoded); FormalExpression to = bpmn2.createFormalExpression(); to.setBody("ID"); assignment.setFrom(from); assignment.setTo(to); InputAssignmentReader iar = new InputAssignmentReader(assignment, "ID"); AssociationDeclaration associationDeclaration = iar.getAssociationDeclaration(); assertEquals(AssociationDeclaration.Type.FromTo, associationDeclaration.getType()); assertEquals(expected, associationDeclaration.getSource()); } }
FormalExpression expr = Bpmn2Factory.eINSTANCE.createFormalExpression(); expr.setBody(miCompletionCondition); loopCharacteristics.setCompletionCondition(expr);