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 ""; }
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 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(); } }
if (dia.getTargetRef() != null && dia.getTargetRef().getId().equals(din.getId()) && dia.getAssignment() != null && !dia.getAssignment().isEmpty() && dia.getAssignment().get(0).getFrom() != null) { properties.put("taskname", ((FormalExpression) dia.getAssignment().get(0).getFrom()).getBody()); foundTaskName = true; if (datain.getAssignment().get(0).getFrom() instanceof FormalExpression) { String associationValue = ((FormalExpression) datain.getAssignment().get(0).getFrom()).getBody(); if (associationValue == null) { associationValue = ""; datain.getAssignment().get(0).getFrom() != null ) { String toBody = ((FormalExpression) datain.getAssignment().get(0).getTo()).getBody(); String fromBody = ((FormalExpression) datain.getAssignment().get(0).getFrom()).getBody(); if (toBody != null) { if (groupDataInput != null && toBody.equals(groupDataInput.getId())) {
if (da.getTargetRef() != null && da.getTargetRef().getId().equals(foundInput.getId())) { foundGroupIdAssociation = true; ((FormalExpression) da.getAssignment().get(0).getFrom()).setBody(wrapInCDATABlock(properties.get("groupid"))); if (da.getTargetRef() != null && da.getTargetRef().getId().equals(foundInput.getId())) { foundSkippableAssociation = true; ((FormalExpression) da.getAssignment().get(0).getFrom()).setBody(skippableStr); if (da.getTargetRef() != null && da.getTargetRef().getId().equals(foundInput.getId())) { foundCommentAssociation = true; ((FormalExpression) da.getAssignment().get(0).getFrom()).setBody(wrapInCDATABlock(properties.get("subject"))); if (da.getTargetRef() != null && da.getTargetRef().getId().equals(foundInput.getId())) { foundDescriptionAssociation = true; ((FormalExpression) da.getAssignment().get(0).getFrom()).setBody(wrapInCDATABlock(properties.get("description"))); if (da.getTargetRef() != null && da.getTargetRef().getId().equals(foundInput.getId())) { foundPriorityAssociation = true; ((FormalExpression) da.getAssignment().get(0).getFrom()).setBody(properties.get("priority")); if (da.getTargetRef() != null && da.getTargetRef().getId().equals(foundInput.getId())) { foundContentAssociation = true; ((FormalExpression) da.getAssignment().get(0).getFrom()).setBody(wrapInCDATABlock(properties.get("content"))); if (da.getTargetRef() != null && da.getTargetRef().getId().equals(foundInput.getId())) { foundLocaleAssociation = true; ((FormalExpression) da.getAssignment().get(0).getFrom()).setBody(wrapInCDATABlock(properties.get("locale"))); if (da.getTargetRef() != null && da.getTargetRef().getId().equals(foundInput.getId())) {
@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()); } }