private static Object evaluate(Assignment assignment) { return ((FormalExpression) assignment.getFrom()).getBody(); }
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); } } }
public ScriptTypeValue getConditionExpression() { if (conditionExpression == null) { return new ScriptTypeValue("java", ""); } else { return new ScriptTypeValue( Scripts.scriptLanguageFromUri(conditionExpression.getLanguage()), conditionExpression.getBody()); } }
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); taskNameDataInputAssociation.getAssignment().add(taskNameAssignment); if (assignmentParts.length > 1) { String replacer = decodeAssociationValue(assignmentParts[1]); fromExpression.setBody(wrapInCDATABlock(replacer)); } else { fromExpression.setBody(properties.get(fromPart.toLowerCase())); } else { fromExpression.setBody(""); toExpression.setBody(dia.getTargetRef().getId()); a.setFrom(fromExpression); a.setTo(toExpression); if (da.getAssignment() != null && da.getAssignment().size() > 0) { Assignment a = da.getAssignment().get(0); if (((FormalExpression) a.getTo()).getBody().equals(task.getId() + "_TaskNameInputX")) { if (!haveTaskNameInput) { haveTaskNameInput = true;
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; }
private String readTaskFormName(DataInputAssociation inputAssociation) { Optional<FormalExpression> optional = inputAssociation.getAssignment() .stream() .filter(assignment -> assignment.getFrom() != null && assignment.getFrom() instanceof FormalExpression) .map(assignment -> (FormalExpression)assignment.getFrom()) .findAny(); if(optional.isPresent()) { return Parser.xmlParser().parseInput(optional.get().getBody(), "").toString(); } return ""; }
public ScriptTypeValue getAdHocCompletionCondition() { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage()), completionCondition.getBody() ); }
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 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); } }
private void marshallDataOutputAssociations(StringBuilder associationBuff, List<DataOutputAssociation> outputAssociations) { if (outputAssociations != null) { for (DataOutputAssociation dataout : outputAssociations) { if (dataout.getSourceRef().size() > 0) { String lhsAssociation = ((DataOutput) dataout.getSourceRef().get(0)).getName(); String rhsAssociation = dataout.getTargetRef().getId(); if (dataout.getTransformation() != null && dataout.getTransformation().getBody() != null) { rhsAssociation = encodeAssociationValue(dataout.getTransformation().getBody()); } if (lhsAssociation != null && lhsAssociation.length() > 0) { associationBuff.append("[dout]" + lhsAssociation).append("->").append(rhsAssociation); associationBuff.append(","); } } } } }
public void setConditionExpressionProperties(final FormalExpression conditionExpression, final Map<String, Object> properties, final String defaultLanguage) { String language = Utils.getScriptLanguage(conditionExpression.getLanguage()); final String script = conditionExpression.getBody(); if (language != null || script != null) { if (language == null) { language = defaultLanguage; } properties.put(CONDITIONEXPRESSION, new ScriptTypeTypeSerializer().serialize(new ScriptTypeValue(language, script))); } }
timeDateExpression.setBody(timeDate); timerEventDef.setTimeDate(timeDateExpression); timeDurationExpression.setBody(timeDuration); timerEventDef.setTimeDuration(timeDurationExpression); timeCycleExpression.setBody(timeCycle); if (timeCycleLanguage != null && timeCycleLanguage.length() > 0) { timeCycleExpression.setLanguage(timeCycleLanguage);
expr.setBody(""); newFlow.setConditionExpression(expr);
InputAssignmentReader(Assignment assignment, String targetName) { FormalExpression from = (FormalExpression) assignment.getFrom(); String body = from.getBody(); String encodedBody = encode(body); this.associationDeclaration = new AssociationDeclaration( AssociationDeclaration.Direction.Input, AssociationDeclaration.Type.FromTo, encodedBody, targetName); }
public TimerSettingsValue getTimerSettings(TimerEventDefinition eventDefinition) { TimerSettingsValue timerSettingsValue = new TimerSettings().getValue(); toFormalExpression(eventDefinition.getTimeCycle()).ifPresent(timeCycle -> { timerSettingsValue.setTimeCycle(timeCycle.getBody()); timerSettingsValue.setTimeCycleLanguage(timeCycle.getLanguage()); }); toFormalExpression(eventDefinition.getTimeDate()).ifPresent(timeDate -> { timerSettingsValue.setTimeDate(timeDate.getBody()); }); toFormalExpression(eventDefinition.getTimeDuration()).ifPresent(timeDateDuration -> { timerSettingsValue.setTimeDuration(timeDateDuration.getBody()); }); return timerSettingsValue; }
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); } }
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; }
public Actors getActors() { // get the user task actors List<ResourceRole> roles = task.getResources(); List<String> users = new ArrayList<>(); for (ResourceRole role : roles) { if (role instanceof PotentialOwner) { FormalExpression fe = (FormalExpression) role.getResourceAssignmentExpression() .getExpression(); users.add(fe.getBody()); } } return new Actors(renderActors(users)); }
public ConditionExpression getConditionExpression(ConditionalEventDefinition conditionalEvent) { FormalExpression formalExpression = (FormalExpression) conditionalEvent.getCondition(); if (formalExpression == null) { return null; } String language = Scripts.scriptLanguageFromUri(formalExpression.getLanguage(), Scripts.LANGUAGE.DROOLS.language()); String script = formalExpression.getBody(); return new ConditionExpression(new ScriptTypeValue(language, script)); } }