1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.strategy.merge;
|
11
|
|
12
|
import java.util.Set;
|
13
|
|
14
|
import eu.etaxonomy.cdm.model.common.ICdmBase;
|
15
|
|
16
|
|
17
|
/**
|
18
|
* @author a.mueller
|
19
|
* @created 31.07.2009
|
20
|
* @version 1.0
|
21
|
*/
|
22
|
public interface IMergeStrategy {
|
23
|
|
24
|
public MergeMode getMergeMode(String propertyName);
|
25
|
|
26
|
/**
|
27
|
* Sets the merge mode for property propertyName
|
28
|
* @param propertyName
|
29
|
* @param mergeMode
|
30
|
* @throws MergeException
|
31
|
*/
|
32
|
public void setMergeMode(String propertyName, MergeMode mergeMode) throws MergeException;
|
33
|
|
34
|
/**
|
35
|
* Sets the default merge mode for all properties.
|
36
|
* The default merge mode is used if no more specific merge mode is defined for a certain property.
|
37
|
* @param mergeMode
|
38
|
*/
|
39
|
public void setDefaultMergeMode(MergeMode defaultMergeMode);
|
40
|
|
41
|
/**
|
42
|
* Sets the default merge mode for all collection properties.
|
43
|
* The default collection merge mode is used if no specific merge mode is defined for a certain collection property.
|
44
|
* @param mergeMode
|
45
|
*/
|
46
|
public void setDefaultCollectionMergeMode(MergeMode defaultCollectionMergeMode);
|
47
|
|
48
|
|
49
|
/**
|
50
|
* Merges mergeSecond into mergeFirst.
|
51
|
* Returns a set of CdmBases that became orphant during the merge process and
|
52
|
* therefore must be deleted from a persistent context.
|
53
|
* @param <T>
|
54
|
* @param mergeFirst
|
55
|
* @param mergeSecond
|
56
|
* @throws MergeException
|
57
|
*/
|
58
|
public <T extends IMergable> Set<ICdmBase> invoke(T mergeFirst, T mergeSecond) throws MergeException;
|
59
|
|
60
|
/**
|
61
|
* Merges mergeSecond into mergeFirst.
|
62
|
* Returns a set of CdmBases that became orphant during the merge process and
|
63
|
* therefore must be deleted from a persistent context.
|
64
|
* @param <T>
|
65
|
* @param mergeFirst
|
66
|
* @param mergeSecond
|
67
|
* @param clonedObjects a set of objects that needed to be cloned during merge.
|
68
|
* This set will be filled during merge and should preferably be empty at the beginning
|
69
|
* @throws MergeException
|
70
|
*/
|
71
|
public <T extends IMergable> Set<ICdmBase> invoke(T mergeFirst, T mergeSecond, Set<ICdmBase> clonedObjects) throws MergeException;
|
72
|
|
73
|
/**
|
74
|
* If set to true the merge will only reallocate all references that point
|
75
|
* to the second entity to the first entity. All data attached to the
|
76
|
* second entity will be completely lost. All data attached to the first
|
77
|
* entity will be saved as it is. All other {@link MergeMode} information will
|
78
|
* be neglected.<BR>
|
79
|
* The second entity will finally be deleted.
|
80
|
*
|
81
|
* #see {@link #setOnlyReallocateLinks(boolean)}
|
82
|
*/
|
83
|
public boolean isOnlyReallocateReferences();
|
84
|
|
85
|
// Removed as this is not yet implemented in underlying classes
|
86
|
// /**
|
87
|
// * Sets the onlyReallocateReferences parameter. See {@link #isOnlyReallocateReferences()}
|
88
|
// * for the parameters semantics.
|
89
|
// * @see #isOnlyReallocateReferences()
|
90
|
// * @param onlyReallocateReferences
|
91
|
// */
|
92
|
// public void setOnlyReallocateLinks(boolean onlyReallocateReferences);
|
93
|
|
94
|
}
|