HHH-6605: More conflicts merging

This commit is contained in:
Adam Warski 2012-01-20 20:57:40 +01:00
parent a00f23c6f6
commit 89bb7ec175
3 changed files with 19 additions and 16 deletions

View File

@ -1,6 +1,7 @@
package org.hibernate.envers.entities.mapper.relation; package org.hibernate.envers.entities.mapper.relation;
import org.hibernate.NonUniqueResultException; import org.hibernate.NonUniqueResultException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.envers.configuration.AuditConfiguration; import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.PropertyData; import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.exception.AuditException; import org.hibernate.envers.exception.AuditException;
@ -51,4 +52,17 @@ public abstract class AbstractOneToOneMapper extends AbstractToOneMapper {
*/ */
protected abstract Object queryForReferencedEntity(AuditReaderImplementor versionsReader, EntityInfo referencedEntity, protected abstract Object queryForReferencedEntity(AuditReaderImplementor versionsReader, EntityInfo referencedEntity,
Serializable primaryKey, Number revision); Serializable primaryKey, Number revision);
@Override
public void mapModifiedFlagsToMapFromEntity(SessionImplementor session, Map<String, Object> data, Object newObj, Object oldObj) {
}
@Override
public void mapModifiedFlagsToMapForCollectionChange(String collectionPropertyName, Map<String, Object> data) {
if (getPropertyData().isUsingModifiedFlag()) {
data.put(getPropertyData().getModifiedFlagPropertyName(), collectionPropertyName.equals(getPropertyData().getName()));
}
}
} }

View File

@ -54,15 +54,4 @@ public class OneToOneNotOwningMapper extends AbstractOneToOneMapper {
.add(AuditEntity.relatedId(owningReferencePropertyName).eq(primaryKey)) .add(AuditEntity.relatedId(owningReferencePropertyName).eq(primaryKey))
.getSingleResult(); .getSingleResult();
} }
@Override
public void mapModifiedFlagsToMapFromEntity(SessionImplementor session, Map<String, Object> data, Object newObj, Object oldObj) {
}
@Override
public void mapModifiedFlagsToMapForCollectionChange(String collectionPropertyName, Map<String, Object> data) {
if (propertyData.isUsingModifiedFlag()) {
data.put(propertyData.getModifiedFlagPropertyName(), collectionPropertyName.equals(propertyData.getName()));
}
}
} }

View File

@ -69,19 +69,19 @@ public class ToOneIdMapper extends AbstractToOneMapper {
@Override @Override
public void mapModifiedFlagsToMapFromEntity(SessionImplementor session, Map<String, Object> data, Object newObj, Object oldObj) { public void mapModifiedFlagsToMapFromEntity(SessionImplementor session, Map<String, Object> data, Object newObj, Object oldObj) {
if (propertyData.isUsingModifiedFlag()) { if (getPropertyData().isUsingModifiedFlag()) {
data.put(propertyData.getModifiedFlagPropertyName(), checkModified(session, newObj, oldObj)); data.put(getPropertyData().getModifiedFlagPropertyName(), checkModified(session, newObj, oldObj));
} }
} }
@Override @Override
public void mapModifiedFlagsToMapForCollectionChange(String collectionPropertyName, Map<String, Object> data) { public void mapModifiedFlagsToMapForCollectionChange(String collectionPropertyName, Map<String, Object> data) {
if (propertyData.isUsingModifiedFlag()) { if (getPropertyData().isUsingModifiedFlag()) {
data.put(propertyData.getModifiedFlagPropertyName(), collectionPropertyName.equals(propertyData.getName())); data.put(getPropertyData().getModifiedFlagPropertyName(), collectionPropertyName.equals(getPropertyData().getName()));
} }
} }
private boolean checkModified(SessionImplementor session, Object newObj, Object oldObj) { protected boolean checkModified(SessionImplementor session, Object newObj, Object oldObj) {
//noinspection SimplifiableConditionalExpression //noinspection SimplifiableConditionalExpression
return nonInsertableFake ? false : !Tools.entitiesEqual(session, referencedEntityName, newObj, oldObj); return nonInsertableFake ? false : !Tools.entitiesEqual(session, referencedEntityName, newObj, oldObj);
} }