org.apache.cayenne.util
Class EntityMergeSupport

java.lang.Object
  extended by org.apache.cayenne.util.EntityMergeSupport

public class EntityMergeSupport
extends Object

Implements methods for entity merging.

Author:
Andrus Adamchik

Field Summary
protected  DataMap map
           
protected  boolean removeMeaningfulFKs
           
 
Constructor Summary
EntityMergeSupport(DataMap map)
           
 
Method Summary
protected  List<DbAttribute> getAttributesToAdd(ObjEntity objEntity)
          Returns a list of attributes that exist in the DbEntity, but are missing from the ObjEntity.
 DataMap getMap()
           
 Collection<DbAttribute> getMeaningfulFKs(ObjEntity objEntity)
          Returns a list of DbAttributes that are mapped to foreign keys.
protected  List<DbRelationship> getRelationshipsToAdd(ObjEntity objEntity)
           
 boolean isRemoveMeaningfulFKs()
           
 void setMap(DataMap map)
           
 void setRemoveMeaningfulFKs(boolean removeMeaningfulFKs)
           
 boolean synchronizeWithDbEntities(Collection<ObjEntity> objEntities)
          Updates each one of the collection of ObjEntities, adding attributes and relationships based on the current state of its DbEntity.
 boolean synchronizeWithDbEntity(ObjEntity entity)
          Updates ObjEntity attributes and relationships based on the current state of its DbEntity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected DataMap map

removeMeaningfulFKs

protected boolean removeMeaningfulFKs
Constructor Detail

EntityMergeSupport

public EntityMergeSupport(DataMap map)
Method Detail

synchronizeWithDbEntities

public boolean synchronizeWithDbEntities(Collection<ObjEntity> objEntities)
Updates each one of the collection of ObjEntities, adding attributes and relationships based on the current state of its DbEntity.

Returns:
true if any ObjEntity has changed as a result of synchronization.
Since:
1.2 changed signature to use Collection instead of List.

synchronizeWithDbEntity

public boolean synchronizeWithDbEntity(ObjEntity entity)
Updates ObjEntity attributes and relationships based on the current state of its DbEntity.

Returns:
true if the ObjEntity has changed as a result of synchronization.

getMeaningfulFKs

public Collection<DbAttribute> getMeaningfulFKs(ObjEntity objEntity)
Returns a list of DbAttributes that are mapped to foreign keys.

Since:
1.2

getAttributesToAdd

protected List<DbAttribute> getAttributesToAdd(ObjEntity objEntity)
Returns a list of attributes that exist in the DbEntity, but are missing from the ObjEntity.


getRelationshipsToAdd

protected List<DbRelationship> getRelationshipsToAdd(ObjEntity objEntity)

getMap

public DataMap getMap()

setMap

public void setMap(DataMap map)

isRemoveMeaningfulFKs

public boolean isRemoveMeaningfulFKs()
Since:
1.2

setRemoveMeaningfulFKs

public void setRemoveMeaningfulFKs(boolean removeMeaningfulFKs)
Since:
1.2


Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.