public void setNullValue(Object object, Session session) { Object value = xmlDirectMapping.getAttributeValue(null, session); xmlDirectMapping.setAttributeValueInObject(object, value); }
/** * INTERNAL: * Return the mapping's attribute value from the row. * The execution session is passed for the case of building a UnitOfWork clone * directly from a row, the session set in the query will not know which platform to use * for converting the value. Allows the correct session to be passed in. */ public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) { // PERF: Direct variable access. boolean shouldCheckForXsiNil = getNullPolicy().isNullRepresentedByXsiNil(); return getAttributeValue(((DOMRecord)row).getIndicatingNoEntry(this.field, false, shouldCheckForXsiNil), executionSession, (XMLRecord)row); }
/** * INTERNAL: * Return the mapping's attribute value from the row. * The execution session is passed for the case of building a UnitOfWork clone * directly from a row, the session set in the query will not know which platform to use * for converting the value. Allows the correct session to be passed in. */ public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, AbstractSession executionSession) { // PERF: Direct variable access. boolean shouldCheckForXsiNil = getNullPolicy().isNullRepresentedByXsiNil(); return getAttributeValue(((DOMRecord)row).getIndicatingNoEntry(this.field, false, shouldCheckForXsiNil), executionSession, (XMLRecord)row); }
/** * INTERNAL: * Return the mapping's attribute value from the row. * The execution session is passed for the case of building a UnitOfWork clone * directly from a row, the session set in the query will not know which platform to use * for converting the value. Allows the correct session to be passed in. */ public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) { // PERF: Direct variable access. boolean shouldCheckForXsiNil = getNullPolicy().isNullRepresentedByXsiNil(); return getAttributeValue(((DOMRecord)row).getIndicatingNoEntry(this.field, false, shouldCheckForXsiNil), executionSession, (XMLRecord)row); }
public void attribute(UnmarshalRecord unmarshalRecord, String namespaceURI, String localName, String value) { unmarshalRecord.removeNullCapableValue(this); XMLField xmlField = (XMLField) xmlDirectMapping.getField(); Object realValue = xmlField.convertValueBasedOnSchemaType(value, (XMLConversionManager) unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager(), unmarshalRecord); // Perform operations on the object based on the null policy Object convertedValue = xmlDirectMapping.getAttributeValue(realValue, unmarshalRecord.getSession(), unmarshalRecord); xmlDirectMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), convertedValue); }
public void endElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord) { unmarshalRecord.removeNullCapableValue(this); XMLField xmlField = (XMLField) xmlDirectMapping.getField(); if (!xmlField.getLastXPathFragment().nameIsText()) { return; } Object value; if(unmarshalRecord.getStringBuffer().length() == 0) { value = this.getMapping().getNullValue(); } else { value = unmarshalRecord.getStringBuffer().toString(); } unmarshalRecord.resetStringBuffer(); XMLConversionManager xmlConversionManager = (XMLConversionManager) unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager(); if (unmarshalRecord.getTypeQName() != null) { Class typeClass = xmlField.getJavaClass(unmarshalRecord.getTypeQName()); value = xmlConversionManager.convertObject(value, typeClass, unmarshalRecord.getTypeQName()); } else { value = xmlField.convertValueBasedOnSchemaType(value, xmlConversionManager,unmarshalRecord); } Object convertedValue = xmlDirectMapping.getAttributeValue(value, unmarshalRecord.getSession(), unmarshalRecord); unmarshalRecord.setAttributeValue(convertedValue, xmlDirectMapping); }