private static Object evaluate(Assignment assignment) { return ((FormalExpression) assignment.getFrom()).getBody(); }
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 ""; }
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(","); } } } } }
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 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 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; }
public ScriptTypeValue getConditionExpression() { if (conditionExpression == null) { return new ScriptTypeValue("java", ""); } else { return new ScriptTypeValue( Scripts.scriptLanguageFromUri(conditionExpression.getLanguage()), conditionExpression.getBody()); } }
String lhsAssociation = ""; if (datain.getSourceRef() != null && datain.getSourceRef().size() > 0) { if (datain.getTransformation() != null && datain.getTransformation().getBody() != null) { lhsAssociation = datain.getTransformation().getBody(); } else { lhsAssociation = datain.getSourceRef().get(0).getId(); String associationValue = ((FormalExpression) datain.getAssignment().get(0).getFrom()).getBody(); if (associationValue == null) { associationValue = "";
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))); } }
public ScriptTypeValue getAdHocCompletionCondition() { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage()), completionCondition.getBody() ); }
public String findAssignment(List<DataInputAssociation> associations, String varName) { return associations.stream() .filter(a -> { DataInput in = (DataInput) a.getTargetRef(); return in.getName().equals(varName); }) .map(a -> { Assignment assignment = a.getAssignment().get(0); FormalExpression expr = (FormalExpression) assignment.getFrom(); return expr.getBody(); }) .findFirst() .get(); } }
private void setAdHocSubProcessProperties(final AdHocSubProcess subProcess, final Map<String, Object> properties) { if (subProcess.getOrdering().equals(AdHocOrdering.PARALLEL)) { properties.put(ADHOCORDERING, "Parallel"); } else if (subProcess.getOrdering().equals(AdHocOrdering.SEQUENTIAL)) { properties.put(ADHOCORDERING, "Sequential"); } else { // default to parallel properties.put(ADHOCORDERING, "Parallel"); } if (subProcess.getCompletionCondition() != null) { final FormalExpression expression = (FormalExpression) subProcess.getCompletionCondition(); final String language = Utils.getScriptLanguage(expression.getLanguage()); final String script = expression.getBody().replaceAll("\n", "\\\\n"); final ScriptTypeValue value = new ScriptTypeValue(language, script); properties.put(ADHOCCOMPLETIONCONDITION, new ScriptTypeTypeSerializer().serialize(value)); } }
private void setTimerEventProperties(TimerEventDefinition timerEventDef, Map<String, Object> properties) { final TimerSettingsValue timerSettings = new TimerSettingsValue(); if (timerEventDef.getTimeDate() != null) { timerSettings.setTimeDate(((FormalExpression) timerEventDef.getTimeDate()).getBody()); } if (timerEventDef.getTimeDuration() != null) { timerSettings.setTimeDuration(((FormalExpression) timerEventDef.getTimeDuration()).getBody()); } if (timerEventDef.getTimeCycle() != null) { timerSettings.setTimeCycle(((FormalExpression) timerEventDef.getTimeCycle()).getBody()); if (((FormalExpression) timerEventDef.getTimeCycle()).getLanguage() != null) { timerSettings.setTimeCycleLanguage(((FormalExpression) timerEventDef.getTimeCycle()).getLanguage()); } } properties.put(TIMERSETTINGS, new TimerSettingsTypeSerializer().serialize(timerSettings)); }
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)); } }
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;
if (role instanceof PotentialOwner) { FormalExpression fe = (FormalExpression) ((PotentialOwner) role).getResourceAssignmentExpression().getExpression(); if (fe.getBody() != null && fe.getBody().length() > 0) { sb.append(fe.getBody()); sb.append(","); dia.getAssignment().get(0).getFrom() != null) { properties.put("taskname", ((FormalExpression) dia.getAssignment().get(0).getFrom()).getBody()); foundTaskName = true; if (taskmi.getCompletionCondition() instanceof FormalExpression) { properties.put("multipleinstancecompletioncondition", ((FormalExpression) taskmi.getCompletionCondition()).getBody()); String lhsAssociation = ""; if (datain.getSourceRef() != null && datain.getSourceRef().size() > 0) { if (datain.getTransformation() != null && datain.getTransformation().getBody() != null) { lhsAssociation = datain.getTransformation().getBody(); } else { lhsAssociation = datain.getSourceRef().get(0).getId(); String associationValue = ((FormalExpression) datain.getAssignment().get(0).getFrom()).getBody(); if (associationValue == null) { associationValue = ""; ((FormalExpression) datain.getAssignment().get(0).getTo()).getBody() != null && datain.getAssignment().get(0).getFrom() != null ) {
@Test public void urlDecodeConstants() throws UnsupportedEncodingException { String expected = "<<<#!!!#>>>"; String encoded = URLEncoder.encode(expected, "UTF-8"); VariableDeclaration variable = new VariableDeclaration("ID", "Object"); InputConstant c = new InputConstant("PARENT", variable, encoded); Assignment assignment = c.getDataInputAssociation().getAssignment().get(0); FormalExpression to = (FormalExpression) assignment.getTo(); assertEquals(Ids.dataInput("PARENT", "ID"), to.getBody()); FormalExpression from = (FormalExpression) assignment.getFrom(); assertEquals(asCData(expected), from.getBody()); } }
Assignment assignment = it.next(); if (assignment.getFrom() != null) { String taskName = ((FormalExpression) assignment.getFrom()).getBody(); if (!StringUtils.isEmpty(taskName)) {
@Test public void completionConditionMustBeWrappedInCdata() { String expression = "x<1"; String expected = "<![CDATA[" + expression + "]]>"; SubProcess subProcess = bpmn2.createSubProcess(); MultipleInstanceSubProcessPropertyWriter p = new MultipleInstanceSubProcessPropertyWriter( subProcess, new FlatVariableScope()); p.setCompletionCondition(expression); MultiInstanceLoopCharacteristics loopCharacteristics = (MultiInstanceLoopCharacteristics) subProcess.getLoopCharacteristics(); FormalExpression completionCondition = (FormalExpression) loopCharacteristics.getCompletionCondition(); assertThat(expected).isEqualTo(completionCondition.getBody()); } }
if (taskmi.getCompletionCondition() instanceof FormalExpression) { properties.put(MULTIPLEINSTANCECOMPLETIONCONDITION, ((FormalExpression) taskmi.getCompletionCondition()).getBody());