3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.api
.service
;
13 import java
.util
.Collection
;
14 import java
.util
.List
;
18 import eu
.etaxonomy
.cdm
.database
.DatabaseSchemaMismatchException
;
19 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
20 import eu
.etaxonomy
.cdm
.model
.common
.CdmMetaData
;
21 import eu
.etaxonomy
.cdm
.model
.common
.ISourceable
;
22 import eu
.etaxonomy
.cdm
.model
.common
.OriginalSourceBase
;
23 import eu
.etaxonomy
.cdm
.model
.common
.CdmMetaData
.MetaDataPropertyName
;
24 import eu
.etaxonomy
.cdm
.strategy
.match
.IMatchStrategy
;
25 import eu
.etaxonomy
.cdm
.strategy
.match
.IMatchable
;
26 import eu
.etaxonomy
.cdm
.strategy
.match
.MatchException
;
27 import eu
.etaxonomy
.cdm
.strategy
.merge
.IMergable
;
28 import eu
.etaxonomy
.cdm
.strategy
.merge
.IMergeStrategy
;
29 import eu
.etaxonomy
.cdm
.strategy
.merge
.MergeException
;
32 public interface ICommonService
extends IService
<OriginalSourceBase
>{
34 // /** find cdmBase by UUID**/
35 // public abstract CdmBase getCdmBaseByUuid(UUID uuid);
37 // /** save a reference and return its UUID**/
38 // public abstract UUID saveCdmBase(CdmBase cdmBase);
44 public void saveAllMetaData(Collection
<CdmMetaData
> metaData
);
47 * Returns all meta data.
50 public Map
<MetaDataPropertyName
, CdmMetaData
> getCdmMetaData();
53 /** find cdmBase by UUID**/
54 public ISourceable
getSourcedObjectByIdInSource(Class clazz
, String idInSource
, String idNamespace
);
58 * Returns all CdmBase objects that reference the referencedCdmBase.
59 * For example, if referencedCdmBase is an agent it may return all taxon names
60 * that have this person as an author but also all books, articles, etc. that have
61 * this person as an author
62 * @param referencedCdmBase
65 public Set
<CdmBase
> getReferencingObjects(CdmBase referencedCdmBase
);
68 * Merges mergeSecond into mergeFirst. All references to mergeSecond will be replaced by references
69 * to merge first. If no merge strategy is defined (null), the DefaultMergeStrategy will be taken as default.
73 * @param mergeStrategy
74 * @throws MergeException
76 public <T
extends IMergable
> void merge(T mergeFirst
, T mergeSecond
, IMergeStrategy mergeStrategy
) throws MergeException
;
79 * Returns all objects that match the object to match according to the given match strategy.
80 * If no match strategy is defined the default match strategy is taken.
82 * @param objectToMatch
83 * @param matchStrategy
85 * @throws MatchException
87 public <T
extends IMatchable
> List
<T
> findMatching(T objectToMatch
, IMatchStrategy matchStrategy
) throws MatchException
;
90 public List
getHqlResult(String hqlQuery
);
92 public boolean isDatabaseSchemaCompatible();