private Instance getOriginalVariable(final Model model, final String variableToSet) { for (Instance variable : model.getAllInstances("process.Data")) { String varName = (String) variable.get("name"); if (varName != null && varName.equals(variableToSet)) { return variable; } } return null; }
public Connector5Descriptor(Instance connectorInstance) { this.uuid = connectorInstance.getUuid(); this.name = connectorInstance.get(NAME); this.connectorId = connectorInstance.get(CONNECTOR_ID); this.documentation = connectorInstance.get(DOCUMENTATION); this.event = connectorInstance.get(EVENT); this.ignoreErrors = connectorInstance.get(ERROR_HANDLE); final List<Instance> parameters = connectorInstance.get(PARAMETERS); for (Instance parameter : parameters) { String key = parameter.get(PARAMETER_KEY); Object value = parameter.get(PARAMETER_VALUE); inputs.put(key, value); } final List<Instance> outputMapping = connectorInstance.get(OUTPUTS); for (Instance output : outputMapping) { try { Instance data = output.get(OUTPUT_DATA); String value = output.get(OUTPUT_EXPRESSION); if (data != null) { outputs.put((String) data.get("name"), value); } else { Instance container = connectorInstance.getContainer(); if (container.instanceOf("form.Widget")) { String id = "field_" + container.get("name"); outputs.put(id, value); } } } catch (IllegalArgumentException e) { BonitaStudioLog.warning( "The connector " + connectorId + "/" + name + " doesn't provide the expected feature for outputs.", BarImporterPlugin.PLUGIN_ID); } } definitionMapper = ConnectorIdToDefinitionMapping.getInstance().getDefinitionMapper(connectorId); this.containerType = connectorInstance.getContainer().getType().getEClass(); }