Ejemplo n.º 1
0
 /** @generated NOT */
 private void createElement(dataMapper.diagram.tree.model.Element element, TreeNode treeNode) {
   Element ele = DataMapperFactory.eINSTANCE.createElement();
   // ele.setName(element.getCount() + "," + element.getName());
   ele.setName(element.getName());
   ele.setLevel(element.getCount());
   if (element.getSchemaType() != null) {
     switch (element.getSchemaType()) {
       case ARRAY:
         ele.setSchemaDataType(SchemaDataType.ARRAY);
         break;
       case BOOLEAN:
         ele.setSchemaDataType(SchemaDataType.BOOLEAN);
         break;
       case BYTES:
         ele.setSchemaDataType(SchemaDataType.BYTES);
         break;
       case DOUBLE:
         ele.setSchemaDataType(SchemaDataType.DOUBLE);
         break;
       case ENUM:
         ele.setSchemaDataType(SchemaDataType.ENUM);
         break;
       case FIXED:
         ele.setSchemaDataType(SchemaDataType.FIXED);
         break;
       case FLOAT:
         ele.setSchemaDataType(SchemaDataType.FLOAT);
         break;
       case INT:
         ele.setSchemaDataType(SchemaDataType.INT);
         break;
       case LONG:
         ele.setSchemaDataType(SchemaDataType.LONG);
         break;
       case MAP:
         ele.setSchemaDataType(SchemaDataType.MAP);
         break;
       case NULL:
         ele.setSchemaDataType(SchemaDataType.NULL);
         break;
       case RECORD:
         ele.setSchemaDataType(SchemaDataType.RECORD);
         break;
       case STRING:
         ele.setSchemaDataType(SchemaDataType.STRING);
         break;
       case UNION:
         ele.setSchemaDataType(SchemaDataType.UNION);
         break;
       default:
         break;
     }
   }
   treeNode.getElement().add(ele);
   if (!(element.getAttribute().isEmpty())) {
     for (dataMapper.diagram.tree.model.Attribute attribute : element.getAttribute()) {
       createAttribute(attribute, treeNode);
     }
   }
 }
Ejemplo n.º 2
0
  /** @generated NOT */
  private void createTree(Tree treeN, TreeNode treeNode) {
    TreeNode treeNodeNew = DataMapperFactory.eINSTANCE.createTreeNode();
    // treeNodeNew.setName(treeN.getCount() + "," + treeN.getName());
    treeNodeNew.setName(treeN.getName());
    treeNodeNew.setLevel(treeN.getCount());
    if (treeN.getSchemaType() != null) {
      switch (treeN.getSchemaType()) {
        case ARRAY:
          treeNodeNew.setSchemaDataType(SchemaDataType.ARRAY);
          break;
        case BOOLEAN:
          treeNodeNew.setSchemaDataType(SchemaDataType.BOOLEAN);
          break;
        case BYTES:
          treeNodeNew.setSchemaDataType(SchemaDataType.BYTES);
          break;
        case DOUBLE:
          treeNodeNew.setSchemaDataType(SchemaDataType.DOUBLE);
          break;
        case ENUM:
          treeNodeNew.setSchemaDataType(SchemaDataType.ENUM);
          break;
        case FIXED:
          treeNodeNew.setSchemaDataType(SchemaDataType.FIXED);
          break;
        case FLOAT:
          treeNodeNew.setSchemaDataType(SchemaDataType.FLOAT);
          break;
        case INT:
          treeNodeNew.setSchemaDataType(SchemaDataType.INT);
          break;
        case LONG:
          treeNodeNew.setSchemaDataType(SchemaDataType.LONG);
          break;
        case MAP:
          treeNodeNew.setSchemaDataType(SchemaDataType.MAP);
          break;
        case NULL:
          treeNodeNew.setSchemaDataType(SchemaDataType.NULL);
          break;
        case RECORD:
          treeNodeNew.setSchemaDataType(SchemaDataType.RECORD);
          break;
        case STRING:
          treeNodeNew.setSchemaDataType(SchemaDataType.STRING);
          break;
        case UNION:
          treeNodeNew.setSchemaDataType(SchemaDataType.UNION);
          break;
        default:
          break;
      }
    }
    treeNode.getNode().add(treeNodeNew);

    if (!(treeN.getTrees().isEmpty())) {
      for (Tree treeNew : treeN.getTrees()) {
        createTree(treeNew, treeNodeNew);
      }
    }

    if (!(treeN.getElements().isEmpty())) {
      for (dataMapper.diagram.tree.model.Element element : treeN.getElements()) {
        createElement(element, treeNodeNew);
      }
    }
    if (!(treeN.getAttributes().isEmpty())) {
      for (dataMapper.diagram.tree.model.Attribute attribute : treeN.getAttributes()) {
        createAttribute(attribute, treeNodeNew);
      }
    }
  }
Ejemplo n.º 3
0
 /** @generated NOT */
 private void createAttribute(
     dataMapper.diagram.tree.model.Attribute attribute, TreeNode treeNode) {
   Attribute attr = DataMapperFactory.eINSTANCE.createAttribute();
   attr.setName(attribute.getCount() + "," + attribute.getName());
   treeNode.getAttribute().add(attr);
 }