use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.
the class XMLEntityMappingsMappingProject method buildCacheDescriptor.
/**
* INTERNAL:
* XSD: cache
*/
protected ClassDescriptor buildCacheDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(CacheMetadata.class);
XMLDirectMapping expiryMapping = new XMLDirectMapping();
expiryMapping.setAttributeName("m_expiry");
expiryMapping.setGetMethodName("getExpiry");
expiryMapping.setSetMethodName("setExpiry");
expiryMapping.setXPath("orm:expiry/text()");
descriptor.addMapping(expiryMapping);
XMLCompositeObjectMapping expiryTimeOfDayMapping = new XMLCompositeObjectMapping();
expiryTimeOfDayMapping.setAttributeName("m_expiryTimeOfDay");
expiryTimeOfDayMapping.setGetMethodName("getExpiryTimeOfDay");
expiryTimeOfDayMapping.setSetMethodName("setExpiryTimeOfDay");
expiryTimeOfDayMapping.setReferenceClass(TimeOfDayMetadata.class);
expiryTimeOfDayMapping.setXPath("orm:time-of-day");
descriptor.addMapping(expiryTimeOfDayMapping);
descriptor.addMapping(getSizeAttributeMapping());
XMLDirectMapping sharedMapping = new XMLDirectMapping();
sharedMapping.setAttributeName("m_shared");
sharedMapping.setGetMethodName("getIsolation");
sharedMapping.setSetMethodName("setIsolation");
sharedMapping.setXPath("@shared");
ObjectTypeConverter sharedConverter = new ObjectTypeConverter();
sharedConverter.addConversionValue("true", "ISOLATED");
sharedConverter.addConversionValue("false", "SHARED");
sharedMapping.setConverter(sharedConverter);
descriptor.addMapping(sharedMapping);
XMLDirectMapping isolationMapping = new XMLDirectMapping();
isolationMapping.setAttributeName("m_isolation");
isolationMapping.setGetMethodName("getIsolation");
isolationMapping.setSetMethodName("setIsolation");
isolationMapping.setXPath("@isolation");
descriptor.addMapping(isolationMapping);
descriptor.addMapping(getTypeAttributeMapping());
XMLDirectMapping alwaysRefreshMapping = new XMLDirectMapping();
alwaysRefreshMapping.setAttributeName("m_alwaysRefresh");
alwaysRefreshMapping.setGetMethodName("getAlwaysRefresh");
alwaysRefreshMapping.setSetMethodName("setAlwaysRefresh");
alwaysRefreshMapping.setXPath("@always-refresh");
descriptor.addMapping(alwaysRefreshMapping);
XMLDirectMapping refreshOnlyIfNewerMapping = new XMLDirectMapping();
refreshOnlyIfNewerMapping.setAttributeName("m_refreshOnlyIfNewer");
refreshOnlyIfNewerMapping.setGetMethodName("getRefreshOnlyIfNewer");
refreshOnlyIfNewerMapping.setSetMethodName("setRefreshOnlyIfNewer");
refreshOnlyIfNewerMapping.setXPath("@refresh-only-if-newer");
descriptor.addMapping(refreshOnlyIfNewerMapping);
XMLDirectMapping disableHitsMapping = new XMLDirectMapping();
disableHitsMapping.setAttributeName("m_disableHits");
disableHitsMapping.setGetMethodName("getDisableHits");
disableHitsMapping.setSetMethodName("setDisableHits");
disableHitsMapping.setXPath("@disable-hits");
descriptor.addMapping(disableHitsMapping);
XMLDirectMapping coordinationTypeMapping = new XMLDirectMapping();
coordinationTypeMapping.setAttributeName("m_coordinationType");
coordinationTypeMapping.setGetMethodName("getCoordinationType");
coordinationTypeMapping.setSetMethodName("setCoordinationType");
coordinationTypeMapping.setXPath("@coordination-type");
descriptor.addMapping(coordinationTypeMapping);
XMLDirectMapping databaseChangeNotificationTypeMapping = new XMLDirectMapping();
databaseChangeNotificationTypeMapping.setAttributeName("m_databaseChangeNotificationType");
databaseChangeNotificationTypeMapping.setGetMethodName("getDatabaseChangeNotificationType");
databaseChangeNotificationTypeMapping.setSetMethodName("setDatabaseChangeNotificationType");
databaseChangeNotificationTypeMapping.setXPath("@databaseChangeNotification-type");
descriptor.addMapping(databaseChangeNotificationTypeMapping);
return descriptor;
}
use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.
the class SchemaModelProject method buildSchemaDescriptor.
private XMLDescriptor buildSchemaDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Schema.class);
descriptor.setDefaultRootElement(Constants.SCHEMA_PREFIX + ":" + "schema");
descriptor.setNamespaceResolver(namespaceResolver);
XMLCompositeCollectionMapping importsMapping = new XMLCompositeCollectionMapping();
importsMapping.setReferenceClass(Import.class);
importsMapping.setAttributeName("imports");
importsMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "import");
descriptor.addMapping(importsMapping);
XMLCompositeCollectionMapping includesMapping = new XMLCompositeCollectionMapping();
includesMapping.setReferenceClass(Include.class);
includesMapping.setAttributeName("includes");
includesMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "include");
descriptor.addMapping(includesMapping);
XMLDirectMapping targetNamespaceMapping = new XMLDirectMapping();
targetNamespaceMapping.setAttributeName("targetNamespace");
targetNamespaceMapping.setXPath("@targetNamespace");
descriptor.addMapping(targetNamespaceMapping);
XMLDirectMapping defaultNamespaceMapping = new XMLDirectMapping();
defaultNamespaceMapping.setAttributeName("defaultNamespace");
XMLField xmlField = new XMLField();
xmlField.setXPath("@xmlns");
xmlField.getXPathFragment().setNamespaceURI(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI);
defaultNamespaceMapping.setField(xmlField);
descriptor.addMapping(defaultNamespaceMapping);
XMLAnyAttributeMapping attributesMapMapping = new XMLAnyAttributeMapping();
attributesMapMapping.setAttributeName("attributesMap");
attributesMapMapping.setGetMethodName("getAttributesMap");
attributesMapMapping.setSetMethodName("setAttributesMap");
descriptor.addMapping(attributesMapMapping);
XMLCompositeCollectionMapping attributeGroupsMapping = new XMLCompositeCollectionMapping();
attributeGroupsMapping.setReferenceClass(AttributeGroup.class);
attributeGroupsMapping.setAttributeName("attributeGroups");
attributeGroupsMapping.useMapClass(java.util.HashMap.class, "getName");
attributeGroupsMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "attributeGroup");
descriptor.addMapping(attributeGroupsMapping);
XMLCompositeCollectionMapping groupsMapping = new XMLCompositeCollectionMapping();
groupsMapping.setReferenceClass(Group.class);
groupsMapping.setAttributeName("groups");
groupsMapping.useMapClass(java.util.HashMap.class, "getName");
groupsMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "group");
descriptor.addMapping(groupsMapping);
ObjectTypeConverter converter = new ObjectTypeConverter();
converter.addConversionValue("unqualified", false);
converter.addConversionValue("qualified", true);
converter.setFieldClassification(String.class);
XMLDirectMapping elementFormDefaultMapping = new XMLDirectMapping();
elementFormDefaultMapping.setAttributeName("elementFormDefault");
elementFormDefaultMapping.setXPath("@elementFormDefault");
elementFormDefaultMapping.setNullValue(false);
elementFormDefaultMapping.setConverter(converter);
descriptor.addMapping(elementFormDefaultMapping);
XMLDirectMapping attributeFormDefaultMapping = new XMLDirectMapping();
attributeFormDefaultMapping.setAttributeName("attributeFormDefault");
attributeFormDefaultMapping.setXPath("@attributeFormDefault");
attributeFormDefaultMapping.setNullValue(false);
attributeFormDefaultMapping.setConverter(converter);
descriptor.addMapping(attributeFormDefaultMapping);
XMLCompositeCollectionMapping topLevelComplexTypesMapping = new XMLCompositeCollectionMapping();
topLevelComplexTypesMapping.setReferenceClass(ComplexType.class);
topLevelComplexTypesMapping.setAttributeName("topLevelComplexTypes");
topLevelComplexTypesMapping.useMapClass(java.util.HashMap.class, "getName");
topLevelComplexTypesMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "complexType");
descriptor.addMapping(topLevelComplexTypesMapping);
XMLCompositeCollectionMapping topLevelElementsMapping = new XMLCompositeCollectionMapping();
topLevelElementsMapping.setReferenceClass(Element.class);
topLevelElementsMapping.setAttributeName("topLevelElements");
topLevelElementsMapping.useMapClass(java.util.HashMap.class, "getName");
topLevelElementsMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "element");
descriptor.addMapping(topLevelElementsMapping);
XMLCompositeCollectionMapping topLevelSimpleTypesMapping = new XMLCompositeCollectionMapping();
topLevelSimpleTypesMapping.setReferenceClass(SimpleType.class);
topLevelSimpleTypesMapping.setAttributeName("topLevelSimpleTypes");
topLevelSimpleTypesMapping.useMapClass(java.util.HashMap.class, "getName");
topLevelSimpleTypesMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "simpleType");
descriptor.addMapping(topLevelSimpleTypesMapping);
XMLCompositeCollectionMapping topLevelAttributesMapping = new XMLCompositeCollectionMapping();
topLevelAttributesMapping.setReferenceClass(Attribute.class);
topLevelAttributesMapping.setAttributeName("topLevelAttributes");
topLevelAttributesMapping.useMapClass(java.util.HashMap.class, "getName");
topLevelAttributesMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "attribute");
descriptor.addMapping(topLevelAttributesMapping);
XMLCompositeObjectMapping annotationMapping = new XMLCompositeObjectMapping();
annotationMapping.setReferenceClass(Annotation.class);
annotationMapping.setAttributeName("annotation");
annotationMapping.setXPath(Constants.SCHEMA_PREFIX + ":" + "annotation");
descriptor.addMapping(annotationMapping);
descriptor.setNamespaceResolver(namespaceResolver);
return descriptor;
}
use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildXMLSchemaReferenceDescriptor.
protected ClassDescriptor buildXMLSchemaReferenceDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(XMLSchemaReference.class);
descriptor.descriptorIsAggregate();
descriptor.setDefaultRootElement("schema-reference");
descriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type"));
descriptor.getInheritancePolicy().addClassIndicator(XMLSchemaReference.class, getPrimaryNamespaceXPath() + "schema-reference");
descriptor.getInheritancePolicy().addClassIndicator(XMLSchemaClassPathReference.class, getPrimaryNamespaceXPath() + "schema-class-path-reference");
descriptor.getInheritancePolicy().addClassIndicator(XMLSchemaFileReference.class, getPrimaryNamespaceXPath() + "schema-file-reference");
descriptor.getInheritancePolicy().addClassIndicator(XMLSchemaURLReference.class, getPrimaryNamespaceXPath() + "schema-url-reference");
XMLDirectMapping resourceMapping = new XMLDirectMapping();
resourceMapping.setAttributeName("resource");
resourceMapping.setXPath(getPrimaryNamespaceXPath() + "resource/text()");
descriptor.addMapping(resourceMapping);
XMLDirectMapping contextMapping = new XMLDirectMapping();
contextMapping.setAttributeName("schemaContext");
contextMapping.setXPath(getPrimaryNamespaceXPath() + "schema-context/text()");
descriptor.addMapping(contextMapping);
XMLDirectMapping nodeTypeMapping = new XMLDirectMapping();
nodeTypeMapping.setAttributeName("type");
nodeTypeMapping.setXPath(getPrimaryNamespaceXPath() + "node-type/text()");
ObjectTypeConverter nodeTypeConverter = new ObjectTypeConverter();
nodeTypeConverter.addConversionValue("element", XMLSchemaReference.ELEMENT);
nodeTypeConverter.addConversionValue("simple-type", XMLSchemaReference.SIMPLE_TYPE);
nodeTypeConverter.addConversionValue("complex-type", XMLSchemaReference.COMPLEX_TYPE);
nodeTypeConverter.addConversionValue("group", XMLSchemaReference.GROUP);
nodeTypeMapping.setConverter(nodeTypeConverter);
descriptor.addMapping(nodeTypeMapping);
return descriptor;
}
use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildObjectLevelReadQueryDescriptor.
protected ClassDescriptor buildObjectLevelReadQueryDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(ObjectLevelReadQuery.class);
descriptor.getInheritancePolicy().setParentClass(ReadQuery.class);
XMLDirectMapping referenceClassMapping = new XMLDirectMapping();
referenceClassMapping.setAttributeName("referenceClass");
referenceClassMapping.setGetMethodName("getReferenceClass");
referenceClassMapping.setSetMethodName("setReferenceClass");
referenceClassMapping.setXPath(getPrimaryNamespaceXPath() + "reference-class/text()");
descriptor.addMapping(referenceClassMapping);
XMLDirectMapping refreshIdentityMapping = new XMLDirectMapping();
refreshIdentityMapping.setAttributeName("shouldRefreshIdentityMapResult");
refreshIdentityMapping.setGetMethodName("shouldRefreshIdentityMapResult");
refreshIdentityMapping.setSetMethodName("setShouldRefreshIdentityMapResult");
refreshIdentityMapping.setXPath(getPrimaryNamespaceXPath() + "refresh/text()");
refreshIdentityMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(refreshIdentityMapping);
XMLDirectMapping refreshRemoteIdentityMapping = new XMLDirectMapping();
refreshRemoteIdentityMapping.setAttributeName("shouldRefreshRemoteIdentityMapResult");
refreshRemoteIdentityMapping.setGetMethodName("shouldRefreshRemoteIdentityMapResult");
refreshRemoteIdentityMapping.setSetMethodName("setShouldRefreshRemoteIdentityMapResult");
refreshRemoteIdentityMapping.setXPath(getPrimaryNamespaceXPath() + "remote-refresh/text()");
refreshRemoteIdentityMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(refreshRemoteIdentityMapping);
XMLDirectMapping cascadePolicyMapping = new XMLDirectMapping();
cascadePolicyMapping.setAttributeName("cascadePolicy");
cascadePolicyMapping.setGetMethodName("getCascadePolicy");
cascadePolicyMapping.setSetMethodName("setCascadePolicy");
ObjectTypeConverter cascadePolicyConverter = new ObjectTypeConverter();
cascadePolicyConverter.addConversionValue("none", DatabaseQuery.NoCascading);
cascadePolicyConverter.addConversionValue("all", DatabaseQuery.CascadeAllParts);
cascadePolicyConverter.addConversionValue("private", DatabaseQuery.CascadePrivateParts);
cascadePolicyMapping.setConverter(cascadePolicyConverter);
cascadePolicyMapping.setNullValue(DatabaseQuery.NoCascading);
cascadePolicyMapping.setXPath(getPrimaryNamespaceXPath() + "cascade-policy/text()");
descriptor.addMapping(cascadePolicyMapping);
XMLDirectMapping cacheUsageMapping = new XMLDirectMapping();
cacheUsageMapping.setAttributeName("cacheUsage");
cacheUsageMapping.setGetMethodName("getCacheUsage");
cacheUsageMapping.setSetMethodName("setCacheUsage");
cacheUsageMapping.setXPath(getPrimaryNamespaceXPath() + "cache-usage/text()");
ObjectTypeConverter cacheUsageConverter = new ObjectTypeConverter();
cacheUsageConverter.addConversionValue("exact-primary-key", ObjectLevelReadQuery.CheckCacheByExactPrimaryKey);
cacheUsageConverter.addConversionValue("primary-key", ObjectLevelReadQuery.CheckCacheByPrimaryKey);
cacheUsageConverter.addConversionValue("cache-only", ObjectLevelReadQuery.CheckCacheOnly);
cacheUsageConverter.addConversionValue("cache-then-database", ObjectLevelReadQuery.CheckCacheThenDatabase);
cacheUsageConverter.addConversionValue("conform", ObjectLevelReadQuery.ConformResultsInUnitOfWork);
cacheUsageConverter.addConversionValue("none", ObjectLevelReadQuery.DoNotCheckCache);
cacheUsageConverter.addConversionValue("use-descriptor-setting", ObjectLevelReadQuery.UseDescriptorSetting);
cacheUsageMapping.setConverter(cacheUsageConverter);
cacheUsageMapping.setNullValue(ObjectLevelReadQuery.UseDescriptorSetting);
descriptor.addMapping(cacheUsageMapping);
XMLDirectMapping lockModeMapping = new XMLDirectMapping();
lockModeMapping.setAttributeName("lockMode");
lockModeMapping.setGetMethodName("getLockMode");
lockModeMapping.setSetMethodName("setLockMode");
lockModeMapping.setXPath(getPrimaryNamespaceXPath() + "lock-mode/text()");
ObjectTypeConverter lockModeConverter = new ObjectTypeConverter();
lockModeConverter.addConversionValue("default", ObjectLevelReadQuery.DEFAULT_LOCK_MODE);
lockModeConverter.addConversionValue("lock", ObjectLevelReadQuery.LOCK);
lockModeConverter.addConversionValue("lock-no-wait", ObjectLevelReadQuery.LOCK_NOWAIT);
lockModeConverter.addConversionValue("none", ObjectLevelReadQuery.NO_LOCK);
lockModeMapping.setConverter(lockModeConverter);
lockModeMapping.setNullValue(ObjectLevelReadQuery.DEFAULT_LOCK_MODE);
descriptor.addMapping(lockModeMapping);
XMLDirectMapping distinctStateMapping = new XMLDirectMapping();
distinctStateMapping.setAttributeName("distinctState");
distinctStateMapping.setGetMethodName("getDistinctState");
distinctStateMapping.setSetMethodName("setDistinctState");
distinctStateMapping.setXPath(getPrimaryNamespaceXPath() + "distinct-state/text()");
ObjectTypeConverter distinctStateConverter = new ObjectTypeConverter();
distinctStateConverter.addConversionValue("dont-use-distinct", ObjectLevelReadQuery.DONT_USE_DISTINCT);
distinctStateConverter.addConversionValue("none", ObjectLevelReadQuery.UNCOMPUTED_DISTINCT);
distinctStateConverter.addConversionValue("use-distinct", ObjectLevelReadQuery.USE_DISTINCT);
distinctStateMapping.setConverter(distinctStateConverter);
distinctStateMapping.setNullValue(ObjectLevelReadQuery.UNCOMPUTED_DISTINCT);
descriptor.addMapping(distinctStateMapping);
XMLCompositeObjectMapping inMemoryQueryIndirectionPolicyMapping = new XMLCompositeObjectMapping();
inMemoryQueryIndirectionPolicyMapping.setAttributeName("inMemoryQueryIndirectionPolicy");
inMemoryQueryIndirectionPolicyMapping.setReferenceClass(InMemoryQueryIndirectionPolicy.class);
// Handle translation of default to null.
inMemoryQueryIndirectionPolicyMapping.setAttributeAccessor(new AttributeAccessor() {
@Override
public Object getAttributeValueFromObject(Object object) {
InMemoryQueryIndirectionPolicy policy = ((ObjectLevelReadQuery) object).getInMemoryQueryIndirectionPolicy();
if (policy.shouldThrowIndirectionException()) {
return null;
}
return policy;
}
@Override
public void setAttributeValueInObject(Object object, Object value) {
if (value == null) {
return;
}
InMemoryQueryIndirectionPolicy policy = (InMemoryQueryIndirectionPolicy) value;
((ObjectLevelReadQuery) object).setInMemoryQueryIndirectionPolicy(policy);
}
});
inMemoryQueryIndirectionPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "in-memory-querying");
descriptor.addMapping(inMemoryQueryIndirectionPolicyMapping);
// fetch group setting
XMLDirectMapping useDefaultFetchGroupMapping = new XMLDirectMapping();
useDefaultFetchGroupMapping.setAttributeName("shouldUseDefaultFetchGroup");
useDefaultFetchGroupMapping.setXPath(getPrimaryNamespaceXPath() + "use-default-fetch-group/text()");
useDefaultFetchGroupMapping.setNullValue(Boolean.TRUE);
descriptor.addMapping(useDefaultFetchGroupMapping);
XMLCompositeObjectMapping fetchGroupMapping = new XMLCompositeObjectMapping();
fetchGroupMapping.setAttributeName("fetchGroup");
fetchGroupMapping.setReferenceClass(FetchGroup.class);
fetchGroupMapping.setXPath(getPrimaryNamespaceXPath() + "fetch-group");
descriptor.addMapping(fetchGroupMapping);
XMLDirectMapping fetchGroupNameMapping = new XMLDirectMapping();
fetchGroupNameMapping.setAttributeName("fetchGroupName");
fetchGroupNameMapping.setXPath(getPrimaryNamespaceXPath() + "fetch-group-name/text()");
descriptor.addMapping(fetchGroupNameMapping);
// shouldUseExclusiveConnection setting
XMLDirectMapping useExclusiveConnectionMapping = new XMLDirectMapping();
useExclusiveConnectionMapping.setAttributeName("shouldUseExclusiveConnection");
useExclusiveConnectionMapping.setXPath(getPrimaryNamespaceXPath() + "use-exclusive-connection/text()");
useExclusiveConnectionMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(useExclusiveConnectionMapping);
XMLCompositeCollectionMapping joinedAttributeMapping = new XMLCompositeCollectionMapping();
joinedAttributeMapping.useCollectionClass(NonSynchronizedVector.class);
joinedAttributeMapping.setAttributeName("joinedAttributeExpressions");
joinedAttributeMapping.setGetMethodName("getJoinedAttributeExpressions");
joinedAttributeMapping.setSetMethodName("setJoinedAttributeExpressions");
joinedAttributeMapping.setReferenceClass(Expression.class);
joinedAttributeMapping.setXPath(getPrimaryNamespaceXPath() + "joined-attribute-expressions/" + getPrimaryNamespaceXPath() + "expression");
descriptor.addMapping(joinedAttributeMapping);
return descriptor;
}
use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject method buildCMPPolicyDescriptor.
protected ClassDescriptor buildCMPPolicyDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(CMPPolicy.class);
descriptor.setDefaultRootElement("cmp-policy");
XMLDirectMapping modificationDeferralLevelMapping = new XMLDirectMapping();
modificationDeferralLevelMapping.setAttributeName("modificationDeferralLevel");
modificationDeferralLevelMapping.setGetMethodName("getDeferModificationsUntilCommit");
modificationDeferralLevelMapping.setSetMethodName("setDeferModificationsUntilCommit");
ObjectTypeConverter modificationDeferralLevelConverter = new ObjectTypeConverter();
modificationDeferralLevelConverter.addConversionValue("all-modifications", CMPPolicy.ALL_MODIFICATIONS);
modificationDeferralLevelConverter.addConversionValue("update-modifications", CMPPolicy.UPDATE_MODIFICATIONS);
modificationDeferralLevelConverter.addConversionValue("none", CMPPolicy.NONE);
modificationDeferralLevelMapping.setConverter(modificationDeferralLevelConverter);
modificationDeferralLevelMapping.setXPath(getPrimaryNamespaceXPath() + "defer-until-commit/text()");
modificationDeferralLevelMapping.setNullValue(CMPPolicy.ALL_MODIFICATIONS);
descriptor.addMapping(modificationDeferralLevelMapping);
XMLDirectMapping nonDeferredCreateTimeMapping = new XMLDirectMapping();
nonDeferredCreateTimeMapping.setAttributeName("nonDeferredCreateTime");
nonDeferredCreateTimeMapping.setGetMethodName("getNonDeferredCreateTime");
nonDeferredCreateTimeMapping.setSetMethodName("setNonDeferredCreateTime");
ObjectTypeConverter nonDeferredCreateTimeConverter = new ObjectTypeConverter();
nonDeferredCreateTimeConverter.addConversionValue("after-ejbcreate", CMPPolicy.AFTER_EJBCREATE);
nonDeferredCreateTimeConverter.addConversionValue("after-ejbpostcreate", CMPPolicy.AFTER_EJBPOSTCREATE);
nonDeferredCreateTimeConverter.addConversionValue("undefined", CMPPolicy.UNDEFINED);
nonDeferredCreateTimeMapping.setConverter(nonDeferredCreateTimeConverter);
nonDeferredCreateTimeMapping.setXPath(getPrimaryNamespaceXPath() + "non-deferred-create-time/text()");
nonDeferredCreateTimeMapping.setNullValue(CMPPolicy.UNDEFINED);
descriptor.addMapping(nonDeferredCreateTimeMapping);
XMLCompositeObjectMapping pessimisticLockingPolicyMapping = new XMLCompositeObjectMapping();
pessimisticLockingPolicyMapping.setAttributeName("pessimisticLockingPolicy");
pessimisticLockingPolicyMapping.setGetMethodName("getPessimisticLockingPolicy");
pessimisticLockingPolicyMapping.setSetMethodName("setPessimisticLockingPolicy");
pessimisticLockingPolicyMapping.setReferenceClass(PessimisticLockingPolicy.class);
pessimisticLockingPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "pessimistic-locking");
descriptor.addMapping(pessimisticLockingPolicyMapping);
return descriptor;
}
Aggregations