String eventType = connectorInstanceItemNode.get(PROPERTY_CONNECTORINSTANCE_EVENTTYPE).asText();
String errorHandling = connectorInstanceItemNode.get(PROPERTY_CONNECTORINSTANCE_ERRORHANDLING).asText();
String errorCode = connectorInstanceItemNode.get(PROPERTY_CONNECTORINSTANCE_ERRORCODE).asText();
Boolean isTimeExecute = connectorInstanceItemNode.get(PROPERTY_CONNECTORINSTANCE_ISTIMEEXECUTE).asBoolean(false);
ConnectorInstance ConnectorInstance = FixFlowFactory.eINSTANCE.createConnectorInstance();
ConnectorInstance.setConnectorId(connectorId);
ConnectorInstance.setPackageName(packageName);
ConnectorInstance.setClassName(className);
ConnectorInstance.setConnectorInstanceId(connectorInstanceId);
ConnectorInstance.setConnectorInstanceName(connectorInstanceName);
ConnectorInstance.setEventType(eventType);
ConnectorInstance.setErrorHandling(errorHandling);
ConnectorInstance.setErrorCode(errorCode);
ConnectorInstance.setIsTimeExecute(isTimeExecute);
JsonNode documentNode = connectorInstanceItemNode.get(PROPERTY_DOCUMENTATION);
if(documentNode !=null){
String id = documentNode.get(PROPERTY_DOCUMENTATION_ID).asText();
String name = documentNode.get(PROPERTY_DOCUMENTATION_NAME).asText();
String value = documentNode.get(PROPERTY_DOCUMENTATION_VALUE).asText();
Documentation documentationElm = FixFlowFactory.eINSTANCE.createDocumentation();
documentationElm.setId(id);
documentationElm.setName(name);
documentationElm.setValue(value);
ConnectorInstance.setDocumentation(documentationElm);
}
JsonNode connectorParameterInputsNode = connectorInstanceItemNode.get(PROPERTY_CONNECTORPARAMETERINPUTS);
if(connectorParameterInputsNode !=null){
Iterator<JsonNode> connectorParameterInputsIterator = connectorParameterInputsNode.getElements();
while (connectorParameterInputsIterator.hasNext()) {
JsonNode connectorParameterInputsItemNode = connectorParameterInputsIterator.next();
String id = connectorParameterInputsItemNode.get(PROPERTY_CONNECTORPARAMETERINPUTS_ID).asText();
String name = connectorParameterInputsItemNode.get(PROPERTY_CONNECTORPARAMETERINPUTS_NAME).asText();
String dataType = connectorParameterInputsItemNode.get(PROPERTY_CONNECTORPARAMETERINPUTS_DATATYPE).asText();
String expression_name = connectorParameterInputsItemNode.get(PROPERTY_CONNECTORPARAMETERINPUTS_EXPRESSION_NAME).asText();
String expression_value = connectorParameterInputsItemNode.get(PROPERTY_CONNECTORPARAMETERINPUTS_EXPRESSION_VALUE).asText();
ConnectorParameterInputs connectorParameterInputsElm = FixFlowFactory.eINSTANCE.createConnectorParameterInputs();
connectorParameterInputsElm.setId(id);
connectorParameterInputsElm.setName(name);
connectorParameterInputsElm.setDataType(dataType);
Expression expression = FixFlowFactory.eINSTANCE.createExpression();
expression.setName(expression_name);
expression.setValue(expression_value);
connectorParameterInputsElm.setExpression(expression);
ConnectorInstance.getConnectorParameterInputs().add(connectorParameterInputsElm);
}
}
JsonNode connectorParameterOutputsNode = connectorInstanceItemNode.get(PROPERTY_CONNECTORPARAMETEROUTPUTS);
if(connectorParameterOutputsNode !=null){
Iterator<JsonNode> connectorParameterOutputsIterator = connectorParameterOutputsNode.getElements();
while (connectorParameterOutputsIterator.hasNext()) {
JsonNode connectorParameterOutputsItemNode = connectorParameterOutputsIterator.next();
String variableTarget = connectorParameterOutputsItemNode.get(PROPERTY_CONNECTORPARAMETEROUTPUTS_VARIABLETARGET).asText();
String expression_name = connectorParameterOutputsItemNode.get(PROPERTY_CONNECTORPARAMETEROUTPUTS_EXPRESSION_NAME).asText();
String expression_value = connectorParameterOutputsItemNode.get(PROPERTY_CONNECTORPARAMETEROUTPUTS_EXPRESSION_VALUE).asText();
ConnectorParameterOutputs connectorParameterOutputsElm = FixFlowFactory.eINSTANCE.createConnectorParameterOutputs();
connectorParameterOutputsElm.setVariableTarget(variableTarget);
Expression expression = FixFlowFactory.eINSTANCE.createExpression();
expression.setName(expression_name);
expression.setValue(expression_value);
connectorParameterOutputsElm.setExpression(expression);
ConnectorInstance.getConnectorParameterOutputs().add(connectorParameterOutputsElm);
}
}
JsonNode connectorParameterOutputsDefNode = connectorInstanceItemNode.get(PROPERTY_CONNECTORPARAMETEROUTPUTSDEF);
if(connectorParameterOutputsDefNode !=null){
Iterator<JsonNode> connectorParameterOutputsDefIterator = connectorParameterOutputsDefNode.getElements();
while (connectorParameterOutputsDefIterator.hasNext()) {
JsonNode connectorParameterOutputsDefItemNode = connectorParameterOutputsDefIterator.next();
String id = connectorParameterOutputsDefItemNode.get(PROPERTY_CONNECTORPARAMETEROUTPUTSDEF_ID).asText();
String name = connectorParameterOutputsDefItemNode.get(PROPERTY_CONNECTORPARAMETEROUTPUTSDEF_NAME).asText();
String dataType = connectorParameterOutputsDefItemNode.get(PROPERTY_CONNECTORPARAMETEROUTPUTSDEF_DATATYPE).asText();
ConnectorParameterOutputsDef connectorParameterOutputsDefElm = FixFlowFactory.eINSTANCE.createConnectorParameterOutputsDef();
connectorParameterOutputsDefElm.setId(id);
connectorParameterOutputsDefElm.setName(name);
connectorParameterOutputsDefElm.setDataType(dataType);
ConnectorInstance.getConnectorParameterOutputsDef().add(connectorParameterOutputsDefElm);
}
}
JsonNode skipCommentNode = connectorInstanceItemNode.get(PROPERTY_SKIPCOMMENT);
if(skipCommentNode !=null){
String id = skipCommentNode.get(PROPERTY_SKIPCOMMENT_EXPRESSION_ID).asText();
String name = skipCommentNode.get(PROPERTY_SKIPCOMMENT_EXPRESSION_NAME).asText();
String value = skipCommentNode.get(PROPERTY_SKIPCOMMENT_EXPRESSION_VALUE).asText();
Expression expression = FixFlowFactory.eINSTANCE.createExpression();
expression.setId(id);
expression.setName(name);
expression.setValue(value);
SkipComment skipCommentElm = FixFlowFactory.eINSTANCE.createSkipComment();
skipCommentElm.setExpression(expression);
ConnectorInstance.setSkipComment(skipCommentElm);
}
JsonNode timeExpressionNode = connectorInstanceItemNode.get(PROPERTY_TIME_EXPRESSION);
if(timeExpressionNode !=null){
String id = timeExpressionNode.get(PROPERTY_TIME_EXPRESSION_ID).asText();
String name = timeExpressionNode.get(PROPERTY_TIME_EXPRESSION_NAME).asText();
String value = timeExpressionNode.get(PROPERTY_TIME_EXPRESSION_VALUE).asText();
Expression expression = FixFlowFactory.eINSTANCE.createExpression();
expression.setId(id);
expression.setName(name);
expression.setValue(value);
TimeExpression timeExpressionElm = FixFlowFactory.eINSTANCE.createTimeExpression();
timeExpressionElm.setExpression(expression);
ConnectorInstance.setTimeExpression(timeExpressionElm);
}
JsonNode timeSkipExpressionNode = connectorInstanceItemNode.get(PROPERTY_TIME_SKIP_EXPRESSION);
if(timeSkipExpressionNode !=null){
String id = timeSkipExpressionNode.get(PROPERTY_TIME_SKIP_EXPRESSION_ID).asText();
String name = timeSkipExpressionNode.get(PROPERTY_TIME_SKIP_EXPRESSION_NAME).asText();
String value = timeSkipExpressionNode.get(PROPERTY_TIME_SKIP_EXPRESSION_VALUE).asText();
Expression expression = FixFlowFactory.eINSTANCE.createExpression();
expression.setId(id);
expression.setName(name);
expression.setValue(value);
TimeSkipExpression timeSkipExpressionElm = FixFlowFactory.eINSTANCE.createTimeSkipExpression();
timeSkipExpressionElm.setExpression(expression);
ConnectorInstance.setTimeSkipExpression(timeSkipExpressionElm);
}
//BpmnModelUtil.addExtensionElement(activity, FixFlowPackage.Literals.DOCUMENT_ROOT__CONNECTOR_INSTANCE, ConnectorInstance);
listActivity.add(ConnectorInstance);
}