/**
   * @param instance the actual instance
   * @param qNameOfTheInstance the qname of the instance
   * @param headerRow property names
   * @param row actual map with data
   * @param propertyPath the path, e.g. att1.att2.value, points at the actual instance name/path
   */
  private void iterateBuild(
      Group instance,
      QName qNameOfTheInstance,
      List<String> headerRow,
      Map<String, Object> row,
      String propertyPath) {

    if (shouldBeDisplayed(instance)) {
      // check if the actual instance has a value an add it
      checkValue(instance, headerRow, row, propertyPath);
    }
    // children properties of current instance
    Iterable<QName> children = instance.getPropertyNames();

    for (QName qname : children) {
      if (instance.getProperty(qname).length > 0) {
        // only the first instance
        Object child = instance.getProperty(qname)[0];
        if (child instanceof Group && shouldBeDisplayed(child)) {
          iterateBuild(
              (Group) instance.getProperty(qname)[0],
              qname,
              headerRow,
              row,
              propertyPath + "." + qname.getLocalPart());
        } else if (child instanceof Group) {
          // the child is a choice or packege, etc.
          iterateBuild((Group) instance.getProperty(qname)[0], qname, headerRow, row, propertyPath);
        } else {
          // child is an attribute
          addProperty(headerRow, row, child, propertyPath + "." + qname.getLocalPart());
        }
      }
    }
  }
Ejemplo n.º 2
0
  /**
   * Copy constructor. Creates a group based on the properties and values of the given group.
   *
   * @param org the instance to copy
   */
  public OGroup(Group org) {
    this(org.getDefinition());

    for (QName property : org.getPropertyNames()) {
      setProperty(property, org.getProperty(property).clone());
    }
  }