Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.util
Class EntityMergeSupport

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

    public class EntityMergeSupport

extends Object

Implements methods for entity merging.

Field Summary
`protected List<EntityMergeListener>` | `listeners` Listeners of merge process.
`protected DataMap` | `map`
`protected NamingStrategy` | `namingStrategy` Strategy for choosing names for entities, attributes and relationships
`protected boolean` | `removeMeaningfulFKs`

Constructor Summary
`EntityMergeSupport(DataMap map)`
`EntityMergeSupport(DataMap map, NamingStrategy namingStrategy)`

Method Summary
`void` | `addEntityMergeListener(EntityMergeListener listener)` Registers new EntityMergeListener
`protected void` | `fireAttributeAdded(ObjAttribute attr)` Notifies all listeners that an ObjAttribute was added
`protected void` | `fireRelationshipAdded(ObjRelationship rel)` Notifies all listeners that an ObjRelationship was added
`protected List<DbAttribute>` | `getAttributesToAdd(ObjEntity objEntity)` Returns a list of attributes that exist in the DbEntity, but are missing from the ObjEntity.
`EntityMergeListener[]` | `getEntityMergeListeners()` Returns registered listeners
`DataMap` | `getMap()`
`Collection<DbAttribute>` | `getMeaningfulFKs(ObjEntity objEntity)` Returns a list of DbAttributes that are mapped to foreign keys.
`NamingStrategy` | `getNamingStrategy()`
`protected List<DbRelationship>` | `getRelationshipsToAdd(ObjEntity objEntity)`
`boolean` | `isRemoveMeaningfulFKs()`
`void` | `removeEntityMergeListener(EntityMergeListener listener)` Unregisters an EntityMergeListener
`void` | `setMap(DataMap map)`
`void` | `setNamingStrategy(NamingStrategy strategy)` Sets new naming strategy for reverse engineering
`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

### namingStrategy

    protected NamingStrategy namingStrategy

  Strategy for choosing names for entities, attributes and relationships

### listeners

    protected List<EntityMergeListener> listeners

  Listeners of merge process.

Constructor Detail

### EntityMergeSupport

    public EntityMergeSupport(DataMap map)

### EntityMergeSupport

    public EntityMergeSupport(DataMap map,
                              NamingStrategy namingStrategy)

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

### addEntityMergeListener

    public void addEntityMergeListener(EntityMergeListener listener)

  Registers new EntityMergeListener

### removeEntityMergeListener

    public void removeEntityMergeListener(EntityMergeListener listener)

  Unregisters an EntityMergeListener

### getEntityMergeListeners

    public EntityMergeListener[] getEntityMergeListeners()

  Returns registered listeners

### fireAttributeAdded

    protected void fireAttributeAdded(ObjAttribute attr)

  Notifies all listeners that an ObjAttribute was added

### fireRelationshipAdded

    protected void fireRelationshipAdded(ObjRelationship rel)

  Notifies all listeners that an ObjRelationship was added

### setNamingStrategy

    public void setNamingStrategy(NamingStrategy strategy)

  Sets new naming strategy for reverse engineering

### getNamingStrategy

    public NamingStrategy getNamingStrategy()

  Returns:
    naming strategy for reverse engineering

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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