usesBatchReadingMapping.setSetMethodName("setUsesBatchReading");
usesBatchReadingMapping.setXPath(getPrimaryNamespaceXPath() + "batch-reading/text()");
usesBatchReadingMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(usesBatchReadingMapping);
XMLCompositeObjectMapping containerPolicyMapping = new XMLCompositeObjectMapping();
containerPolicyMapping.setAttributeName("collectionPolicy");
containerPolicyMapping.setGetMethodName("getContainerPolicy");
containerPolicyMapping.setSetMethodName("setContainerPolicy");
containerPolicyMapping.setReferenceClass(ContainerPolicy.class);
containerPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "container");
descriptor.addMapping(containerPolicyMapping);
XMLCompositeObjectMapping indirectionPolicyMapping = new XMLCompositeObjectMapping();
indirectionPolicyMapping.setReferenceClass(IndirectionPolicy.class);
// Handle translation of NoIndirectionPolicy -> null.
indirectionPolicyMapping.setAttributeAccessor(new AttributeAccessor() {
public Object getAttributeValueFromObject(Object object) {
IndirectionPolicy policy = ((ForeignReferenceMapping)object).getIndirectionPolicy();
if (policy instanceof NoIndirectionPolicy) {
return null;
}
return policy;
}
public void setAttributeValueInObject(Object object, Object value) {
IndirectionPolicy policy = (IndirectionPolicy)value;
if (value == null) {
policy = new NoIndirectionPolicy();
}
((ForeignReferenceMapping)object).setIndirectionPolicy(policy);
}
});
indirectionPolicyMapping.setAttributeName("indirectionPolicy");
indirectionPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "indirection");
descriptor.addMapping(indirectionPolicyMapping);
XMLCompositeObjectMapping selectionQueryMapping = new XMLCompositeObjectMapping();
selectionQueryMapping.setAttributeName("selectionQuery");
selectionQueryMapping.setGetMethodName("getSelectionQuery");
selectionQueryMapping.setSetMethodName("setSelectionQuery");
selectionQueryMapping.setReferenceClass(ReadQuery.class);
selectionQueryMapping.setXPath(getPrimaryNamespaceXPath() + "selection-query");
descriptor.addMapping(selectionQueryMapping);
XMLCompositeObjectMapping insertQueryMapping = new XMLCompositeObjectMapping();
insertQueryMapping.setAttributeName("insertQuery");
insertQueryMapping.setGetMethodName("getInsertQuery");
insertQueryMapping.setSetMethodName("setInsertQuery");
insertQueryMapping.setReferenceClass(DataModifyQuery.class);
insertQueryMapping.setXPath(getPrimaryNamespaceXPath() + "insert-query");
descriptor.addMapping(insertQueryMapping);
XMLCompositeObjectMapping deleteQueryMapping = new XMLCompositeObjectMapping();
deleteQueryMapping.setAttributeName("deleteQuery");
deleteQueryMapping.setGetMethodName("getDeleteQuery");
deleteQueryMapping.setSetMethodName("setDeleteQuery");
deleteQueryMapping.setReferenceClass(DataModifyQuery.class);
deleteQueryMapping.setXPath(getPrimaryNamespaceXPath() + "delete-query");
descriptor.addMapping(deleteQueryMapping);
XMLCompositeObjectMapping deleteAllQueryMapping = new XMLCompositeObjectMapping();
deleteAllQueryMapping.setAttributeName("deleteAllQuery");
deleteAllQueryMapping.setGetMethodName("getDeleteAllQuery");
deleteAllQueryMapping.setSetMethodName("setDeleteAllQuery");
deleteAllQueryMapping.setReferenceClass(DataModifyQuery.class);
deleteAllQueryMapping.setXPath(getPrimaryNamespaceXPath() + "delete-all-query");
descriptor.addMapping(deleteAllQueryMapping);
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);
return descriptor;
}