public XMLDescriptor addEmployeeDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.setDefaultRootElement("employee");

    XMLCompositeObjectMapping addr = new XMLCompositeObjectMapping();
    addr.setAttributeName("address");
    addr.setXPath("address");
    addr.setReferenceClass(Address.class);
    descriptor.addMapping(addr);

    XMLCompositeCollectionMapping phone = new XMLCompositeCollectionMapping();
    phone.setAttributeName("phoneNumbers");
    phone.setXPath("phone-number");
    phone.setReferenceClass(PhoneNumber.class);
    phone.useCollectionClass(ArrayList.class);
    descriptor.addMapping(phone);

    XMLAnyObjectMapping object = new XMLAnyObjectMapping();
    object.setAttributeName("anyObject");
    object.setXPath("any-object");
    descriptor.addMapping(object);

    XMLAnyCollectionMapping anyCollection = new XMLAnyCollectionMapping();
    anyCollection.setAttributeName("anyCollection");
    anyCollection.setXPath("any-collection");
    anyCollection.useCollectionClass(ArrayList.class);
    descriptor.addMapping(anyCollection);

    this.addDescriptor(descriptor);
    return descriptor;
  }
  protected ClassDescriptor buildDocumentPreservationPolicyConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(DocumentPreservationPolicyConfig.class);
    descriptor.setDefaultRootElement("document-preservation-policy");

    XMLCompositeObjectMapping nodeOrderingPolicyMapping = new XMLCompositeObjectMapping();
    nodeOrderingPolicyMapping.setReferenceClass(NodeOrderingPolicyConfig.class);
    nodeOrderingPolicyMapping.setAttributeName("m_nodeOrderingPolicy");
    nodeOrderingPolicyMapping.setGetMethodName("getNodeOrderingPolicy");
    nodeOrderingPolicyMapping.setSetMethodName("setNodeOrderingPolicy");
    nodeOrderingPolicyMapping.setXPath("node-ordering-policy");
    descriptor.addMapping(nodeOrderingPolicyMapping);

    descriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type"));
    descriptor
        .getInheritancePolicy()
        .addClassIndicator(
            DescriptorLevelDocumentPreservationPolicyConfig.class,
            "descriptor-level-document-preservation-policy");
    descriptor
        .getInheritancePolicy()
        .addClassIndicator(
            NoDocumentPreservationPolicyConfig.class, "no-document-preservation-policy");
    descriptor
        .getInheritancePolicy()
        .addClassIndicator(XMLBinderPolicyConfig.class, "xml-binder-policy");

    return descriptor;
  }
 private XMLDescriptor getAddressDescriptor() {
   XMLDescriptor descriptor = new XMLDescriptor();
   descriptor.setJavaClass(Address.class);
   descriptor.addPrimaryKeyFieldName("@aid");
   descriptor.setDefaultRootElement("address");
   // create id mapping
   XMLDirectMapping idMapping = new XMLDirectMapping();
   idMapping.setAttributeName("id");
   idMapping.setXPath("@aid");
   descriptor.addMapping(idMapping);
   // create street mapping
   XMLDirectMapping streetMapping = new XMLDirectMapping();
   streetMapping.setAttributeName("street");
   streetMapping.setXPath("street/text()");
   descriptor.addMapping(streetMapping);
   // create city mapping
   XMLDirectMapping cityMapping = new XMLDirectMapping();
   cityMapping.setAttributeName("city");
   cityMapping.setXPath("city/text()");
   descriptor.addMapping(cityMapping);
   // create country mapping
   XMLDirectMapping countryMapping = new XMLDirectMapping();
   countryMapping.setAttributeName("country");
   countryMapping.setXPath("country/text()");
   descriptor.addMapping(countryMapping);
   // create zip mapping
   XMLDirectMapping zipMapping = new XMLDirectMapping();
   zipMapping.setAttributeName("zip");
   zipMapping.setXPath("zip/text()");
   descriptor.addMapping(zipMapping);
   return descriptor;
 }
 private XMLDescriptor getEmployeeDescriptor() {
   XMLDescriptor descriptor = new XMLDescriptor();
   descriptor.setJavaClass(Employee.class);
   descriptor.setDefaultRootElement("employee");
   // create id mapping
   XMLDirectMapping idMapping = new XMLDirectMapping();
   idMapping.setAttributeName("id");
   idMapping.setXPath("@id");
   descriptor.addMapping(idMapping);
   // create name mapping
   XMLDirectMapping nameMapping = new XMLDirectMapping();
   nameMapping.setAttributeName("name");
   nameMapping.setXPath("name/text()");
   descriptor.addMapping(nameMapping);
   // create address mapping
   XMLCollectionReferenceMapping addressMapping = new XMLCollectionReferenceMapping();
   addressMapping.useCollectionClass(ArrayList.class);
   addressMapping.setUsesSingleNode(true);
   addressMapping.setAttributeName("addresses");
   addressMapping.setXPath("grouping-element");
   addressMapping.setReferenceClass(Address.class);
   addressMapping.addSourceToTargetKeyFieldAssociation("address/id-city/text()", "city/text()");
   addressMapping.addSourceToTargetKeyFieldAssociation("address/id-zip/text()", "zip/text()");
   descriptor.addMapping(addressMapping);
   return descriptor;
 }
 @Override
 public void handleSqlTableType(String tableTypeName, String targetTypeName) {
   // trim-off dotted-prefix, toLowerCase
   String tableTypeNameAlias = trimDotPrefix(tableTypeName).toLowerCase();
   String userType = nct.generateSchemaAlias(tableTypeNameAlias);
   XMLDescriptor xdesc = descriptorMap.get(tableTypeNameAlias);
   if (xdesc == null) {
     xdesc = new XMLDescriptor();
     xdesc.setAlias(tableTypeNameAlias);
     xdesc.setJavaClassName(
         packageName.toLowerCase() + "." + tableTypeNameAlias + COLLECTION_WRAPPER_SUFFIX);
     xdesc.getQueryManager();
     XMLSchemaURLReference schemaReference = new XMLSchemaURLReference();
     schemaReference.setSchemaContext("/" + userType);
     schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
     xdesc.setSchemaReference(schemaReference);
     NamespaceResolver nr = new NamespaceResolver();
     nr.setDefaultNamespaceURI(targetNamespace);
     xdesc.setNamespaceResolver(nr);
     descriptorMap.put(tableTypeNameAlias, xdesc);
   }
   // before we push the new SqlArrayTypeHelper, check stac to see if we are part
   // of nested chain of object types
   if (!stac.isEmpty()) {
     ListenerHelper listenerHelper = stac.peek();
     if (listenerHelper.isReturnArg()) {
       xdesc.setDefaultRootElement(userType);
     }
   }
   stac.push(new SqlArrayTypeHelper(tableTypeNameAlias, targetTypeName));
 }
  public void addEmployeeDescriptor(boolean methodAccess) {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.setDefaultRootElement("employee");

    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");
    descriptor.addMapping(idMapping);

    XMLDirectMapping firstNameMapping = new XMLDirectMapping();
    firstNameMapping.setAttributeName("firstName");
    firstNameMapping.setXPath("first-name/text()");
    descriptor.addMapping(firstNameMapping);

    XMLDirectMapping lastNameMapping = new XMLDirectMapping();
    lastNameMapping.setAttributeName("lastName");
    lastNameMapping.setXPath("last-name/text()");
    descriptor.addMapping(lastNameMapping);

    XMLCompositeObjectMapping addressMapping = new XMLCompositeObjectMapping();
    addressMapping.setAttributeName("address");
    addressMapping.setReferenceClass(Address.class);
    addressMapping.setXPath("address");
    descriptor.addMapping(addressMapping);

    XMLCompositeCollectionMapping phoneMapping = new XMLCompositeCollectionMapping();
    phoneMapping.setAttributeName("phoneNumbers");
    phoneMapping.setReferenceClass(PhoneNumber.class);
    phoneMapping.setXPath("phone-numbers/number");
    phoneMapping.setContainerPolicy(ContainerPolicy.buildPolicyFor(ArrayList.class));
    descriptor.addMapping(phoneMapping);
    this.addDescriptor(descriptor);
  }
  protected XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor descriptor = super.getEmployeeDescriptor();
    descriptor.setDefaultRootElement("thens:employee");

    NamespaceResolver resolver = new NamespaceResolver();
    resolver.put("thensdiff", "www.example.com/some-dir/employee.xsd");
    descriptor.setNamespaceResolver(resolver);

    return descriptor;
  }
  public void addPhoneNumberDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(PhoneNumber.class);
    descriptor.setDefaultRootElement("phone-number");

    XMLDirectMapping num = new XMLDirectMapping();
    num.setAttributeName("number");
    num.setXPath("text()");
    descriptor.addMapping(num);

    this.addDescriptor(descriptor);
  }
 protected ClassDescriptor buildAddressDescriptor() {
   XMLDescriptor descriptor = new XMLDescriptor();
   descriptor.setJavaClass(Address.class);
   descriptor.setDefaultRootElement("address");
   XMLDirectMapping mapping = new XMLDirectMapping();
   mapping.setAttributeName("address_content");
   mapping.setGetMethodName("getContent");
   mapping.setSetMethodName("setContent");
   mapping.setXPath("text()");
   descriptor.addMapping(mapping);
   return descriptor;
 }
  public XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Employee.class);
    xmlDescriptor.setDefaultRootElement("employee");

    XMLCompositeObjectMapping addressMapping = new XMLCompositeObjectMapping();
    addressMapping.setReferenceClass(Address.class);
    addressMapping.setAttributeName("address");
    addressMapping.setXPath(".");
    xmlDescriptor.addMapping(addressMapping);

    return xmlDescriptor;
  }
Exemplo n.º 11
0
  public XMLDescriptor addAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Address.class);
    descriptor.setDefaultRootElement("address");

    XMLDirectMapping street = new XMLDirectMapping();
    street.setAttributeName("street");
    street.setXPath("street/text()");
    descriptor.addMapping(street);

    this.addDescriptor(descriptor);
    return descriptor;
  }
  public ClassDescriptor buildRootDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(AnyCollectionRoot.class);
    descriptor.setDefaultRootElement("root");

    XMLAnyCollectionMapping mapping = new XMLAnyCollectionMapping();
    mapping.setAttributeName("any");
    mapping.setGetMethodName("getAny");
    mapping.setSetMethodName("setAny");
    descriptor.addMapping(mapping);

    return descriptor;
  }
  public ClassDescriptor buildRootDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Root.class);
    descriptor.setDefaultRootElement("root");

    XMLAnyCollectionMapping mapping = new XMLAnyCollectionMapping();
    mapping.setAttributeName("any");
    mapping.setGetMethodName("getAny");
    mapping.setSetMethodName("setAny");
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
    descriptor.addMapping(mapping);

    return descriptor;
  }
  public void addEmployeeDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.setDefaultRootElement("employee");

    XMLCompositeObjectMapping addr = new XMLCompositeObjectMapping();
    addr.setAttributeName("primaryAddress");
    addr.setXPath("primary-address");
    addr.setReferenceClass(Address.class);
    addr.readOnly();
    descriptor.addMapping(addr);

    this.addDescriptor(descriptor);
  }
  public ClassDescriptor buildChildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(AnyCollectionChild.class);
    descriptor.setDefaultRootElement("child");
    descriptor.addRootElement("someChild");

    XMLDirectMapping mapping = new XMLDirectMapping();
    mapping.setAttributeName("content");
    mapping.setGetMethodName("getContent");
    mapping.setSetMethodName("setContent");
    mapping.setXPath("text()");
    descriptor.addMapping(mapping);

    return descriptor;
  }
  public void addEmployeeDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.setDefaultRootElement("employee");

    XMLCompositeCollectionMapping addr = new XMLCompositeCollectionMapping();
    addr.setAttributeName("otherAddresses");
    addr.setXPath("addresses/address");
    addr.setReferenceClass(Address.class);
    addr.getContainerPolicy().setContainerClass(Vector.class);
    addr.readOnly();
    descriptor.addMapping(addr);

    this.addDescriptor(descriptor);
  }
Exemplo n.º 17
0
  private XMLDescriptor getCustomerDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Customer.class);
    xmlDescriptor.setDefaultRootElement("ns:customer");

    NamespaceResolver nsResolver = new NamespaceResolver();
    nsResolver.put("ns", "urn:example");
    xmlDescriptor.setNamespaceResolver(nsResolver);

    XMLCompositeObjectMapping addressMapping = new XMLCompositeObjectMapping();
    addressMapping.setAttributeName("address");
    addressMapping.setXPath("//ns:customer/ns:phone-number/preceding-sibling::*[1]");
    addressMapping.setReferenceClass(Address.class);
    xmlDescriptor.addMapping(addressMapping);

    return xmlDescriptor;
  }
  public ClassDescriptor buildWrapperDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Wrapper.class);
    descriptor.setDefaultRootElement("myns:wrapper");

    XMLCompositeObjectMapping mapping = new XMLCompositeObjectMapping();
    mapping.setReferenceClass(Root.class);
    mapping.setAttributeName("theRoot");
    mapping.setXPath("myns:root");
    descriptor.addMapping(mapping);

    NamespaceResolver nr = new NamespaceResolver();
    nr.put("myns", "www.example.com/some-dir/some.xsd");
    nr.put("ns0", "www.example.com/test.xsd");
    descriptor.setNamespaceResolver(nr);

    return descriptor;
  }
 private XMLDescriptor getRootDescriptor() {
   XMLDescriptor descriptor = new XMLDescriptor();
   descriptor.setJavaClass(Root.class);
   descriptor.setDefaultRootElement("root");
   // create employee mapping
   XMLCompositeObjectMapping empMapping = new XMLCompositeObjectMapping();
   empMapping.setAttributeName("employee");
   empMapping.setXPath("employee");
   empMapping.setReferenceClass(Employee.class);
   descriptor.addMapping(empMapping);
   // create address mapping
   XMLCompositeCollectionMapping addMapping = new XMLCompositeCollectionMapping();
   addMapping.setAttributeName("addresses");
   addMapping.setXPath("address");
   addMapping.setReferenceClass(Address.class);
   descriptor.addMapping(addMapping);
   return descriptor;
 }
  public ClassDescriptor buildRootDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Root.class);
    descriptor.setDefaultRootElement("myns:root");

    XMLAnyAttributeMapping mapping = new XMLAnyAttributeMapping();
    mapping.setAttributeName("any");
    mapping.setGetMethodName("getAny");
    mapping.setSetMethodName("setAny");
    descriptor.addMapping(mapping);

    NamespaceResolver nr = new NamespaceResolver();
    nr.put("myns", "www.example.com/some-dir/some.xsd");
    // nr.put("", "www.example.com/some-other-dir/some.xsd");
    descriptor.setNamespaceResolver(nr);

    return descriptor;
  }
  private XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.setDefaultRootElement("employee");

    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");
    descriptor.addMapping(idMapping);

    XMLCompositeCollectionMapping emailMapping = new XMLCompositeCollectionMapping();
    emailMapping.setAttributeName("emailAddresses");
    emailMapping.setReferenceClass(EmailAddress.class);
    emailMapping.setXPath("email-addresses/email-address");
    emailMapping.setReuseContainer(true);
    descriptor.addMapping(emailMapping);

    return descriptor;
  }
  private XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.setDefaultRootElement("employee");

    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");
    descriptor.addMapping(idMapping);

    XMLField field = new XMLField("photo");
    field.setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);

    XMLBinaryDataMapping photoMapping = new XMLBinaryDataMapping();
    photoMapping.setAttributeName("photo");
    photoMapping.setField(field);
    descriptor.addMapping(photoMapping);

    return descriptor;
  }
  private XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.setDefaultRootElement("employee");

    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");
    descriptor.addMapping(idMapping);

    XMLCompositeDirectCollectionMapping responsibilitiesMapping =
        new XMLCompositeDirectCollectionMapping();
    responsibilitiesMapping.setAttributeName("responsibilities");
    ObjectTypeConverter objectTypeConverter = new ObjectTypeConverter(responsibilitiesMapping);
    objectTypeConverter.addConversionValue("A", "Cut the grass");
    objectTypeConverter.addConversionValue("B", "Wash the dishes");
    responsibilitiesMapping.setValueConverter(objectTypeConverter);
    responsibilitiesMapping.setXPath("responsibilities/list/responsibility/text()");
    descriptor.addMapping(responsibilitiesMapping);

    return descriptor;
  }
  private XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Employee.class);
    xmlDescriptor.setDefaultRootElement("DEFAULT:employee");

    NamespaceResolver nsResolver = new NamespaceResolver();
    nsResolver.put("DEFAULT", "http://www.example.com/EMPLOYEE");
    xmlDescriptor.setNamespaceResolver(nsResolver);

    // Unqualified attributes are in the null namespace
    // rather than the default namespace
    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("DEFAULT:personal-info/@id");
    xmlDescriptor.addMapping(idMapping);

    XMLDirectMapping nameMapping = new XMLDirectMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setXPath("DEFAULT:personal-info/DEFAULT:name/text()");
    xmlDescriptor.addMapping(nameMapping);

    return xmlDescriptor;
  }
Exemplo n.º 25
0
  private XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(
        org.eclipse.persistence.testing.oxm.mappings.transformation.Employee.class);
    xmlDescriptor.setDefaultRootElement("ns:root");

    XMLSchemaURLReference schemaReference = new XMLSchemaURLReference();
    URL url = ClassLoader.getSystemResource(XML_SCHEMA_RESOURCE);
    schemaReference.setURL(url);
    xmlDescriptor.setSchemaReference(schemaReference);

    NamespaceResolver nsResolver = new NamespaceResolver();
    nsResolver.put("ns", "ElemDecl/maxOccurs");
    nsResolver.put("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    xmlDescriptor.setNamespaceResolver(nsResolver);

    XMLDirectMapping nameMapping = new XMLDirectMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setXPath("ns:Local");
    xmlDescriptor.addMapping(nameMapping);

    return xmlDescriptor;
  }
 @Override
 public void handleObjectType(String objectTypeName, String targetTypeName, int numAttributes) {
   // JDBC Advanced type?
   if (numAttributes > 0) {
     // trim-off dotted-prefix, toLowerCase
     String objectTypeNameAlias = trimDotPrefix(objectTypeName).toLowerCase();
     XMLDescriptor xdesc = descriptorMap.get(objectTypeNameAlias);
     String userType = nct.generateSchemaAlias(objectTypeNameAlias);
     if (xdesc == null) {
       xdesc = new XMLDescriptor();
       xdesc.setAlias(objectTypeNameAlias);
       xdesc.setJavaClassName(packageName.toLowerCase() + "." + objectTypeNameAlias);
       xdesc.getQueryManager();
       XMLSchemaURLReference schemaReference = new XMLSchemaURLReference();
       schemaReference.setSchemaContext("/" + userType);
       schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
       xdesc.setSchemaReference(schemaReference);
       NamespaceResolver nr = new NamespaceResolver();
       nr.setDefaultNamespaceURI(targetNamespace);
       xdesc.setNamespaceResolver(nr);
       descriptorMap.put(objectTypeNameAlias, xdesc);
     }
     // before we push the new ObjectTypeHelper, check stac to see if we are part
     // of nested chain of object types
     if (!stac.isEmpty()) {
       ListenerHelper listenerHelper = stac.peek();
       if (listenerHelper.isAttribute()) {
         AttributeFieldHelper fieldHelper = (AttributeFieldHelper) stac.pop();
         fieldHelper.setSqlTypeName(objectTypeNameAlias);
         String fieldName = fieldHelper.attributeFieldName();
         String attributeName = fieldName.toLowerCase();
         ListenerHelper listenerHelper2 = stac.peek();
         if (listenerHelper2.isObject()) {
           ObjectTypeHelper objectTypeHelper2 = (ObjectTypeHelper) listenerHelper2;
           String objectTypeNameAlias2 = objectTypeHelper2.objectTypename();
           XMLDescriptor xdesc2 = descriptorMap.get(objectTypeNameAlias2);
           if (xdesc2 != null) {
             DatabaseMapping dm = xdesc2.getMappingForAttributeName(attributeName);
             if (dm == null) {
               XMLCompositeObjectMapping compMapping = new XMLCompositeObjectMapping();
               compMapping.setAttributeName(attributeName);
               compMapping.setReferenceClassName(xdesc.getJavaClassName());
               compMapping.setXPath(attributeName);
               XMLField xField = (XMLField) compMapping.getField();
               xField.setRequired(true);
               xdesc2.addMapping(compMapping);
             }
             // last attribute, pop ObjectTypeHelper off stack
             int numAttributes2 = objectTypeHelper2.decrNumAttributes();
             if (numAttributes2 == 0) {
               stac.pop();
             }
           }
         }
       } else if (listenerHelper.isArray()) {
         SqlArrayTypeHelper sqlArrayTypeHelper = (SqlArrayTypeHelper) stac.pop();
         String sqlArrayTypeAlias = sqlArrayTypeHelper.arrayTypename();
         XMLDescriptor xdesc2 = descriptorMap.get(sqlArrayTypeAlias);
         if (xdesc2 != null) {
           boolean itemsMappingFound =
               xdesc2.getMappingForAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME) == null
                   ? false
                   : true;
           if (!itemsMappingFound) {
             XMLCompositeCollectionMapping itemsMapping = new XMLCompositeCollectionMapping();
             itemsMapping.setAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME);
             itemsMapping.setXPath(ITEM_MAPPING_NAME);
             itemsMapping.useCollectionClassName("java.util.ArrayList");
             itemsMapping.setReferenceClassName(xdesc.getJavaClassName());
             xdesc2.addMapping(itemsMapping);
           }
         }
       } else if (listenerHelper.isReturnArg()) {
         // ReturnArgHelper returnArgHelper = (ReturnArgHelper)stac.pop();
         stac.pop();
         xdesc.setDefaultRootElement(userType);
       }
     }
     stac.push(new ObjectTypeHelper(objectTypeNameAlias, targetTypeName, numAttributes));
   }
 }
 public ClassDescriptor buildSessionConfigsDescriptor() {
   XMLDescriptor descriptor = (XMLDescriptor) super.buildSessionConfigsDescriptor();
   descriptor.setDefaultRootElement("sessions");
   return descriptor;
 }
  protected ClassDescriptor buildRootDescriptor( //
      boolean firstMappingIsAnyCollection, //
      boolean firstMappingXPathSet, //
      boolean secondMappingIsAnyCollection, //
      boolean secondMappingXPathSet) { //
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Customer.class);
    descriptor.setDefaultRootElement("customer");

    DatabaseMapping anyMapping1 = null;

    // First Mapping
    if (!firstMappingIsAnyCollection) {
      anyMapping1 = new XMLAnyObjectMapping();
      ((XMLAnyObjectMapping) anyMapping1).setAttributeName("anyObject");

      // ((XMLAnyObjectMapping) anyMapping1).setGetMethodName("getAnyObject");
      // ((XMLAnyObjectMapping) anyMapping1).setSetMethodName("setAnyObject");
      if (firstMappingXPathSet) {
        // set first mapping XPath
        ((XMLAnyObjectMapping) anyMapping1).setXPath(MAPPING_XPATH_OBJ);
      }
      descriptor.addMapping((XMLAnyObjectMapping) anyMapping1);
    } else {
      anyMapping1 = new XMLAnyCollectionMapping();
      ((XMLAnyCollectionMapping) anyMapping1).setAttributeName("contactMethods");

      // ((XMLAnyCollectionMapping) anyMapping1).setGetMethodName("getAnyCollection");
      // ((XMLAnyCollectionMapping) anyMapping1).setSetMethodName("setAnyCollection");
      if (firstMappingXPathSet) {
        // set first mapping XPath
        ((XMLAnyCollectionMapping) anyMapping1).setXPath(MAPPING_XPATH);
      }
      descriptor.addMapping((XMLAnyCollectionMapping) anyMapping1);
    }

    // Second Mapping
    DatabaseMapping anyMapping2 = null;
    if (!secondMappingIsAnyCollection) {
      anyMapping2 = new XMLAnyObjectMapping();
      ((XMLAnyObjectMapping) anyMapping2).setAttributeName("anyObject");

      // ((XMLAnyObjectMapping) anyMapping2).setGetMethodName("getAnyObject");
      // ((XMLAnyObjectMapping) anyMapping2).setSetMethodName("setAnyObject");
      if (secondMappingXPathSet) {
        // set second mapping XPath
        ((XMLAnyObjectMapping) anyMapping2).setXPath(MAPPING_XPATH_OBJ);
      }
      descriptor.addMapping((XMLAnyObjectMapping) anyMapping2);
    } else {
      anyMapping2 = new XMLAnyCollectionMapping();
      ((XMLAnyCollectionMapping) anyMapping2).setAttributeName("contactMethods");

      // ((XMLAnyCollectionMapping) anyMapping2).setGetMethodName("getAnyCollection");
      // ((XMLAnyCollectionMapping) anyMapping2).setSetMethodName("setAnyCollection");
      if (secondMappingXPathSet) {
        // set second mapping XPath
        ((XMLAnyCollectionMapping) anyMapping2).setXPath(MAPPING_XPATH);
      }
      descriptor.addMapping((XMLAnyCollectionMapping) anyMapping2);
    }
    return descriptor;
  }