ch.elca.el4j.services.persistence.generic.dao
Class IdentityFixerMergePolicy

java.lang.Object
  extended by ch.elca.el4j.services.persistence.generic.dao.IdentityFixerMergePolicy

public class IdentityFixerMergePolicy
extends Object

This class represents a policy on how to merge object graphs in the identity fixer.

Author:
Andreas Rueedlinger (ARR)
See Also:
AbstractIdentityFixer
File-location:
IdentityFixerMergePolicy
Last check-in date:
2009-08-04 14:35:53 +0200 (Di, 04. Aug 2009) by swismer for revision 3875

Nested Class Summary
static class IdentityFixerMergePolicy.UpdatePolicy
          This enumeration describes how the identity fixer should handle object updates.
 
Constructor Summary
protected IdentityFixerMergePolicy()
          Default constructor.
protected IdentityFixerMergePolicy(IdentityFixerMergePolicy.UpdatePolicy updatePolicy, List<Object> objectsToUpdate, boolean performPreparation, IdentityHashMap<Object,Object> collectionEntryMapping)
          Constructor to customize the policy.
 
Method Summary
static IdentityFixerMergePolicy customPolicy(IdentityFixerMergePolicy.UpdatePolicy updatePolicy, List<Object> objectsToUpdate, boolean performPreparation, IdentityHashMap<Object,Object> collectionEntryMapping)
           
static IdentityFixerMergePolicy extendOnlyPolicy()
           
static IdentityFixerMergePolicy extendOnlyPolicy(IdentityHashMap<Object,Object> collectionEntryMapping)
           
 IdentityHashMap<Object,Object> getCollectionEntryMapping()
           
 List<Object> getObjectsToUpdate()
           
 IdentityFixerMergePolicy.UpdatePolicy getUpdatePolicy()
           
 boolean needsPreparation()
           
static IdentityFixerMergePolicy reloadAllPolicy()
           
static IdentityFixerMergePolicy reloadAllPolicy(IdentityHashMap<Object,Object> collectionEntryMapping)
           
static IdentityFixerMergePolicy reloadObjectsPolicy(List<Object> objectsToUpdate)
           
static IdentityFixerMergePolicy reloadObjectsPolicy(List<Object> objectsToUpdate, IdentityHashMap<Object,Object> collectionEntryMapping)
           
 void setObjectsToUpdate(List<Object> objectsToUpdate)
          Set the objects to update explicitly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityFixerMergePolicy

protected IdentityFixerMergePolicy()
Default constructor. Sets update policy to all and preparation will be performed.


IdentityFixerMergePolicy

protected IdentityFixerMergePolicy(IdentityFixerMergePolicy.UpdatePolicy updatePolicy,
                                   List<Object> objectsToUpdate,
                                   boolean performPreparation,
                                   IdentityHashMap<Object,Object> collectionEntryMapping)
Constructor to customize the policy.

Parameters:
updatePolicy - the update policy to use.
objectsToUpdate - the objectsToUpdate if UDPATE_CHOSEN policy is chosen above.
performPreparation - should preparation be performed (eg. for unwrapping proxies).
collectionEntryMapping - the collectionEntryMapping [updated -> anchor] used to correctly merge collections.
Method Detail

getUpdatePolicy

public IdentityFixerMergePolicy.UpdatePolicy getUpdatePolicy()
Returns:
the update policy of this id fixer merge policy.

setObjectsToUpdate

public void setObjectsToUpdate(List<Object> objectsToUpdate)
Set the objects to update explicitly.

Parameters:
objectsToUpdate - the list of objects to update.

getObjectsToUpdate

public List<Object> getObjectsToUpdate()
Returns:
The objects to update, only set when getUpdatePolicy == UpdatePolicy.UPDATE_CHOSEN.

needsPreparation

public boolean needsPreparation()
Returns:
if preparation is needed.

getCollectionEntryMapping

public IdentityHashMap<Object,Object> getCollectionEntryMapping()
Returns:
A map of [updated -> anchor] used to correctly merge collections.

reloadAllPolicy

public static IdentityFixerMergePolicy reloadAllPolicy()
Returns:
a policy forcing all objects to be updated.

reloadObjectsPolicy

public static IdentityFixerMergePolicy reloadObjectsPolicy(List<Object> objectsToUpdate)
Parameters:
objectsToUpdate - the objects to be updated.
Returns:
a policy forcing only the specified objects to be updated, leaving the rest untouched.

extendOnlyPolicy

public static IdentityFixerMergePolicy extendOnlyPolicy()
Returns:
a policy leaving all the objects of the previous graph untouched, only extending it by the new objects.

reloadAllPolicy

public static IdentityFixerMergePolicy reloadAllPolicy(IdentityHashMap<Object,Object> collectionEntryMapping)
Parameters:
collectionEntryMapping - the collectionEntryMapping [updated -> anchor] used to correctly merge collections.
Returns:
a policy forcing all objects to be updated.

reloadObjectsPolicy

public static IdentityFixerMergePolicy reloadObjectsPolicy(List<Object> objectsToUpdate,
                                                           IdentityHashMap<Object,Object> collectionEntryMapping)
Parameters:
objectsToUpdate - the objects to be updated.
collectionEntryMapping - the collectionEntryMapping [updated -> anchor] used to correctly merge collections.
Returns:
a policy forcing only the specified objects to be updated, leaving the rest untouched.

extendOnlyPolicy

public static IdentityFixerMergePolicy extendOnlyPolicy(IdentityHashMap<Object,Object> collectionEntryMapping)
Parameters:
collectionEntryMapping - the collectionEntryMapping [updated -> anchor] used to correctly merge collections.
Returns:
a policy leaving all the objects of the previous graph untouched, only extending it by the new objects.

customPolicy

public static IdentityFixerMergePolicy customPolicy(IdentityFixerMergePolicy.UpdatePolicy updatePolicy,
                                                    List<Object> objectsToUpdate,
                                                    boolean performPreparation,
                                                    IdentityHashMap<Object,Object> collectionEntryMapping)
Parameters:
updatePolicy - the update policy to use.
objectsToUpdate - the objectsToUpdate if UDPATE_CHOSEN policy is chosen above.
performPreparation - should preparation be performed (eg. for unwrapping proxies).
collectionEntryMapping - the collectionEntryMapping [updated -> anchor] used to correctly merge collections.
Returns:
the custom policy specified by the arguments.


Copyright © 2005-2011 ELCA. All Rights Reserved.