コード例 #1
0
 /**
  * config generation in operator chaining is partial. This method provide partial config for
  * complete ful assignment.
  *
  * @param operatorInput element map from input schema tree
  * @return partial of config
  */
 private String createSubAssignment(Element operatorInput) {
   StringBuilder builder = new StringBuilder();
   builder
       .append(" = ")
       .append(operatorInput.getFieldParent().getName())
       .append(".")
       .append(operatorInput.getName())
       .append(getOperatorFunction());
   return builder.toString();
 }
コード例 #2
0
  /**
   * config generation for 'element -- operator -- element' mapping scenario stright forwerd and
   * this method provide assignment for this operator
   *
   * @param operator this operator
   * @param inputElement element map from input schema tree
   * @return assignment statement for map
   */
  private AssignmentStatement getSimpleOperatorMapping(Operator operator, Element inputElement) {

    Element outputElement = getOutputElement(operator);
    TreeNode outputParent = getOutputElementParent(operator);

    String index = "";
    if (inputElement.getFieldParent().getSchemaDataType().equals(SchemaDataType.ARRAY))
      index = getIndex();

    StringBuilder builder = new StringBuilder();
    builder
        .append(getTreeHierarchy(outputElement.getFieldParent(), outputParent))
        .append(".")
        .append(outputElement.getName())
        .append(" = ")
        .append(inputElement.getFieldParent().getName())
        .append(index)
        .append(".")
        .append(inputElement.getName())
        .append(getOperatorFunction())
        .append(";");
    AssignmentStatement statement = new AssignmentStatement();
    statement.setStatement(builder.toString());
    return statement;
  }
コード例 #3
0
  @Override
  public String trasnform(String subStatement, Operator previousOperator, Operator operator) {
    EObject operatorOutput = getOutputObject(operator);

    StringBuilder builder = new StringBuilder();
    builder.append(subStatement);
    if (operatorOutput instanceof Element) {
      // fill the blank
      Element outputElement = (Element) operatorOutput;
      builder.insert(0, outputElement.getFieldParent().getName() + "." + outputElement.getName());
      builder.append(getOperatorFunction()).append(";");
      return builder.toString();
    } else if (operatorOutput instanceof OperatorLeftConnector) {
      Operator nextOperator = (Operator) getOperator(operatorOutput);
      builder.append(getOperatorFunction());

      OperatorsTransformer transformer =
          DataMapperTransformerRegistry.getInstance().getTransformer(nextOperator);
      String assign = transformer.trasnform(builder.toString(), operator, nextOperator);

      return assign;
    }
    return null;
  }