| java.lang.Object com.sourcetap.sfa.replication.GenericReplicator com.sourcetap.sfa.replication.EntityReplicator
All known Subclasses: com.sourcetap.sfa.replication.AccountReplicator, com.sourcetap.sfa.replication.ProductCategoryReplicator, com.sourcetap.sfa.replication.ActivityReplicator, com.sourcetap.sfa.replication.EntityAccessReplicator, com.sourcetap.sfa.replication.ProductReplicator, com.sourcetap.sfa.replication.FileAttachmentReplicator, com.sourcetap.sfa.replication.FullReplicator, com.sourcetap.sfa.replication.TeamReplicator, com.sourcetap.sfa.replication.DealReplicator, com.sourcetap.sfa.replication.ContactReplicator, com.sourcetap.sfa.replication.FileReplicator, com.sourcetap.sfa.replication.ItIssueReplicator, com.sourcetap.sfa.replication.ItIssueHistoryReplicator,
EntityReplicator | public class EntityReplicator extends GenericReplicator (Code) | | This class is used for entity instance replication.
Typically this class, or its descendant, is used to replicate a single instance
of an entity. This is accomplished by instantiating this class and calling its
replicateInstance() method.
For each instance replicated, one or more related entity instances may be replicated
when the replicateAllRelated() method is called automatically by the replicateInstance()
method. If the relatedEntityMapVector attribute has been populated, the
replicateAllRelated() method will call the replicateOneRelated() method for each item in
the vector to replicate one entities instances. The related entities are located in the
findOneRelated() method, which is called by replicateOneRelated(). For each related
entity instance found, another instance of this class is used to replicate it.
Entity replication is used to do full replication. Full replication is required to
populate a newly registered replication node, or to re-populate an inactive
replication node. To perform full replication, the relatedEntityMapVector should be
populated with a list of all entities to be removed and replicated, and the information
required to find them. Then the removeAll() and replicateAll() methods
should be called.
author: John Nutting |
Method Summary | |
public void | addRelatedEntityMap(HashMap relatedEntityMap) Adds a related entity map to the related entity map vector. | public void | addRelatedEntityMap(String relationTitle, String relatedEntityName, HashMap filterMap, boolean replicateAll, boolean removeAll, String replicatorClassName) Adds a related entity map to the related entity map vector. | protected List | findOneRelated(GenericDelegator delegator, GenericValue mainInstance, String relationTitle, String relatedEntityName, HashMap filterMap, boolean findAll) This method finds all instances of an entity related to the main entity. | public String | getEntityName() Gets the name of the entity to be replicated. | public static EntityReplicator | getEntityReplicator(String className, GenericDelegator localDelegator, GenericDelegator masterDelegator, String entityName, UserInfo userInfo) Instantiates EntityReplicator or one of its descendant classes. | public Vector | getRelatedEntityMapVector() Gets the related entity map vector. | public UserInfo | getUserInfo() | public int | insertLocalInstance(GenericValue masterInstance) This method stores the instance in the local data base.
author: John Nutting Parameters: masterInstance - Entity instance from the master data base Status. | public void | populateRelatedEntityMapVector() Populate the related entity map vector. | public int | removeAllRelated(GenericValue localInstance) This method removes all instances for all related entities. | public int | removeInstance(GenericValue mainInstance) This method removes one instance of the entity named in the entityName attribute. | public int | removeLocalInstance(GenericValue localInstance) This method removes an instance of the main entity from the local data base.
author: John Nutting Parameters: localInstance - Entity instance being removed Status. | protected int | removeOneRelated(GenericValue mainInstance, String relationTitle, String relatedEntityName, HashMap filterMap, boolean removeAll, String replicatorClassName) This method removes all instances for one entity related to the main entity. | public int | replicateAllRelated(GenericValue mainInstance) This method replicates all instances for all related entities. | public int | replicateInstance(GenericValue mainInstance) This method replicates one instance of the entity named in the entityName attribute. | protected int | replicateOneRelated(GenericValue mainInstance, String relationTitle, String relatedEntityName, HashMap filterMap, boolean replicateAll, String replicatorClassName) This method replicates all instances for one entity related to the main entity. | public void | setEntityName(String entityName_) Sets the name of the entity to be replicated. | public void | setUserInfo(UserInfo userInfo_) |
entityName | protected String entityName(Code) | | The name of the entity to be replicated.
|
relatedEntityMapVector | protected Vector relatedEntityMapVector(Code) | | Related Entity Map Vector
Each vector element contains a HashMap describing a related entity to be replicated
for each instance of the main entity that is replicated.
Each HashMap contains:
String relationTitle
String relatedEntityName
HashMap filterMap
String replicatorClassName
Boolean replicateAll
Boolean removeAll
|
EntityReplicator | public EntityReplicator()(Code) | | Constructor with no args.
|
EntityReplicator | public EntityReplicator(GenericDelegator localDelegator, GenericDelegator masterDelegator, String entityName, UserInfo userInfo)(Code) | | Constructor with args.
Parameters: mainInstance - Main entity instance for which related entities will be replicated Parameters: localDelegator - Delegator to attach to local data base Parameters: masterDelegator - Delegator to attach to master data base Parameters: entityName - Name of the entity to be replicated Parameters: userInfo - UserInfo object containing user information |
addRelatedEntityMap | public void addRelatedEntityMap(HashMap relatedEntityMap)(Code) | | Adds a related entity map to the related entity map vector.
author: John Nutting Parameters: relatedEntityMap - HashMap containing information about a releated entity |
addRelatedEntityMap | public void addRelatedEntityMap(String relationTitle, String relatedEntityName, HashMap filterMap, boolean replicateAll, boolean removeAll, String replicatorClassName)(Code) | | Adds a related entity map to the related entity map vector.
author: John Nutting Parameters: relationTitle - Relation title to be used by the entity engine to find relatedentity instances Parameters: relatedEntityName - Name of the related entity to be replicated Parameters: filterMap - HashMap containing additional filter values to be used by the entityengine when finding related entity instances Parameters: replicateAll - Flag indicating to replicate all instances of this entityinstead of just the ones related to the main entity. Parameters: removeAll - Flag indicating to remove all instances of this entity instead ofjust the ones related to the main entity. Parameters: replicatorClassName - Name of a descendant class of this class which will be usedto replicate the related entity instances |
findOneRelated | protected List findOneRelated(GenericDelegator delegator, GenericValue mainInstance, String relationTitle, String relatedEntityName, HashMap filterMap, boolean findAll)(Code) | | This method finds all instances of an entity related to the main entity.
This is used for replicating and removing, so it accepts the delegator as an
argument to point it to the correct data base.
author: John Nutting Parameters: mainInstance - Main entity instance for which related entities will be replicated Parameters: relationTitle - Relation title to be used by the entity engine to find relatedentity instances Parameters: relatedEntityName - Name of the related entity to be replicated Parameters: filterMap - HashMap containing additional filter values to be used by the entityengine when finding related entity instances Parameters: findAll - Flag indicating to find all instances of the entity instead of usinga relation List of generic values related to the main entity instance |
getEntityName | public String getEntityName()(Code) | | Gets the name of the entity to be replicated.
author: John Nutting Name of the entity to be replicated |
getRelatedEntityMapVector | public Vector getRelatedEntityMapVector()(Code) | | Gets the related entity map vector.
author: John Nutting Related entity map vector. |
insertLocalInstance | public int insertLocalInstance(GenericValue masterInstance)(Code) | | This method stores the instance in the local data base.
author: John Nutting Parameters: masterInstance - Entity instance from the master data base Status. Possible values: STATUS_CONTINUE, STATUS_ERROR, STATUS_CANCELED |
populateRelatedEntityMapVector | public void populateRelatedEntityMapVector()(Code) | | Populate the related entity map vector. This method is called from the constructors
to allow the related entities to be specified before replication begins.
author: John Nutting |
removeAllRelated | public int removeAllRelated(GenericValue localInstance)(Code) | | This method removes all instances for all related entities.
This method uses the relatedEntityMapVector to determine what related
entities need to be removed. For each related entity, this method calls
removeOneRelated(). Each call to removeOneRelated() calls
findOneRelated(), which finds all instances of the specified entity. Then
removeOneRelated() calls removeLocalInstance for each instance of the
related entity to recursively replicate the tree of instances.
author: John Nutting Parameters: localInstance - Local entity from which related entity instances are to be removed Status. Possible values: STATUS_CONTINUE, STATUS_ERROR, STATUS_CANCELED |
removeInstance | public int removeInstance(GenericValue mainInstance)(Code) | | This method removes one instance of the entity named in the entityName attribute.
First the removeRelatedEntities() method is called so child entity instances
can be removed from the local data base. Then the instance passed in the
instance argument is removed from the local data base.
author: John Nutting Parameters: mainInstance - Entity instance being replicated The status of the replication. Possible values: STATUS_CONTINUE, STATUS_ERROR,STATUS_CANCEL |
removeLocalInstance | public int removeLocalInstance(GenericValue localInstance)(Code) | | This method removes an instance of the main entity from the local data base.
author: John Nutting Parameters: localInstance - Entity instance being removed Status. Possible values: STATUS_CONTINUE, STATUS_ERROR, STATUS_CANCELED |
removeOneRelated | protected int removeOneRelated(GenericValue mainInstance, String relationTitle, String relatedEntityName, HashMap filterMap, boolean removeAll, String replicatorClassName)(Code) | | This method removes all instances for one entity related to the main entity.
This method calls findOneRelated(), which finds all instances of the related entity.
Then this method calls removeInstance for each instance of the
related entity to recursively replicate the tree of instances.
author: John Nutting Parameters: mainInstance - Main entity instance for which related entities will be replicated Parameters: relationTitle - Relation title to be used by the entity engine to find relatedentity instances Parameters: relatedEntityName - Name of the related entity to be replicated Parameters: filterMap - HashMap containing additional filter values to be used by the entityengine when finding related entity instances Parameters: removeAll - Flag indicating to remove all instances of this entity instead ofjust removing the ones related to the main entity. Parameters: replicatorClassName - Name of a descendant class of this class which will be usedto replicate the related entity instances Status. Possible values: STATUS_CONTINUE, STATUS_ERROR, STATUS_CANCELED |
replicateAllRelated | public int replicateAllRelated(GenericValue mainInstance)(Code) | | This method replicates all instances for all related entities.
This method uses the relatedEntityMapVector to determine what related
entities need to be replicated. For each related entity, this method calls
replicateOneRelated(). Each call to replicateOneRelated() calls
findOneRelated(), which finds all instances of the specified entity. Then
replicateOneRelated() calls replicateInstance for each instance of the
related entity to recursively replicate the tree of instances.
author: John Nutting Parameters: mainInstance - Main entity instance for which related entities will be replicated Status. Possible values: STATUS_CONTINUE, STATUS_ERROR, STATUS_CANCELED |
replicateInstance | public int replicateInstance(GenericValue mainInstance)(Code) | | This method replicates one instance of the entity named in the entityName attribute.
Ths instance passed in the instance argument is copied from the master data base
to the local data base. Then the replicateRelatedEntities() method is
called so child entity instance can be replicated.
This method requires that all arguments passed to the constructor were not null and
not empty. Alternatively, this method requires the setEntityName, setLocalDelegator,
and setMasterDelegator methods to have been called since construction.
author: John Nutting Parameters: mainInstance - Entity instance being replicated The status of the replication. Possible values: STATUS_CONTINUE, STATUS_ERROR,STATUS_CANCEL |
replicateOneRelated | protected int replicateOneRelated(GenericValue mainInstance, String relationTitle, String relatedEntityName, HashMap filterMap, boolean replicateAll, String replicatorClassName)(Code) | | This method replicates all instances for one entity related to the main entity.
This method calls findOneRelated(), which finds all instances of the related entity.
Then this method calls replicateInstance for each instance of the
related entity to recursively replicate the tree of instances.
author: John Nutting Parameters: mainInstance - Main entity instance for which related entities will be replicated Parameters: relationTitle - Relation title to be used by the entity engine to find relatedentity instances Parameters: relatedEntityName - Name of the related entity to be replicated Parameters: filterMap - HashMap containing additional filter values to be used by the entityengine when finding related entity instances Parameters: replicatorClassName - Name of a descendant class of this class which will be usedto replicate the related entity instances Status. Possible values: STATUS_CONTINUE, STATUS_ERROR, STATUS_CANCELED |
setEntityName | public void setEntityName(String entityName_)(Code) | | Sets the name of the entity to be replicated.
author: John Nutting Parameters: entityName_ - Name of the entity to be replicated |
setUserInfo | public void setUserInfo(UserInfo userInfo_)(Code) | | Sets the user information
author: John Nutting Parameters: userInfo_ - UserInfo object |
|
|