2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.strategy
.merge
;
13 import eu
.etaxonomy
.cdm
.model
.common
.ICdmBase
;
19 public interface IMergeStrategy
{
21 public MergeMode
getMergeMode(String propertyName
);
24 * Sets the merge mode for property propertyName
27 * @throws MergeException
29 public void setMergeMode(String propertyName
, MergeMode mergeMode
) throws MergeException
;
32 * Sets the default merge mode for all properties.
33 * The default merge mode is used if no more specific merge mode is defined for a certain property.
36 public void setDefaultMergeMode(MergeMode defaultMergeMode
);
39 * Sets the default merge mode for all collection properties.
40 * The default collection merge mode is used if no specific merge mode is defined for a certain collection property.
43 public void setDefaultCollectionMergeMode(MergeMode defaultCollectionMergeMode
);
47 * Merges mergeSecond into mergeFirst.
48 * Returns a set of CdmBases that became orphant during the merge process and
49 * therefore must be deleted from a persistent context.
53 * @throws MergeException
55 public <T
extends IMergable
> Set
<ICdmBase
> invoke(T mergeFirst
, T mergeSecond
) throws MergeException
;
58 * Merges mergeSecond into mergeFirst.
59 * Returns a set of CdmBases that became orphant during the merge process and
60 * therefore must be deleted from a persistent context.
64 * @param clonedObjects a set of objects that needed to be cloned during merge.
65 * This set will be filled during merge and should preferably be empty at the beginning
66 * @throws MergeException
68 public <T
extends IMergable
> Set
<ICdmBase
> invoke(T mergeFirst
, T mergeSecond
, Set
<ICdmBase
> clonedObjects
) throws MergeException
;
71 * If set to true the merge will only reallocate all references that point
72 * to the second entity to the first entity. All data attached to the
73 * second entity will be completely lost. All data attached to the first
74 * entity will be saved as it is. All other {@link MergeMode} information will
76 * The second entity will finally be deleted.
78 * #see {@link #setOnlyReallocateLinks(boolean)}
80 public boolean isOnlyReallocateReferences();
82 // Removed as this is not yet implemented in underlying classes
84 // * Sets the onlyReallocateReferences parameter. See {@link #isOnlyReallocateReferences()}
85 // * for the parameters semantics.
86 // * @see #isOnlyReallocateReferences()
87 // * @param onlyReallocateReferences
89 // public void setOnlyReallocateLinks(boolean onlyReallocateReferences);