/** * INTERNAL: * Directly build a change record without comparison */ @Override public ChangeRecord buildChangeRecord(Object clone, ObjectChangeSet owner, AbstractSession session) { return internalBuildChangeRecord(getAttributeValueFromObject(clone), null, owner); }
/** * PUBLIC: * Indicates if there is a converter on the mapping. */ public boolean hasConverter() { return getConverter() != null; }
/** * INTERNAL: * Build and return a new element based on the change set. */ public Object buildAddedElementFromChangeSet(Object changeSet, MergeManager mergeManager, AbstractSession targetSession) { return this.buildElementFromChangeSet(changeSet, mergeManager, targetSession); }
private Type getContainerType(final boolean isIndividual) { final XPathNodeWrapper currentNodeWrapper = getCurrentNodeWrapper(); if (currentNodeWrapper.nodeValue != null && currentNodeWrapper.nodeValue.isContainerValue()) { final DatabaseMapping mapping = currentNodeWrapper.nodeValue.getMapping(); Converter valueConverter = null; if (mapping != null) { if (isIndividual) { if (mapping instanceof AbstractCompositeDirectCollectionMapping) { valueConverter = ((AbstractCompositeDirectCollectionMapping) mapping).getValueConverter(); } else if (mapping instanceof XMLCompositeCollectionMapping) { valueConverter = ((XMLCompositeCollectionMapping) mapping).getConverter(); } } if (valueConverter instanceof TypeConversionConverter) { return ((TypeConversionConverter) valueConverter).getObjectClass(); } else if (mapping.getContainerPolicy() != null) { return mapping.getContainerPolicy().getContainerClass(); } } } return null; }
/** * INTERNAL: * Return the type of the map key, this will be overridden by container policies that allow maps. */ @Override public Object getKeyType() { return keyMapping.getMapKeyTargetType(); }
/** * INTERNAL: * Build and return a new element based on the change set. */ public Object buildAddedElementFromChangeSet(Object changeSet, MergeManager mergeManager, AbstractSession targetSession) { return this.buildElementFromChangeSet(changeSet, mergeManager, targetSession); }
/** * INTERNAL: * Return the classifiction for the field contained in the mapping. * This is used to convert the row value to a consistent java value. * By default this is unknown. */ public Class getFieldClassification(DatabaseField fieldToClassify) { return getAttributeElementClass(); }
/** * INTERNAL: * Return if this mapping supports change tracking. */ @Override public boolean isChangeTrackingSupported(Project project) { return ! isMutable(); }
/** * PUBLIC: * Indirection means that a ValueHolder will be put in-between the attribute and the real object. * This defaults to false and only required for transformations that perform database access. * @see #useBasicIndirection() */ public void useIndirection() { useBasicIndirection(); }
/** * INTERNAL: * Get a value from the object and set that in the respective field of the row. */ @Override public Object valueFromObject(Object object, DatabaseField field, AbstractSession session) { return invokeFieldTransformer(field, object, session); }
/** * INTERNAL: * Compare the non-null elements and return true if they are alike. */ public boolean compareElementsForChange(Object element1, Object element2, AbstractSession session) { return this.compareElements(element1, element2, session); }
/** * PUBLIC: * Indicates if there is a converter on the mapping. */ public boolean hasConverter() { return getConverter() != null; }
/** * Build a clone of the given element in a unitOfWork. */ public Object buildElementClone(Object attributeValue, Object parent, CacheKey cacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache){ return buildCloneValue(attributeValue, cloningSession); }
/** * INTERNAL: * Return if this mapping supports change tracking. */ @Override public boolean isChangeTrackingSupported(Project project) { return !isMutable(); }
/** * INTERNAL: * Create a query key that links to the map key. */ @Override public QueryKey createQueryKeyForMapKey() { return keyMapping.createQueryKeyForMapKey(); }
/** * INTERNAL: * Return any additional fields required by the policy for a fetch join. */ @Override public List<DatabaseField> getAdditionalFieldsForJoin(CollectionMapping baseMapping) { return keyMapping.getAllFieldsForMapKey(); }
/** * INTERNAL: * Compare the non-null elements and return true if they are alike. */ public boolean compareElementsForChange(Object element1, Object element2, AbstractSession session) { return this.compareElements(element1, element2, session); }
/** * INTERNAL: * Return the fields that make up the identity of the mapped object. For mappings with * a primary key, it will be the set of fields in the primary key. For mappings without * a primary key it will likely be all the fields * @return */ public List<DatabaseField> getIdentityFieldsForMapKey(){ return keyMapping.getIdentityFieldsForMapKey(); }
/** * PUBLIC: * Indicates if there is a converter on the mapping. */ public boolean hasConverter() { return getConverter() != null; }
/** * INTERNAL: * Build and return a new element based on the change set. */ public Object buildRemovedElementFromChangeSet(Object changeSet, MergeManager mergeManager, AbstractSession targetSession) { return this.buildElementFromChangeSet(changeSet, mergeManager, targetSession); }