/** * @param parentRecord * @param aNodeValue * @param aNullPolicy */ public CompositeObjectMappingContentHandler(UnmarshalRecord parentRecord, // XMLCompositeObjectMappingNodeValue aNodeValue, XMLCompositeObjectMapping aMapping, // Attributes atts, XPathFragment aFragment, XMLDescriptor aDescriptor) { super(parentRecord); attributes = atts; mapping = aMapping; nullPolicy = mapping.getNullPolicy(); nodeValue = aNodeValue; xPathFragment = aFragment; xmlDescriptor = aDescriptor; }
import org.eclipse.persistence.config.DescriptorCustomizer; import org.eclipse.persistence.descriptors.ClassDescriptor; import org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping; import org.eclipse.persistence.oxm.mappings.nullpolicy.XMLNullRepresentationType; public class RootEntityCustomizer implements DescriptorCustomizer { @Override public void customize(ClassDescriptor descriptor) throws Exception { XMLCompositeObjectMapping entityTwoMapping = (XMLCompositeObjectMapping) descriptor.getMappingForAttributeName("entityTwo"); entityTwoMapping.getNullPolicy().setNullRepresentedByEmptyNode(true); entityTwoMapping.getNullPolicy().setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE); } }
public boolean isNullCapableValue() { XMLField xmlField = (XMLField)xmlCompositeObjectMapping.getField(); if (xmlField.getLastXPathFragment().isSelfFragment) { return false; } return xmlCompositeObjectMapping.getNullPolicy().getIsSetPerformedForAbsentNode(); }
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return null; } XMLRecord nestedRow = (XMLRecord) this.getDescriptor().buildNestedRowFromFieldValue(fieldValue); // Check the policy to see if this DOM record represents null if (getNullPolicy().valueIsNull((Element) nestedRow.getDOM())) { return null; } return valueFromRow(fieldValue, nestedRow, joinManager, sourceQuery, executionSession, isTargetProtected); }
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) throws DatabaseException { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return null; } XMLRecord nestedRow = (XMLRecord) this.getDescriptor().buildNestedRowFromFieldValue(fieldValue); // Check the policy to see if this DOM record represents null if (getNullPolicy().valueIsNull((Element) nestedRow.getDOM())) { return null; } return valueFromRow(fieldValue, nestedRow, joinManager, sourceQuery, executionSession); }
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return null; } XMLRecord nestedRow = (XMLRecord) this.getDescriptor().buildNestedRowFromFieldValue(fieldValue); // Check the policy to see if this DOM record represents null if (getNullPolicy().valueIsNull((Element) nestedRow.getDOM())) { return null; } return valueFromRow(fieldValue, nestedRow, joinManager, sourceQuery, executionSession, isTargetProtected); }
if (attributeValue != null) { fieldValue = buildCompositeRow(attributeValue, session, record, WriteType.UNDEFINED); } else if (getNullPolicy().compositeObjectMarshal(record, parent, (XMLField) getField(), session)) {
if (attributeValue != null) { fieldValue = buildCompositeRow(attributeValue, session, record, WriteType.UNDEFINED); } else if (getNullPolicy().compositeObjectMarshal(record, parent, (XMLField) getField(), session)) {
if (attributeValue != null) { fieldValue = buildCompositeRow(attributeValue, session, record); } else if (getNullPolicy().compositeObjectMarshal(record, parent, (XMLField) getField(), session)) {
public void endSelfNodeValue(UnmarshalRecord unmarshalRecord, Attributes attributes) { if(xmlCompositeObjectMapping.getNullPolicy().valueIsNull(attributes)){ xmlCompositeObjectMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), null); return;
if(xmlCompositeObjectMapping.getNullPolicy().isNullRepresentedByEmptyNode() || xmlCompositeObjectMapping.getNullPolicy().isNullRepresentedByXsiNil()) { String qnameString = xPathFragment.getLocalName(); if(xPathFragment.getPrefix() != null) { boolean isNull = xmlCompositeObjectMapping.getNullPolicy().valueIsNull(atts); if (isNull) { xmlCompositeObjectMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), null);
if (getNullPolicy().getIsSetPerformedForAbsentNode()) { setAttributeValueInObject(targetObject, null); } else { if (getNullPolicy().valueIsNull((Element) nestedRow.getDOM())) { setAttributeValueInObject(targetObject, null); return null;
if (getNullPolicy().getIsSetPerformedForAbsentNode()) { setAttributeValueInObject(targetObject, null); } else { if (getNullPolicy().valueIsNull((Element) nestedRow.getDOM())) { setAttributeValueInObject(targetObject, null); return null;
if (getNullPolicy().getIsSetPerformedForAbsentNode()) { setAttributeValueInObject(targetObject, null); } else { if (getNullPolicy().valueIsNull((Element) nestedRow.getDOM())) { setAttributeValueInObject(targetObject, null); return null;
return xmlCompositeObjectMapping.getNullPolicy().compositeObjectMarshal(xPathFragment, marshalRecord, object, session, namespaceResolver);
isNillable = ((XMLCompositeObjectMapping) mapping).getNullPolicy().isNullRepresentedByXsiNil(); } else { isNillable = ((XMLCompositeCollectionMapping) mapping).getNullPolicy().isNullRepresentedByXsiNil();