Exemplo n.º 1
0
  private void buildCapabilityList() {

    capabilityList = new ArrayList<ExtendedCapability>();
    // System.out.println("Selected Resource: " + resourceIndex);

    ExtendedRegistry tempExtendedRegistry = this.extendedRegistryList.get(resourceIndex);
    Resource tempResource = tempExtendedRegistry.getResource();

    XmlObject tempObject = tempResource.copy();
    XmlObject xmlObjectCapabilityChild[] = tempObject.selectChildren(new QName("", "capability"));

    Capability capabilityTemp = null;
    ExtendedCapability extendedCapabilityTemp = null;

    for (int j = 0; j < xmlObjectCapabilityChild.length; j++) {
      try {
        capabilityTemp = Capability.Factory.parse(xmlObjectCapabilityChild[j].xmlText());

        extendedCapabilityTemp = new ExtendedCapability(j, capabilityTemp);
      } catch (XmlException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

      capabilityList.add(extendedCapabilityTemp);
    }
  }
Exemplo n.º 2
0
 public void setResourceIndex(int resourceIndex) {
   System.out.println("Selected Resource: " + resourceIndex);
   selectedExtendedRegistry = extendedRegistryList.get(resourceIndex);
   System.out.println(selectedExtendedRegistry.getResource().getTitle());
   this.resourceIndex = resourceIndex;
 }
Exemplo n.º 3
0
  private void buildTableNameList() {
    databaseNode = new TreeNodeImpl();

    TreeNodeImpl tableNode;

    tableList = new ArrayList<XmlObject>();
    columnList = new ArrayList<XmlObject>();

    tableNamesList = new ArrayList<String>();

    ExtendedRegistry tempExtendedRegistry = this.extendedRegistryList.get(resourceIndex);
    Resource tempResource = tempExtendedRegistry.getResource();
    XmlObject tempObject = tempResource.copy();

    XmlObject xmlObjectTableChild[] = tempObject.selectChildren(new QName("", "table"));

    // System.out.println("Table: " + xmlObjectTableChild.length);
    for (int tableIndex = 0; tableIndex < xmlObjectTableChild.length; tableIndex++) {
      tableNode = new TreeNodeImpl();
      XmlObject xmlObjectTableName[] =
          xmlObjectTableChild[tableIndex].selectChildren(new QName("", "name"));

      tableList.add(xmlObjectTableChild[tableIndex]);

      String tableXML = xmlObjectTableName[0].xmlText();
      int indexGreaterThan = tableXML.indexOf(">") + 1;
      int indexSecondLessThan = tableXML.indexOf("</");
      String tableName = tableXML.substring(indexGreaterThan, indexSecondLessThan);

      XmlObject xmlObjectColumnChild[] =
          xmlObjectTableChild[tableIndex].selectChildren(new QName("", "column"));
      for (int columnIndex = 0; columnIndex < xmlObjectColumnChild.length; columnIndex++) {

        XmlObject xmlObjectColumnName[] =
            xmlObjectColumnChild[columnIndex].selectChildren(new QName("", "name"));

        XmlObject xmlObjectColumnType[] =
            xmlObjectColumnChild[columnIndex].selectChildren(new QName("", "dataType"));
        columnList.add(xmlObjectColumnChild[columnIndex]);

        String columnXML = xmlObjectColumnName[0].xmlText();
        indexGreaterThan = columnXML.indexOf(">") + 1;
        indexSecondLessThan = columnXML.indexOf("</");
        String columnName = columnXML.substring(indexGreaterThan, indexSecondLessThan);
        if (xmlObjectColumnType.length > 0) {
          String columnTypeXML = xmlObjectColumnType[0].xmlText();
          indexGreaterThan = columnTypeXML.indexOf(">") + 1;
          indexSecondLessThan = columnTypeXML.indexOf("</");
          String columnType = columnTypeXML.substring(indexGreaterThan, indexSecondLessThan);

          TreeNodeImpl columnNode = new TreeNodeImpl();

          columnNode.setData(columnName + ": " + columnType);
          tableNode.addChild(columnIndex, columnNode); /* */
        }
      }

      tableNamesList.add(tableName);
      tableNode.setData(tableName);
      databaseNode.addChild(tableIndex, tableNode);
    }
  }