use of org.eclipse.persistence.oxm.mappings.nullpolicy.IsSetNullPolicy in project eclipselink by eclipse-ee4j.
the class XMLEntityMappingsMappingProject method getPrivateOwnedMapping.
/**
* INTERNAL:
*/
protected XMLDirectMapping getPrivateOwnedMapping() {
XMLDirectMapping privateOwnedMapping = new XMLDirectMapping();
privateOwnedMapping.setAttributeName("m_privateOwned");
privateOwnedMapping.setGetMethodName("getPrivateOwned");
privateOwnedMapping.setSetMethodName("setPrivateOwned");
privateOwnedMapping.setConverter(new EmptyElementConverter());
IsSetNullPolicy privateOwnedPolicy = new IsSetNullPolicy("isPrivateOwned");
privateOwnedPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
privateOwnedMapping.setNullPolicy(privateOwnedPolicy);
privateOwnedMapping.setXPath("orm:private-owned");
return privateOwnedMapping;
}
use of org.eclipse.persistence.oxm.mappings.nullpolicy.IsSetNullPolicy in project eclipselink by eclipse-ee4j.
the class SDOProperty method setIsSetPolicyOnMapping.
/**
* INTERNAL:
* Create and set an IsSetNodePolicy on the mapping - leaving the policy in default state
* @param aMapping
* @param propertyName
* @return
*/
private AbstractNullPolicy setIsSetPolicyOnMapping(XMLNillableMapping aMapping, Object propertyName) {
AbstractNullPolicy aNullPolicy = new IsSetNullPolicy();
// Set the isSet method signature on policy
((IsSetNullPolicy) aNullPolicy).setIsSetMethodName(SDOConstants.SDO_ISSET_METHOD_NAME);
// Set fields even though defaults are set
// aNullPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
// Parameter type is always String
((IsSetNullPolicy) aNullPolicy).setIsSetParameterTypes(new Class<?>[] { ClassConstants.STRING });
((IsSetNullPolicy) aNullPolicy).setIsSetParameters(new Object[] { propertyName });
aMapping.setNullPolicy(aNullPolicy);
return aNullPolicy;
}
use of org.eclipse.persistence.oxm.mappings.nullpolicy.IsSetNullPolicy in project eclipselink by eclipse-ee4j.
the class XmlBindingsGenerator method isDefaultNullPolicy.
/**
* Indicates is a given AbstractNullPolicy is the default. This is useful
* if it is not desirable to write out the default policy in the oxm
* metadata file.
*
* The default policy is NullPolicy, with the following set:
* <ul>
* <li>isNullRepresentedByXsiNil = false
* <li>isNullRepresentedByEmptyNode = true
* <li>isSetPerformedForAbsentNode = true
* <li>marshalNullRepresentation = XMLNullRepresentationType.ABSENT_NODE
* </ul>
*/
protected static boolean isDefaultNullPolicy(AbstractNullPolicy nullPolicy) {
// default policy is NullPolicy
if (nullPolicy instanceof IsSetNullPolicy) {
return false;
}
boolean xsiNil = nullPolicy.isNullRepresentedByXsiNil();
boolean emptyNode = nullPolicy.isNullRepresentedByEmptyNode();
boolean setForAbsent = nullPolicy.getIsSetPerformedForAbsentNode();
XMLNullRepresentationType marshalNull = nullPolicy.getMarshalNullRepresentation();
return (!xsiNil && emptyNode && setForAbsent && marshalNull == XMLNullRepresentationType.ABSENT_NODE);
}
use of org.eclipse.persistence.oxm.mappings.nullpolicy.IsSetNullPolicy in project eclipselink by eclipse-ee4j.
the class XMLEntityMappingsMappingProject method getReturnUpdateMapping.
/**
* INTERNAL:
*/
protected XMLDirectMapping getReturnUpdateMapping() {
XMLDirectMapping mapping = new XMLDirectMapping();
mapping.setAttributeName("m_returnUpdate");
mapping.setGetMethodName("getReturnUpdate");
mapping.setSetMethodName("setReturnUpdate");
mapping.setConverter(new EmptyElementConverter());
IsSetNullPolicy returnUpdatePolicy = new IsSetNullPolicy("isReturnUpdate");
returnUpdatePolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
mapping.setNullPolicy(returnUpdatePolicy);
mapping.setXPath("orm:return-update");
return mapping;
}
use of org.eclipse.persistence.oxm.mappings.nullpolicy.IsSetNullPolicy in project eclipselink by eclipse-ee4j.
the class XMLEntityMappingsMappingProject method buildPersistenceUnitMetadataDescriptor.
/**
* INTERNAL:
* XSD: persistence-unit-metadata
*/
protected ClassDescriptor buildPersistenceUnitMetadataDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(XMLPersistenceUnitMetadata.class);
XMLDirectMapping xmlMappingMetadataCompleteMapping = new XMLDirectMapping();
xmlMappingMetadataCompleteMapping.setAttributeName("m_xmlMappingMetadataComplete");
xmlMappingMetadataCompleteMapping.setGetMethodName("getXMLMappingMetadataComplete");
xmlMappingMetadataCompleteMapping.setSetMethodName("setXMLMappingMetadataComplete");
xmlMappingMetadataCompleteMapping.setConverter(new EmptyElementConverter());
IsSetNullPolicy xmlMappingMetadataCompletePolicy = new IsSetNullPolicy("isXMLMappingMetadataComplete");
xmlMappingMetadataCompletePolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
xmlMappingMetadataCompleteMapping.setNullPolicy(xmlMappingMetadataCompletePolicy);
xmlMappingMetadataCompleteMapping.setXPath("orm:xml-mapping-metadata-complete");
descriptor.addMapping(xmlMappingMetadataCompleteMapping);
XMLDirectMapping excludeDefaultMappingsMapping = new XMLDirectMapping();
excludeDefaultMappingsMapping.setAttributeName("m_excludeDefaultMappings");
excludeDefaultMappingsMapping.setGetMethodName("getExcludeDefaultMappings");
excludeDefaultMappingsMapping.setSetMethodName("setExcludeDefaultMappings");
excludeDefaultMappingsMapping.setConverter(new EmptyElementConverter());
IsSetNullPolicy excludeDefaultMappingsPolicy = new IsSetNullPolicy("excludeDefaultMappings");
excludeDefaultMappingsPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
excludeDefaultMappingsMapping.setNullPolicy(excludeDefaultMappingsPolicy);
excludeDefaultMappingsMapping.setXPath("orm:exclude-default-mappings");
descriptor.addMapping(excludeDefaultMappingsMapping);
XMLCompositeObjectMapping persistenceUnitDefaultsMapping = new XMLCompositeObjectMapping();
persistenceUnitDefaultsMapping.setAttributeName("m_persistenceUnitDefaults");
persistenceUnitDefaultsMapping.setGetMethodName("getPersistenceUnitDefaults");
persistenceUnitDefaultsMapping.setSetMethodName("setPersistenceUnitDefaults");
persistenceUnitDefaultsMapping.setReferenceClass(XMLPersistenceUnitDefaults.class);
persistenceUnitDefaultsMapping.setXPath("orm:persistence-unit-defaults");
descriptor.addMapping(persistenceUnitDefaultsMapping);
return descriptor;
}
Aggregations