Beispiel #1
0
  public SchemaItem getPropertyTypeSchema(
      SchemaElementComplex parentComplexProperty, EventAdapterService eventAdapterService) {
    Property lastProperty = null;
    SchemaElementComplex complexElement = parentComplexProperty;

    for (Iterator<Property> it = properties.iterator(); it.hasNext(); ) {
      Property property = it.next();
      lastProperty = property;

      if (it.hasNext()) {
        SchemaItem childSchemaItem =
            property.getPropertyTypeSchema(complexElement, eventAdapterService);
        if (childSchemaItem == null) {
          // if the property is not valid, return null
          return null;
        }

        if ((childSchemaItem instanceof SchemaItemAttribute)
            || (childSchemaItem instanceof SchemaElementSimple)) {
          return null;
        }

        complexElement = (SchemaElementComplex) childSchemaItem;
      }
    }

    return lastProperty.getPropertyTypeSchema(complexElement, eventAdapterService);
  }
Beispiel #2
0
  public EventPropertyGetter getGetterDOM(
      SchemaElementComplex parentComplexProperty,
      EventAdapterService eventAdapterService,
      BaseXMLEventType eventType,
      String propertyExpression) {
    List<EventPropertyGetter> getters = new LinkedList<EventPropertyGetter>();

    SchemaElementComplex complexElement = parentComplexProperty;

    for (Iterator<Property> it = properties.iterator(); it.hasNext(); ) {
      Property property = it.next();
      EventPropertyGetter getter =
          property.getGetterDOM(complexElement, eventAdapterService, eventType, propertyExpression);
      if (getter == null) {
        return null;
      }

      if (it.hasNext()) {
        SchemaItem childSchemaItem =
            property.getPropertyTypeSchema(complexElement, eventAdapterService);
        if (childSchemaItem == null) {
          // if the property is not valid, return null
          return null;
        }

        if ((childSchemaItem instanceof SchemaItemAttribute)
            || (childSchemaItem instanceof SchemaElementSimple)) {
          return null;
        }

        complexElement = (SchemaElementComplex) childSchemaItem;

        if (complexElement.isArray()) {
          if ((property instanceof SimpleProperty) || (property instanceof DynamicSimpleProperty)) {
            return null;
          }
        }
      }

      getters.add(getter);
    }

    return new DOMNestedPropertyGetter(
        getters, new FragmentFactoryDOMGetter(eventAdapterService, eventType, propertyExpression));
  }