use of org.eclipse.persistence.oxm.XMLField in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildInheritancePolicyDescriptor.
protected ClassDescriptor buildInheritancePolicyDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(InheritancePolicy.class);
descriptor.setDefaultRootElement("inheritance-policy");
descriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type"));
descriptor.getInheritancePolicy().addClassIndicator(InheritancePolicy.class, getPrimaryNamespaceXPath() + "inheritance-policy");
descriptor.getInheritancePolicy().addClassIndicator(QNameInheritancePolicy.class, getPrimaryNamespaceXPath() + "qname-inheritance-policy");
descriptor.getInheritancePolicy().addClassIndicator(String.class, "string");
XMLDirectMapping parentClassMapping = new XMLDirectMapping();
parentClassMapping.setAttributeName("parentClass");
parentClassMapping.setGetMethodName("getParentClass");
parentClassMapping.setSetMethodName("setParentClass");
parentClassMapping.setXPath(getSecondaryNamespaceXPath() + "parent-class/text()");
descriptor.addMapping(parentClassMapping);
XMLDirectMapping shouldReadSubclassesMapping = new XMLDirectMapping();
shouldReadSubclassesMapping.setAttributeName("shouldReadSubclasses");
shouldReadSubclassesMapping.setGetMethodName("shouldReadSubclassesValue");
shouldReadSubclassesMapping.setSetMethodName("setShouldReadSubclasses");
shouldReadSubclassesMapping.setXPath(getPrimaryNamespaceXPath() + "read-subclasses-on-queries/text()");
descriptor.addMapping(shouldReadSubclassesMapping);
XMLDirectMapping readAllSubclassesViewMapping = new XMLDirectMapping();
readAllSubclassesViewMapping.setAttributeName("readAllSubclassesView");
readAllSubclassesViewMapping.setGetMethodName("getReadAllSubclassesViewName");
readAllSubclassesViewMapping.setSetMethodName("setReadAllSubclassesViewName");
readAllSubclassesViewMapping.setXPath(getPrimaryNamespaceXPath() + "all-subclasses-view/text()");
descriptor.addMapping(readAllSubclassesViewMapping);
XMLDirectMapping shouldUseClassNameAsIndicatorMapping = new XMLDirectMapping();
shouldUseClassNameAsIndicatorMapping.setAttributeName("shouldUseClassNameAsIndicator");
shouldUseClassNameAsIndicatorMapping.setGetMethodName("shouldUseClassNameAsIndicator");
shouldUseClassNameAsIndicatorMapping.setSetMethodName("setShouldUseClassNameAsIndicator");
shouldUseClassNameAsIndicatorMapping.setXPath(getPrimaryNamespaceXPath() + "use-class-name-as-indicator/text()");
shouldUseClassNameAsIndicatorMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldUseClassNameAsIndicatorMapping);
XMLDirectMapping classExtractionMethodMapping = new XMLDirectMapping();
classExtractionMethodMapping.setAttributeName("classExtractionMethod");
classExtractionMethodMapping.setGetMethodName("getClassExtractionMethodName");
classExtractionMethodMapping.setSetMethodName("setClassExtractionMethodName");
classExtractionMethodMapping.setXPath(getPrimaryNamespaceXPath() + "class-extraction-method/text()");
descriptor.addMapping(classExtractionMethodMapping);
XMLCompositeObjectMapping classIndicatorFieldNameMapping = new XMLCompositeObjectMapping();
classIndicatorFieldNameMapping.setAttributeName("classIndicatorField");
classIndicatorFieldNameMapping.setReferenceClass(DatabaseField.class);
classIndicatorFieldNameMapping.setGetMethodName("getClassIndicatorField");
classIndicatorFieldNameMapping.setSetMethodName("setClassIndicatorField");
classIndicatorFieldNameMapping.setXPath(getPrimaryNamespaceXPath() + "class-indicator-field");
((XMLField) classIndicatorFieldNameMapping.getField()).setLeafElementType(fieldQname);
descriptor.addMapping(classIndicatorFieldNameMapping);
XMLCompositeCollectionMapping classIndicatorsMapping = new XMLCompositeCollectionMapping();
classIndicatorsMapping.setAttributeName("classIndicatorAssociations");
classIndicatorsMapping.setGetMethodName("getClassIndicatorAssociations");
classIndicatorsMapping.setSetMethodName("setClassIndicatorAssociations");
classIndicatorsMapping.setXPath(getPrimaryNamespaceXPath() + "class-indicator-mappings/" + getPrimaryNamespaceXPath() + "class-indicator-mapping");
classIndicatorsMapping.setReferenceClass(TypedAssociation.class);
descriptor.addMapping(classIndicatorsMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.XMLField in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildQueryKeyReferenceDescriptor.
protected ClassDescriptor buildQueryKeyReferenceDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(QueryKeyReference.class);
descriptor.setDefaultRootElement("query-key-reference");
XMLCompositeObjectMapping keyMapping = new XMLCompositeObjectMapping();
keyMapping.setAttributeName("key");
keyMapping.setGetMethodName("getKey");
keyMapping.setSetMethodName("setKey");
keyMapping.setReferenceClass(DatabaseField.class);
keyMapping.setXPath(getPrimaryNamespaceXPath() + "source-field");
((XMLField) keyMapping.getField()).setLeafElementType(fieldQname);
descriptor.addMapping(keyMapping);
XMLDirectMapping valueMapping = new XMLDirectMapping();
valueMapping.setAttributeName("value");
valueMapping.setGetMethodName("getValue");
valueMapping.setSetMethodName("setValue");
valueMapping.setXPath(getPrimaryNamespaceXPath() + "target-query-key/text()");
descriptor.addMapping(valueMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.XMLField in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildChangePolicyDescriptor.
protected ClassDescriptor buildChangePolicyDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(ObjectChangePolicy.class);
descriptor.setDefaultRootElement("change-policy");
descriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type"));
descriptor.getInheritancePolicy().addClassIndicator(DeferredChangeDetectionPolicy.class, getPrimaryNamespaceXPath() + "deferred-detection-change-policy");
descriptor.getInheritancePolicy().addClassIndicator(ObjectChangeTrackingPolicy.class, getPrimaryNamespaceXPath() + "object-level-change-policy");
descriptor.getInheritancePolicy().addClassIndicator(AttributeChangeTrackingPolicy.class, getPrimaryNamespaceXPath() + "attribute-level-change-policy");
return descriptor;
}
use of org.eclipse.persistence.oxm.XMLField in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildCacheInvalidationPolicyDescriptor.
protected ClassDescriptor buildCacheInvalidationPolicyDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(CacheInvalidationPolicy.class);
descriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type"));
descriptor.getInheritancePolicy().addClassIndicator(NoExpiryCacheInvalidationPolicy.class, getPrimaryNamespaceXPath() + "no-expiry-cache-invalidation-policy");
descriptor.getInheritancePolicy().addClassIndicator(TimeToLiveCacheInvalidationPolicy.class, getPrimaryNamespaceXPath() + "time-to-live-cache-invalidation-policy");
descriptor.getInheritancePolicy().addClassIndicator(DailyCacheInvalidationPolicy.class, getPrimaryNamespaceXPath() + "daily-cache-invalidation-policy");
XMLDirectMapping updateOnReadMapping = new XMLDirectMapping();
updateOnReadMapping.setAttributeName("shouldUpdateReadTimeOnUpdate");
updateOnReadMapping.setGetMethodName("shouldUpdateReadTimeOnUpdate");
updateOnReadMapping.setSetMethodName("setShouldUpdateReadTimeOnUpdate");
updateOnReadMapping.setXPath(getPrimaryNamespaceXPath() + "update-read-time-on-update/text()");
updateOnReadMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(updateOnReadMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.XMLField in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildAssociationDescriptor.
protected ClassDescriptor buildAssociationDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Association.class);
descriptor.setDefaultRootElement("field-reference");
XMLCompositeObjectMapping keyMapping = new XMLCompositeObjectMapping();
keyMapping.setAttributeName("key");
keyMapping.setGetMethodName("getKey");
keyMapping.setSetMethodName("setKey");
keyMapping.setXPath(getSecondaryNamespaceXPath() + "source-field");
keyMapping.setReferenceClass(DatabaseField.class);
((XMLField) keyMapping.getField()).setLeafElementType(fieldQname);
descriptor.addMapping(keyMapping);
XMLCompositeObjectMapping valueMapping = new XMLCompositeObjectMapping();
valueMapping.setAttributeName("value");
valueMapping.setGetMethodName("getValue");
valueMapping.setSetMethodName("setValue");
valueMapping.setXPath(getSecondaryNamespaceXPath() + "target-field");
valueMapping.setReferenceClass(DatabaseField.class);
((XMLField) valueMapping.getField()).setLeafElementType(fieldQname);
descriptor.addMapping(valueMapping);
return descriptor;
}
Aggregations