public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWEisProjectDefaultsPolicy.class);
    descriptor.getInheritancePolicy().setParentClass(MWTransactionalProjectDefaultsPolicy.class);

    return descriptor;
  }
  protected ClassDescriptor buildXMLBinderPolicyConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(XMLBinderPolicyConfig.class);
    descriptor.getInheritancePolicy().setParentClass(DocumentPreservationPolicyConfig.class);

    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;
 }
  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;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(NullParticle.class);
    descriptor.getInheritancePolicy().setParentClass(AbstractParticle.class);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWEisReadAllQuery.class);
    descriptor.getInheritancePolicy().setParentClass(MWAbstractEisReadQuery.class);

    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;
 }
  public void addAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Address.class);

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

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

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

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

    this.addDescriptor(descriptor);
  }
  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);
  }
  public ClassDescriptor buildXMLBinaryDataCollectionMappingDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(XMLBinaryDataCollectionMapping.class);

    descriptor.getInheritancePolicy().setParentClass(XMLCompositeDirectCollectionMapping.class);

    XMLDirectMapping swaRefMapping = new XMLDirectMapping();
    swaRefMapping.setAttributeName("isSwaRef");
    swaRefMapping.setXPath(getPrimaryNamespaceXPath() + "is-swa-ref/text()");
    descriptor.addMapping(swaRefMapping);

    XMLDirectMapping mimeTypeMapping = new XMLDirectMapping();
    mimeTypeMapping.setAttributeName("mimeTypePolicy");
    mimeTypeMapping.setGetMethodName("getMimeType");
    mimeTypeMapping.setSetMethodName("setMimeType");
    mimeTypeMapping.setXPath(getPrimaryNamespaceXPath() + "mime-type/text()");
    descriptor.addMapping(mimeTypeMapping);

    XMLDirectMapping shouldInlineMapping = new XMLDirectMapping();
    shouldInlineMapping.setAttributeName("shouldInlineBinaryData");
    shouldInlineMapping.setXPath(getPrimaryNamespaceXPath() + "should-inline-data");
    descriptor.addMapping(shouldInlineMapping);

    return descriptor;
  }
  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 XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    // descriptor.setDefaultRootElement("employee");
    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setXPath("id/text()");
    idMapping.setAttributeName("id");
    descriptor.addMapping(idMapping);

    XMLCompositeObjectMapping emailMapping = new XMLCompositeObjectMapping();
    emailMapping.setAttributeName("emailAddress");
    emailMapping.setXPath("info/email-address");
    emailMapping.setGetMethodName("getEmailAddress");
    emailMapping.setSetMethodName("setEmailAddress");
    emailMapping.setReferenceClass(EmailAddress.class);
    descriptor.addMapping(emailMapping);

    URL schemaURL =
        ClassLoader.getSystemResource("org/eclipse/persistence/testing/oxm/jaxb/Employee.xsd");
    XMLSchemaURLReference schemaRef = new XMLSchemaURLReference(schemaURL);
    schemaRef.setType(XMLSchemaURLReference.COMPLEX_TYPE);
    schemaRef.setSchemaContext("employee-root");
    descriptor.setSchemaReference(schemaRef);

    /*
    NamespaceResolver try_test = new NamespaceResolver();
    try_test.put("xsi", XMLConstants.SCHEMA_INSTANCE_URL);
    descriptor.setNamespaceResolver(try_test);*/
    return descriptor;
  }
  protected ClassDescriptor buildRelativePositionOrderingPolicyConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(RelativePositionOrderingPolicyConfig.class);
    descriptor.getInheritancePolicy().setParentClass(NodeOrderingPolicyConfig.class);

    return descriptor;
  }
  protected ClassDescriptor buildIgnoreNewElementsOrderingPolicyConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(IgnoreNewElementsOrderingPolicyConfig.class);
    descriptor.getInheritancePolicy().setParentClass(NodeOrderingPolicyConfig.class);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWBatchReadItem.class);

    descriptor.getInheritancePolicy().setParentClass(MWAttributeItem.class);

    return descriptor;
  }
Esempio n. 16
0
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWDeleteQuery.class);
    descriptor.getDescriptorInheritancePolicy().setParentClass(MWAbstractCustomQuery.class);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWDirectToFieldMapping.class);
    descriptor.getInheritancePolicy().setParentClass(MWRelationalDirectMapping.class);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWProperty.class);

    descriptor.addDirectMapping("key", "key/text()");
    descriptor.addDirectMapping("value", "value/text()");

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWEJBQLQueryFormat.class);

    descriptor.getInheritancePolicy().setParentClass(MWStringQueryFormat.class);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWRelationalProjectDefaultsPolicy.class);
    descriptor.getInheritancePolicy().setParentClass(MWTransactionalProjectDefaultsPolicy.class);

    descriptor.addDirectMapping("queriesCacheAllStatements", "cache-all-statements/text()");
    descriptor.addDirectMapping("queriesBindAllParameters", "bind-all-parameters/text()");

    return descriptor;
  }
  public XMLDescriptor getAddressDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Address.class);

    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("street");
    idMapping.setXPath("@street");
    xmlDescriptor.addMapping(idMapping);

    return xmlDescriptor;
  }
  public void addPhoneNumberDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(PhoneNumber.class);

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

    this.addDescriptor(descriptor);
  }
  public void addAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Address.class);

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

    this.addDescriptor(descriptor);
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWContainerAccessor.class);

    InheritancePolicy ip = (InheritancePolicy) descriptor.getInheritancePolicy();
    ip.setClassIndicatorFieldName("@type");
    ip.addClassIndicator(MWAttributeContainerAccessor.class, "attribute-based");
    ip.addClassIndicator(MWMethodContainerAccessor.class, "method-based");

    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 static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(AbstractParticle.class);
    descriptor.getInheritancePolicy().setParentClass(AbstractSchemaComponent.class);

    ((XMLDirectMapping) descriptor.addDirectMapping("minOccurs", "min-occurs/text()"))
        .setNullValue(new Integer(1));
    ((XMLDirectMapping) descriptor.addDirectMapping("maxOccurs", "max-occurs/text()"))
        .setNullValue(new Integer(1));

    return descriptor;
  }
  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 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;
  }