private Instance getConnectorConfiguration(Model model, StringToExpressionConverter converter) {
   final Instance configuration =
       model.newInstance("connectorconfiguration.ConnectorConfiguration");
   configuration.set("definitionId", getDefinitionId());
   configuration.set("version", getDefinitionVersion());
   final Map<String, Object> additionalInputs = definitionMapper.getAdditionalInputs(inputs);
   final Map<String, Object> allInput = new HashMap<String, Object>(inputs);
   allInput.putAll(additionalInputs);
   for (Entry<String, Object> input : allInput.entrySet()) {
     final String parameterKeyFor = getParameterKeyFor(input.getKey());
     if (parameterKeyFor != null) {
       final Instance parameter = model.newInstance("connectorconfiguration.ConnectorParameter");
       parameter.set("key", parameterKeyFor);
       parameter.set(
           "expression",
           getParameterExpressionFor(
               model,
               parameterKeyFor,
               converter,
               definitionMapper.transformParameterValue(parameterKeyFor, input.getValue(), inputs),
               getReturnType(parameterKeyFor)));
       configuration.add("parameters", parameter);
     } else {
       if (BonitaStudioLog.isLoggable(IStatus.OK)) {
         BonitaStudioLog.debug(
             input.getKey() + " not mapped for " + getDefinitionId(), BarImporterPlugin.PLUGIN_ID);
       }
     }
   }
   return configuration;
 }
 private Instance getParameterExpressionFor(
     Model model,
     String input,
     StringToExpressionConverter converter,
     Object value,
     String returnType) {
   if (value instanceof String || value instanceof Boolean || value instanceof Number) {
     String type = definitionMapper.getExpectedExpresstionType(input, value);
     if (type == null) {
       return converter.parse(value.toString(), returnType, true);
     } else {
       return converter.parse(value.toString(), returnType, true, type);
     }
   } else if (value instanceof List) {
     List<Object> listValue = (List<Object>) value;
     if (!listValue.isEmpty()) {
       Instance expression = null;
       Object row = listValue.get(0);
       if (row instanceof List) {
         expression = model.newInstance("expression.TableExpression");
         addRow(model, converter, expression, row);
         for (int i = 1; i < listValue.size(); i++) {
           row = listValue.get(i);
           addRow(model, converter, expression, row);
         }
       } else {
         expression = model.newInstance("expression.ListExpression");
         for (int i = 0; i < listValue.size(); i++) {
           Object v = listValue.get(i);
           expression.add(
               "expressions", converter.parse(v.toString(), String.class.getName(), false));
         }
       }
       return expression;
     }
   } else {
     if (BonitaStudioLog.isLoggable(IStatus.OK)) {
       String valueString = "null";
       if (value != null) {
         valueString = value.toString();
       }
       BonitaStudioLog.debug(
           input + " value " + valueString + " cannot be transform to an expression",
           BarImporterPlugin.PLUGIN_ID);
     }
   }
   return null;
 }
  private void addOutputs(
      Model model, Instance connectorInstance, StringToExpressionConverter converter) {
    for (Entry<String, Object> output : outputs.entrySet()) {

      final String outputValue = output.getValue().toString();
      final String outputType =
          isAnOutputConnector(outputValue)
              ? ExpressionConstants.CONNECTOR_OUTPUT_TYPE
              : ExpressionConstants.SCRIPT_TYPE;
      final String returnType = definitionMapper.getOutputReturnType(outputValue);

      final Instance operation =
          converter.parseOperation(
              returnType, false, (String) output.getValue(), output.getKey(), outputType);
      connectorInstance.add(OUTPUTS, operation);
    }
  }
 private String getParameterKeyFor(String key) {
   return definitionMapper.getParameterKeyFor(key);
 }
 private String getReturnType(String inputName) {
   return definitionMapper.getInputReturnType(inputName);
 }
 private String getDefinitionId() {
   return definitionMapper.getDefinitionId();
 }
 private String getDefinitionVersion() {
   return definitionMapper.getDefinitionVersion();
 }
 private boolean isAnOutputConnector(String outputVAlueTmp) {
   if (definitionMapper.getOutputReturnType(outputVAlueTmp) != null) {
     return true;
   }
   return false;
 }