private List<IOParameter> convertToIOParameters(String propertyName, JsonNode elementNode) { List<IOParameter> ioParameters = new ArrayList<IOParameter>(); JsonNode parametersNode = getProperty(propertyName, elementNode); if (parametersNode != null) { JsonNode itemsArrayNode = parametersNode.get(EDITOR_PROPERTIES_GENERAL_ITEMS); if (itemsArrayNode != null) { for (JsonNode itemNode : itemsArrayNode) { JsonNode sourceNode = itemNode.get(PROPERTY_IOPARAMETER_SOURCE); JsonNode sourceExpressionNode = itemNode.get(PROPERTY_IOPARAMETER_SOURCE_EXPRESSION); if ((sourceNode != null && StringUtils.isNotEmpty(sourceNode.asText())) || (sourceExpressionNode != null && StringUtils.isNotEmpty(sourceExpressionNode.asText()))) { IOParameter parameter = new IOParameter(); if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_IOPARAMETER_SOURCE, itemNode))) { parameter.setSource(getValueAsString(PROPERTY_IOPARAMETER_SOURCE, itemNode)); } if (StringUtils.isNotEmpty( getValueAsString(PROPERTY_IOPARAMETER_SOURCE_EXPRESSION, itemNode))) { parameter.setSourceExpression( getValueAsString(PROPERTY_IOPARAMETER_SOURCE_EXPRESSION, itemNode)); } if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_IOPARAMETER_TARGET, itemNode))) { parameter.setTarget(getValueAsString(PROPERTY_IOPARAMETER_TARGET, itemNode)); } ioParameters.add(parameter); } } } } return ioParameters; }
private void addJsonParameters( String propertyName, List<IOParameter> parameterList, ObjectNode propertiesNode) { ObjectNode parametersNode = objectMapper.createObjectNode(); ArrayNode itemsNode = objectMapper.createArrayNode(); for (IOParameter parameter : parameterList) { ObjectNode parameterItemNode = objectMapper.createObjectNode(); if (StringUtils.isNotEmpty(parameter.getSource())) { parameterItemNode.put(PROPERTY_IOPARAMETER_SOURCE, parameter.getSource()); } else { parameterItemNode.putNull(PROPERTY_IOPARAMETER_SOURCE); } if (StringUtils.isNotEmpty(parameter.getTarget())) { parameterItemNode.put(PROPERTY_IOPARAMETER_TARGET, parameter.getTarget()); } else { parameterItemNode.putNull(PROPERTY_IOPARAMETER_TARGET); } if (StringUtils.isNotEmpty(parameter.getSourceExpression())) { parameterItemNode.put( PROPERTY_IOPARAMETER_SOURCE_EXPRESSION, parameter.getSourceExpression()); } else { parameterItemNode.putNull(PROPERTY_IOPARAMETER_SOURCE_EXPRESSION); } itemsNode.add(parameterItemNode); } parametersNode.put("totalCount", itemsNode.size()); parametersNode.put(EDITOR_PROPERTIES_GENERAL_ITEMS, itemsNode); propertiesNode.put(propertyName, parametersNode); }
public CallActivityBehavior createCallActivityBehavior(CallActivity callActivity) { String expressionRegex = "\\$+\\{+.+\\}"; CallActivityBehavior callActivityBehaviour = null; if (StringUtils.isNotEmpty(callActivity.getCalledElement()) && callActivity.getCalledElement().matches(expressionRegex)) { callActivityBehaviour = new CallActivityBehavior( expressionManager.createExpression(callActivity.getCalledElement()), callActivity.getMapExceptions()); } else { callActivityBehaviour = new CallActivityBehavior( callActivity.getCalledElement(), callActivity.getMapExceptions()); } for (IOParameter ioParameter : callActivity.getInParameters()) { if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) { Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim()); callActivityBehaviour.addDataInputAssociation( new SimpleDataInputAssociation(expression, ioParameter.getTarget())); } else { callActivityBehaviour.addDataInputAssociation( new SimpleDataInputAssociation(ioParameter.getSource(), ioParameter.getTarget())); } } for (IOParameter ioParameter : callActivity.getOutParameters()) { if (StringUtils.isNotEmpty(ioParameter.getSourceExpression())) { Expression expression = expressionManager.createExpression(ioParameter.getSourceExpression().trim()); callActivityBehaviour.addDataOutputAssociation( new MessageImplicitDataOutputAssociation(ioParameter.getTarget(), expression)); } else { callActivityBehaviour.addDataOutputAssociation( new MessageImplicitDataOutputAssociation( ioParameter.getTarget(), ioParameter.getSource())); } } return callActivityBehaviour; }