org.mmbase.applications.xmlimporter
Interface ObjectMerger

All Known Implementing Classes:
BasicMerger

public interface ObjectMerger

This interface provides methods to customize the way objects are merged in a temporary cloud.

Since:
MMBase-1.5
Version:
$Id: ObjectMerger.java 35335 2009-05-21 08:14:41Z michiel $
Author:
Rob van Maris: Finalist IT Group

Method Summary
 boolean areDuplicates(TmpObject relation1, TmpObject relation2)
          Tests if two relations should be considered duplicates, indicating that one of them must be disposed of.
 void init(HashMap<String,String> params)
          Initialize this instance (called once per transaction).
 boolean isAllowedToAdd(TmpObject tmpObj)
          Tests if this object should be added to the persistent cloud when not present already.
 void mergeField(TmpObject tmpObj1, TmpObject tmpObj2, String name)
          Merges a field.
 void mergeRelations(TmpObject tmpObj1, TmpObject tmpObj2, List<TmpObject> relations1, List<TmpObject> relations2)
          Merges relations.
 

Method Detail

init

void init(HashMap<String,String> params)
          throws TransactionHandlerException
Initialize this instance (called once per transaction).

Parameters:
params - The initialization parameters, provided as name/value pairs (both String).
Throws:
TransactionHandlerException - if a failure occurred.

mergeField

void mergeField(TmpObject tmpObj1,
                TmpObject tmpObj2,
                String name)
Merges a field.

Parameters:
tmpObj1 - The first object to be merged. This will hold the resulting merged object afterwards.
tmpObj2 - The second object. this object must be deleted afterwards.
name - The name of the field. (Note: "number" and "owner" are not considered fields in this context, so this method will not be called with these values for name.)

mergeRelations

void mergeRelations(TmpObject tmpObj1,
                    TmpObject tmpObj2,
                    List<TmpObject> relations1,
                    List<TmpObject> relations2)
Merges relations.

Parameters:
tmpObj1 - The first object to be merged. This will hold the resulting merged object afterwards.
tmpObj2 - The second object. this object must be deleted afterwards.
relations1 - List of all relations of the first object (as TmpObject instances).
relations2 - List of all relations of the second object (as TmpObject instances).

areDuplicates

boolean areDuplicates(TmpObject relation1,
                      TmpObject relation2)
Tests if two relations should be considered duplicates, indicating that one of them must be disposed of. This test will only be called for pairs of relations that have already been verified to be of the same type, and have the same source and destination. This method may provide additional tests.

Parameters:
relation1 - The first relation.
relation2 - The second relation.
Returns:
true if these relations should be considered duplicates.

isAllowedToAdd

boolean isAllowedToAdd(TmpObject tmpObj)
Tests if this object should be added to the persistent cloud when not present already. When this returns false, the object will be deleted from the transaction if no object is found to merge it with.

Parameters:
tmpObj - The object.
Returns:
true If this object should be added, when not present already.


MMBase 2.0-SNAPSHOT - null