Пример #1
0
  public void padAttribute(PrintNode row, AttributePath attributePath, Adapter scda)
      throws Exception {
    for (int j = 0; j < attributes.size(); j++) {
      Attribute currentAttribute = (Attribute) attributes.get(j);
      int attributeLength = currentAttribute.name.length();

      if (currentAttribute.getClass() == DVA.class && attributePath.levelsOfIndirection() <= 0) {
        // If the attribute we want is found or we just want everything, output
        if (attributePath.attribute.equals("*")) {
          PrintCell cell = new PrintCell();
          cell.setOutput(String.format(""));
          row.addCell(cell);
        } else if (attributePath.attribute.equals(currentAttribute.name)) {
          PrintCell cell = new PrintCell();
          cell.setOutput(String.format(""));
          row.addCell(cell);
          return;
        }
      }
      if (currentAttribute.getClass() == EVA.class && attributePath.levelsOfIndirection() > 0) {
        String evaName = attributePath.getIndirection(attributePath.levelsOfIndirection() - 1);
        if (evaName.equals(currentAttribute.name)) {
          ClassDef targetClass = scda.getClass(((EVA) currentAttribute).baseClassName);
          attributePath.removeIndirection(attributePath.levelsOfIndirection() - 1);
          targetClass.padAttribute(row, attributePath, scda);
          attributePath.addIndirection(evaName);
          return;
        }
      }
    }

    if (!(attributePath.attribute.equals("*") && attributePath.levelsOfIndirection() <= 0)) {
      // If we got here and we weren't trying to output all the attributes, we didn't find the
      // requested attribute.

      if (this.getClass() == SubclassDef.class) {
        for (int i = 0; i < ((SubclassDef) this).numberOfSuperClasses(); i++) {
          ClassDef parentClass = scda.getClass(((SubclassDef) this).getSuperClass(i));
          parentClass.padAttribute(row, attributePath, scda);
        }
      } else {
        throw new NoSuchFieldException(
            "Attribute \"" + attributePath.attribute + "\" is not a valid DVA");
      }
    }
  }
Пример #2
0
 public WDBObject getInstance(int index, Adapter da) throws Exception {
   return da.getObject(this.name, (Integer) instances.get(index));
 }
Пример #3
0
 public void commit(Adapter scda) throws Exception {
   scda.putClass(this);
 }