aliasMapping.setGetMethodName("getAlias");
aliasMapping.setSetMethodName("setAlias");
aliasMapping.setXPath(getSecondaryNamespaceXPath() + "alias/text()");
descriptor.addMapping(aliasMapping);
XMLCompositeCollectionMapping primaryKeyFieldNamesMapping = new XMLCompositeCollectionMapping();
primaryKeyFieldNamesMapping.setAttributeName("primaryKeyFields");
primaryKeyFieldNamesMapping.setReferenceClass(DatabaseField.class);
primaryKeyFieldNamesMapping.setGetMethodName("getPrimaryKeyFields");
primaryKeyFieldNamesMapping.setSetMethodName("setPrimaryKeyFields");
primaryKeyFieldNamesMapping.setXPath(getSecondaryNamespaceXPath() + "primary-key/" + getSecondaryNamespaceXPath() + "field");
primaryKeyFieldNamesMapping.useCollectionClass(ArrayList.class);
descriptor.addMapping(primaryKeyFieldNamesMapping);
XMLDirectMapping descriptorIsReadOnlyMapping = new XMLDirectMapping();
descriptorIsReadOnlyMapping.setAttributeName("shouldBeReadOnly");
descriptorIsReadOnlyMapping.setGetMethodName("shouldBeReadOnly");
descriptorIsReadOnlyMapping.setSetMethodName("setShouldBeReadOnly");
descriptorIsReadOnlyMapping.setXPath(getSecondaryNamespaceXPath() + "read-only/text()");
descriptorIsReadOnlyMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(descriptorIsReadOnlyMapping);
XMLCompositeObjectMapping inheritancePolicyMapping = new XMLCompositeObjectMapping();
inheritancePolicyMapping.setAttributeName("inheritancePolicy");
inheritancePolicyMapping.setGetMethodName("getInheritancePolicyOrNull");
inheritancePolicyMapping.setSetMethodName("setInheritancePolicy");
inheritancePolicyMapping.setReferenceClass(InheritancePolicy.class);
inheritancePolicyMapping.setXPath(getSecondaryNamespaceXPath() + "inheritance");
descriptor.addMapping(inheritancePolicyMapping);
XMLCompositeObjectMapping eventManagerMapping = new XMLCompositeObjectMapping();
eventManagerMapping.setAttributeName("eventManager");
eventManagerMapping.setGetMethodName("getEventManager");
eventManagerMapping.setSetMethodName("setEventManager");
eventManagerMapping.setReferenceClass(DescriptorEventManager.class);
eventManagerMapping.setXPath(getSecondaryNamespaceXPath() + "events");
descriptor.addMapping(eventManagerMapping);
XMLCompositeObjectMapping queryManagerMapping = new XMLCompositeObjectMapping();
queryManagerMapping.setAttributeName("queryManager");
queryManagerMapping.setGetMethodName("getQueryManager");
queryManagerMapping.setSetMethodName("setQueryManager");
queryManagerMapping.setReferenceClass(DescriptorQueryManager.class);
queryManagerMapping.setXPath(getSecondaryNamespaceXPath() + "querying");
descriptor.addMapping(queryManagerMapping);
XMLCompositeCollectionMapping aggregateCollectionMapping = new XMLCompositeCollectionMapping();
aggregateCollectionMapping.useCollectionClass(NonSynchronizedVector.class);
aggregateCollectionMapping.setAttributeName("mappings");
aggregateCollectionMapping.setReferenceClass(DatabaseMapping.class);
aggregateCollectionMapping.setXPath(getSecondaryNamespaceXPath() + "attribute-mappings/" + getSecondaryNamespaceXPath() + "attribute-mapping");
aggregateCollectionMapping.setSetMethodName("setMappings");
aggregateCollectionMapping.setGetMethodName("getMappings");
descriptor.addMapping(aggregateCollectionMapping);
XMLDirectMapping descriptorTypeMapping = new XMLDirectMapping();
descriptorTypeMapping.setAttributeName("descriptorTypeValue");
descriptorTypeMapping.setGetMethodName("getDescriptorTypeValue");
descriptorTypeMapping.setSetMethodName("setDescriptorTypeValue");
ObjectTypeConverter descriptorTypeConverter = new ObjectTypeConverter();
descriptorTypeConverter.addConversionValue("aggregate", "Aggregate");
descriptorTypeConverter.addConversionValue("aggregate-collection", "Aggregate collection");
descriptorTypeConverter.addConversionValue("composite", "Composite");
descriptorTypeConverter.addConversionValue("composite-collection", "Composite collection");
descriptorTypeConverter.addConversionValue("interface", "Interface");
descriptorTypeConverter.addConversionValue("independent", "Normal");
descriptorTypeMapping.setConverter(descriptorTypeConverter);
descriptorTypeMapping.setXPath(getPrimaryNamespaceXPath() + "descriptor-type/text()");
descriptor.addMapping(descriptorTypeMapping);
XMLCompositeObjectMapping interfacePolicyMapping = new XMLCompositeObjectMapping();
interfacePolicyMapping.setAttributeName("interfacePolicy");
interfacePolicyMapping.setGetMethodName("getInterfacePolicyOrNull");
interfacePolicyMapping.setSetMethodName("setInterfacePolicy");
interfacePolicyMapping.setReferenceClass(InterfacePolicy.class);
interfacePolicyMapping.setXPath(getPrimaryNamespaceXPath() + "interfaces");
descriptor.addMapping(interfacePolicyMapping);
XMLCompositeObjectMapping lockingPolicyMapping = new XMLCompositeObjectMapping();
lockingPolicyMapping.setAttributeName("lockingPolicy");
lockingPolicyMapping.setGetMethodName("getOptimisticLockingPolicy");
lockingPolicyMapping.setSetMethodName("setOptimisticLockingPolicy");
lockingPolicyMapping.setReferenceClass(VersionLockingPolicy.class);
lockingPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "locking");
descriptor.addMapping(lockingPolicyMapping);
XMLDirectMapping sequenceNameMapping = new XMLDirectMapping();
sequenceNameMapping.setAttributeName("sequenceNumberName");
sequenceNameMapping.setGetMethodName("getSequenceNumberName");
sequenceNameMapping.setSetMethodName("setSequenceNumberName");
sequenceNameMapping.setXPath(getPrimaryNamespaceXPath() + "sequencing/" + getPrimaryNamespaceXPath() + "sequence-name/text()");
descriptor.addMapping(sequenceNameMapping);
XMLCompositeObjectMapping sequenceFieldMapping = new XMLCompositeObjectMapping();
sequenceFieldMapping.setAttributeName("sequenceNumberField");
sequenceFieldMapping.setGetMethodName("getSequenceNumberField");
sequenceFieldMapping.setSetMethodName("setSequenceNumberField");
sequenceFieldMapping.setReferenceClass(DatabaseField.class);
sequenceFieldMapping.setXPath(getPrimaryNamespaceXPath() + "sequencing/" + getPrimaryNamespaceXPath() + "sequence-field");
descriptor.addMapping(sequenceFieldMapping);
XMLDirectMapping identityMapClassMapping = new XMLDirectMapping();
identityMapClassMapping.setAttributeName("identityMapClass");
identityMapClassMapping.setGetMethodName("getIdentityMapClass");
identityMapClassMapping.setSetMethodName("setIdentityMapClass");
ObjectTypeConverter identityMapClassConverter = new ObjectTypeConverter();
identityMapClassConverter.addConversionValue("none", NoIdentityMap.class);
identityMapClassConverter.addConversionValue("full", FullIdentityMap.class);
identityMapClassConverter.addConversionValue("cache", CacheIdentityMap.class);
identityMapClassConverter.addConversionValue("weak-reference", WeakIdentityMap.class);
identityMapClassConverter.addConversionValue("soft-cache-weak-reference", SoftCacheWeakIdentityMap.class);
identityMapClassConverter.addConversionValue("hard-cache-weak-reference", HardCacheWeakIdentityMap.class);
identityMapClassMapping.setConverter(identityMapClassConverter);
identityMapClassMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "cache-type/text()");
identityMapClassMapping.setNullValue(SoftCacheWeakIdentityMap.class);
descriptor.addMapping(identityMapClassMapping);
XMLDirectMapping remoteIdentityMapClassMapping = new XMLDirectMapping();
remoteIdentityMapClassMapping.setAttributeName("remoteIdentityMapClass");
remoteIdentityMapClassMapping.setGetMethodName("getRemoteIdentityMapClass");
remoteIdentityMapClassMapping.setSetMethodName("setRemoteIdentityMapClass");
ObjectTypeConverter remoteIdentityMapClassConverter = new ObjectTypeConverter();
remoteIdentityMapClassConverter.addConversionValue("none", NoIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("full", FullIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("cache", CacheIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("weak-reference", WeakIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("soft-cache-weak-reference", SoftCacheWeakIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("hard-cache-weak-reference", HardCacheWeakIdentityMap.class);
remoteIdentityMapClassMapping.setConverter(remoteIdentityMapClassConverter);
remoteIdentityMapClassMapping.setXPath(getPrimaryNamespaceXPath() + "remote-caching/" + getPrimaryNamespaceXPath() + "cache-type/text()");
remoteIdentityMapClassMapping.setNullValue(SoftCacheWeakIdentityMap.class);
descriptor.addMapping(remoteIdentityMapClassMapping);
XMLDirectMapping identityMapSizeMapping = new XMLDirectMapping();
identityMapSizeMapping.setAttributeName("identityMapSize");
identityMapSizeMapping.setGetMethodName("getIdentityMapSize");
identityMapSizeMapping.setSetMethodName("setIdentityMapSize");
identityMapSizeMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "cache-size/text()");
identityMapSizeMapping.setNullValue(new Integer(100));
descriptor.addMapping(identityMapSizeMapping);
XMLDirectMapping remoteIdentityMapSizeMapping = new XMLDirectMapping();
remoteIdentityMapSizeMapping.setAttributeName("remoteIdentityMapSize");
remoteIdentityMapSizeMapping.setGetMethodName("getRemoteIdentityMapSize");
remoteIdentityMapSizeMapping.setSetMethodName("setRemoteIdentityMapSize");
remoteIdentityMapSizeMapping.setXPath(getPrimaryNamespaceXPath() + "remote-caching/" + getPrimaryNamespaceXPath() + "cache-size/text()");
remoteIdentityMapSizeMapping.setNullValue(new Integer(100));
descriptor.addMapping(remoteIdentityMapSizeMapping);
XMLDirectMapping shouldAlwaysRefreshCacheMapping = new XMLDirectMapping();
shouldAlwaysRefreshCacheMapping.setAttributeName("shouldAlwaysRefreshCache");
shouldAlwaysRefreshCacheMapping.setGetMethodName("shouldAlwaysRefreshCache");
shouldAlwaysRefreshCacheMapping.setSetMethodName("setShouldAlwaysRefreshCache");
shouldAlwaysRefreshCacheMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "always-refresh/text()");
shouldAlwaysRefreshCacheMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldAlwaysRefreshCacheMapping);
XMLDirectMapping shouldAlwaysRefreshCacheOnRemoteMapping = new XMLDirectMapping();
shouldAlwaysRefreshCacheOnRemoteMapping.setAttributeName("shouldAlwaysRefreshCacheOnRemote");
shouldAlwaysRefreshCacheOnRemoteMapping.setGetMethodName("shouldAlwaysRefreshCacheOnRemote");
shouldAlwaysRefreshCacheOnRemoteMapping.setSetMethodName("setShouldAlwaysRefreshCacheOnRemote");
shouldAlwaysRefreshCacheOnRemoteMapping.setXPath(getPrimaryNamespaceXPath() + "remote-caching/" + getPrimaryNamespaceXPath() + "always-refresh/text()");
shouldAlwaysRefreshCacheOnRemoteMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldAlwaysRefreshCacheOnRemoteMapping);
XMLDirectMapping shouldOnlyRefreshCacheIfNewerVersionMapping = new XMLDirectMapping();
shouldOnlyRefreshCacheIfNewerVersionMapping.setAttributeName("shouldOnlyRefreshCacheIfNewerVersion");
shouldOnlyRefreshCacheIfNewerVersionMapping.setGetMethodName("shouldOnlyRefreshCacheIfNewerVersion");
shouldOnlyRefreshCacheIfNewerVersionMapping.setSetMethodName("setShouldOnlyRefreshCacheIfNewerVersion");
shouldOnlyRefreshCacheIfNewerVersionMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "only-refresh-cache-if-newer-version/text()");
shouldOnlyRefreshCacheIfNewerVersionMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldOnlyRefreshCacheIfNewerVersionMapping);
XMLDirectMapping shouldDisableCacheHitsMapping = new XMLDirectMapping();
shouldDisableCacheHitsMapping.setAttributeName("shouldDisableCacheHits");
shouldDisableCacheHitsMapping.setGetMethodName("shouldDisableCacheHits");
shouldDisableCacheHitsMapping.setSetMethodName("setShouldDisableCacheHits");
shouldDisableCacheHitsMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "disable-cache-hits/text()");
shouldDisableCacheHitsMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldDisableCacheHitsMapping);
XMLDirectMapping shouldDisableCacheHitsOnRemoteMapping = new XMLDirectMapping();
shouldDisableCacheHitsOnRemoteMapping.setAttributeName("shouldDisableCacheHitsOnRemote");
shouldDisableCacheHitsOnRemoteMapping.setGetMethodName("shouldDisableCacheHitsOnRemote");
shouldDisableCacheHitsOnRemoteMapping.setSetMethodName("setShouldDisableCacheHitsOnRemote");
shouldDisableCacheHitsOnRemoteMapping.setXPath(getPrimaryNamespaceXPath() + "remote-caching/" + getPrimaryNamespaceXPath() + "disable-cache-hits/text()");
shouldDisableCacheHitsOnRemoteMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldDisableCacheHitsOnRemoteMapping);
XMLDirectMapping shouldAlwaysConformResultsInUnitOfWorkMapping = new XMLDirectMapping();
shouldAlwaysConformResultsInUnitOfWorkMapping.setAttributeName("shouldAlwaysConformResultsInUnitOfWork");
shouldAlwaysConformResultsInUnitOfWorkMapping.setGetMethodName("shouldAlwaysConformResultsInUnitOfWork");
shouldAlwaysConformResultsInUnitOfWorkMapping.setSetMethodName("setShouldAlwaysConformResultsInUnitOfWork");
shouldAlwaysConformResultsInUnitOfWorkMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "always-conform/text()");
shouldAlwaysConformResultsInUnitOfWorkMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldAlwaysConformResultsInUnitOfWorkMapping);
XMLDirectMapping isIsolatedMapping = new XMLDirectMapping();
isIsolatedMapping.setAttributeName("isIsolated");
isIsolatedMapping.setGetMethodName("isIsolated");
isIsolatedMapping.setSetMethodName("setIsIsolated");
isIsolatedMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "isolated/text()");
isIsolatedMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(isIsolatedMapping);
XMLDirectMapping unitOfWorkCacheIsolationLevelMapping = new XMLDirectMapping();
unitOfWorkCacheIsolationLevelMapping.setAttributeName("unitOfWorkCacheIsolationLevel");
unitOfWorkCacheIsolationLevelMapping.setGetMethodName("getUnitOfWorkCacheIsolationLevel");
unitOfWorkCacheIsolationLevelMapping.setSetMethodName("setUnitOfWorkCacheIsolationLevel");
unitOfWorkCacheIsolationLevelMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "unitofwork-isolation-level/text()");
ObjectTypeConverter unitOfWorkCacheIsolationLevelConverter = new ObjectTypeConverter();
unitOfWorkCacheIsolationLevelConverter.addConversionValue("use-session-cache-after-transaction", new Integer(ClassDescriptor.USE_SESSION_CACHE_AFTER_TRANSACTION));
unitOfWorkCacheIsolationLevelConverter.addConversionValue("isolate-new-data-after-transaction", new Integer(ClassDescriptor.ISOLATE_NEW_DATA_AFTER_TRANSACTION));
unitOfWorkCacheIsolationLevelConverter.addConversionValue("isolate-cache-after-transaction", new Integer(ClassDescriptor.ISOLATE_CACHE_AFTER_TRANSACTION));
unitOfWorkCacheIsolationLevelConverter.addConversionValue("isolate-cache-always", new Integer(ClassDescriptor.ISOLATE_CACHE_ALWAYS));
unitOfWorkCacheIsolationLevelMapping.setConverter(unitOfWorkCacheIsolationLevelConverter);
unitOfWorkCacheIsolationLevelMapping.setNullValue(new Integer(ClassDescriptor.ISOLATE_NEW_DATA_AFTER_TRANSACTION));
descriptor.addMapping(unitOfWorkCacheIsolationLevelMapping);
XMLCompositeObjectMapping cacheInvalidationPolicyMapping = new XMLCompositeObjectMapping();
cacheInvalidationPolicyMapping.setAttributeName("cacheInvalidationPolicy");
cacheInvalidationPolicyMapping.setReferenceClass(CacheInvalidationPolicy.class);
cacheInvalidationPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "cache-invalidation-policy");
descriptor.addMapping(cacheInvalidationPolicyMapping);
XMLDirectMapping cacheSyncTypeMapping = new XMLDirectMapping();
cacheSyncTypeMapping.setAttributeName("cacheSynchronizationType");
cacheSyncTypeMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "cache-sync-type/text()");
ObjectTypeConverter cacheSyncTypeConverter = new ObjectTypeConverter();
cacheSyncTypeConverter.addConversionValue("invalidation", new Integer(ClassDescriptor.INVALIDATE_CHANGED_OBJECTS));
cacheSyncTypeConverter.addConversionValue("no-changes", new Integer(ClassDescriptor.DO_NOT_SEND_CHANGES));
cacheSyncTypeConverter.addConversionValue("change-set-with-new-objects", new Integer(ClassDescriptor.SEND_NEW_OBJECTS_WITH_CHANGES));
cacheSyncTypeConverter.addConversionValue("change-set", new Integer(ClassDescriptor.SEND_OBJECT_CHANGES));
cacheSyncTypeMapping.setConverter(cacheSyncTypeConverter);
cacheSyncTypeMapping.setNullValue(new Integer(ClassDescriptor.SEND_OBJECT_CHANGES));
descriptor.addMapping(cacheSyncTypeMapping);
XMLCompositeObjectMapping historyPolicyMapping = new XMLCompositeObjectMapping();
historyPolicyMapping.setAttributeName("historyPolicy");
historyPolicyMapping.setGetMethodName("getHistoryPolicy");
historyPolicyMapping.setSetMethodName("setHistoryPolicy");
historyPolicyMapping.setReferenceClass(HistoryPolicy.class);
historyPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "history-policy");
descriptor.addMapping(historyPolicyMapping);
XMLCompositeObjectMapping returningPolicyMapping = new XMLCompositeObjectMapping();
returningPolicyMapping.setAttributeName("returningPolicy");
returningPolicyMapping.setGetMethodName("getReturningPolicy");
returningPolicyMapping.setSetMethodName("setReturningPolicy");
returningPolicyMapping.setReferenceClass(ReturningPolicy.class);
returningPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "returning-policy");
descriptor.addMapping(returningPolicyMapping);
XMLDirectMapping amendmentClassMapping = new XMLDirectMapping();
amendmentClassMapping.setAttributeName("amendmentClass");
amendmentClassMapping.setGetMethodName("getAmendmentClass");
amendmentClassMapping.setSetMethodName("setAmendmentClass");
amendmentClassMapping.setXPath(getPrimaryNamespaceXPath() + "amendment/" + getPrimaryNamespaceXPath() + "amendment-class/text()");
descriptor.addMapping(amendmentClassMapping);
XMLDirectMapping amendmentMethodNameMapping = new XMLDirectMapping();
amendmentMethodNameMapping.setAttributeName("amendmentMethodName");
amendmentMethodNameMapping.setGetMethodName("getAmendmentMethodName");
amendmentMethodNameMapping.setSetMethodName("setAmendmentMethodName");
amendmentMethodNameMapping.setXPath(getPrimaryNamespaceXPath() + "amendment/" + getPrimaryNamespaceXPath() + "amendment-method/text()");
descriptor.addMapping(amendmentMethodNameMapping);
XMLCompositeObjectMapping instantiationPolicyMapping = new XMLCompositeObjectMapping();
instantiationPolicyMapping.setAttributeName("instantiationPolicy");
instantiationPolicyMapping.setGetMethodName("getInstantiationPolicy");
instantiationPolicyMapping.setSetMethodName("setInstantiationPolicy");
instantiationPolicyMapping.setReferenceClass(InstantiationPolicy.class);
instantiationPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "instantiation");
descriptor.addMapping(instantiationPolicyMapping);
XMLCompositeObjectMapping copyPolicyMapping = new XMLCompositeObjectMapping();
copyPolicyMapping.setAttributeName("copyPolicy");
copyPolicyMapping.setGetMethodName("getCopyPolicy");
copyPolicyMapping.setSetMethodName("setCopyPolicy");
copyPolicyMapping.setReferenceClass(AbstractCopyPolicy.class);
copyPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "copying");
descriptor.addMapping(copyPolicyMapping);
XMLCompositeCollectionMapping queryKeysMapping = new XMLCompositeCollectionMapping();
queryKeysMapping.setAttributeName("queryKeys");
queryKeysMapping.setReferenceClass(QueryKey.class);
queryKeysMapping.setXPath(getPrimaryNamespaceXPath() + "query-keys/" + getPrimaryNamespaceXPath() + "query-key");
queryKeysMapping.setSetMethodName("setQueryKeys");
queryKeysMapping.setGetMethodName("getQueryKeys");
queryKeysMapping.useMapClass(HashMap.class, "getName");
descriptor.addMapping(queryKeysMapping);
XMLCompositeObjectMapping cmpPolicyMapping = new XMLCompositeObjectMapping();
cmpPolicyMapping.setAttributeName("cmpPolicy");
cmpPolicyMapping.setGetMethodName("getCMPPolicy");
cmpPolicyMapping.setSetMethodName("setCMPPolicy");
cmpPolicyMapping.setReferenceClass(CMPPolicy.class);
cmpPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "cmp-policy");
descriptor.addMapping(cmpPolicyMapping);
XMLCompositeObjectMapping fetchGroupManagerMapping = new XMLCompositeObjectMapping();
fetchGroupManagerMapping.setAttributeName("fetchGroupManager");
fetchGroupManagerMapping.setGetMethodName("getFetchGroupManager");
fetchGroupManagerMapping.setSetMethodName("setFetchGroupManager");
fetchGroupManagerMapping.setReferenceClass(FetchGroupManager.class);
fetchGroupManagerMapping.setXPath(getPrimaryNamespaceXPath() + "fetch-groups");
descriptor.addMapping(fetchGroupManagerMapping);
XMLCompositeObjectMapping changePolicyMapping = new XMLCompositeObjectMapping();
changePolicyMapping.setAttributeName("changePolicy");
changePolicyMapping.setReferenceClass(ObjectChangePolicy.class);
changePolicyMapping.setXPath(getPrimaryNamespaceXPath() + "change-policy");
descriptor.addMapping(changePolicyMapping);
XMLCompositeCollectionMapping propertiesMapping = new XMLCompositeCollectionMapping();
propertiesMapping.setAttributeName("properties");
propertiesMapping.setReferenceClass(PropertyAssociation.class);
propertiesMapping.setAttributeAccessor(new AttributeAccessor() {
public Object getAttributeValueFromObject(Object object) {
ClassDescriptor desc = (ClassDescriptor)object;
Vector propertyAssociations = new NonSynchronizedVector();
for (Iterator i = desc.getProperties().entrySet().iterator(); i.hasNext();) {
Map.Entry me = (Map.Entry)i.next();
PropertyAssociation propertyAssociation = new PropertyAssociation();
propertyAssociation.setKey(me.getKey());
propertyAssociation.setValue(me.getValue());
propertyAssociations.add(propertyAssociation);
}
return propertyAssociations;
}
public void setAttributeValueInObject(Object object, Object value) {
ClassDescriptor desc = (ClassDescriptor)object;
Vector propertyAssociations = (Vector)value;
for (int i = 0; i < propertyAssociations.size(); i++) {
PropertyAssociation propertyAssociation = (PropertyAssociation)propertyAssociations.get(i);
desc.getProperties().put(propertyAssociation.getKey(), propertyAssociation.getValue());
}
}
});
propertiesMapping.setXPath(getSecondaryNamespaceXPath() + "properties/" + getSecondaryNamespaceXPath() + "property");
descriptor.addMapping(propertiesMapping);
return descriptor;
}