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;
 }
 protected void addRow(
     Model model, StringToExpressionConverter converter, Instance expression, Object row) {
   Instance listExpression = model.newInstance("expression.ListExpression");
   for (Object v : (List<Object>) row) {
     listExpression.add(
         "expressions", converter.parse(v.toString(), String.class.getName(), false));
   }
   expression.add("expressions", listExpression);
 }
  private void createOperation(
      Model model,
      Instance connectorInstance,
      StringToExpressionConverter converter,
      final String variableToSet,
      final String varValue) {
    Instance operationContainerInstance = connectorInstance.getContainer();
    Instance originalVariable = getOriginalVariable(model, variableToSet);

    // set variable dependency of left operand
    String returnType = Object.class.getName();
    Instance leftOperand = null;
    if (originalVariable != null) {
      returnType = StringToExpressionConverter.getDataReturnType(originalVariable);
      leftOperand =
          StringToExpressionConverter.createExpressionInstanceWithDependency(
              model,
              variableToSet,
              variableToSet,
              returnType,
              ExpressionConstants.VARIABLE_TYPE,
              true,
              originalVariable);
    } else {
      leftOperand =
          StringToExpressionConverter.createExpressionInstance(
              model,
              variableToSet,
              variableToSet,
              returnType,
              ExpressionConstants.VARIABLE_TYPE,
              true);
    }
    Instance rightOperand = converter.parse(varValue, returnType, false);
    Instance operatorInstance = model.newInstance("expression.Operator");
    operatorInstance.set("type", ExpressionConstants.ASSIGNMENT_OPERATOR);
    Instance operationInstance = model.newInstance("expression.Operation");
    operationInstance.set("leftOperand", leftOperand);
    operationInstance.set("rightOperand", rightOperand);
    operationInstance.set("operator", operatorInstance);
    operationContainerInstance.add("operations", operationInstance);
  }
  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);
    }
  }