CdmMetaData implemented (service layer)
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / ICommonService.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10
11 package eu.etaxonomy.cdm.api.service;
12
13 import java.util.Collection;
14 import java.util.List;
15 import java.util.Map;
16 import java.util.Set;
17
18 import eu.etaxonomy.cdm.model.common.CdmBase;
19 import eu.etaxonomy.cdm.model.common.CdmMetaData;
20 import eu.etaxonomy.cdm.model.common.ISourceable;
21 import eu.etaxonomy.cdm.model.common.OriginalSource;
22 import eu.etaxonomy.cdm.model.common.CdmMetaData.MetaDataPropertyName;
23 import eu.etaxonomy.cdm.strategy.match.IMatchStrategy;
24 import eu.etaxonomy.cdm.strategy.match.IMatchable;
25 import eu.etaxonomy.cdm.strategy.match.MatchException;
26 import eu.etaxonomy.cdm.strategy.merge.IMergable;
27 import eu.etaxonomy.cdm.strategy.merge.IMergeStrategy;
28 import eu.etaxonomy.cdm.strategy.merge.MergeException;
29
30
31 public interface ICommonService extends IService<OriginalSource>{
32 //
33 // /** find cdmBase by UUID**/
34 // public abstract CdmBase getCdmBaseByUuid(UUID uuid);
35 //
36 // /** save a reference and return its UUID**/
37 // public abstract UUID saveCdmBase(CdmBase cdmBase);
38
39 /**
40 * @param metaData
41 */
42 public void saveAll(Collection<CdmMetaData> metaData);
43
44 public Map<MetaDataPropertyName, CdmMetaData> getCdmMetaData();
45
46
47 /** find cdmBase by UUID**/
48 public ISourceable getSourcedObjectByIdInSource(Class clazz, String idInSource, String idNamespace);
49
50
51 /**
52 * Returns all CdmBase objects that reference the referencedCdmBase.
53 * For example, if referencedCdmBase is an agent it may return all taxon names
54 * that have this person as an author but also all books, articles, etc. that have
55 * this person as an author
56 * @param referencedCdmBase
57 * @return
58 */
59 public Set<CdmBase> getReferencingObjects(CdmBase referencedCdmBase);
60
61 /**
62 * Merges mergeSecond into mergeFirst. All references to mergeSecond will be replaced by references
63 * to merge first. If no merge strategy is defined (null), the DefaultMergeStrategy will be taken as default.
64 * @param <T>
65 * @param mergeFirst
66 * @param mergeSecond
67 * @param mergeStrategy
68 * @throws MergeException
69 */
70 public <T extends IMergable> void merge(T mergeFirst, T mergeSecond, IMergeStrategy mergeStrategy) throws MergeException;
71
72 /**
73 * Returns all objects that match the object to match according to the given match strategy.
74 * If no match strategy is defined the default match strategy is taken.
75 * @param <T>
76 * @param objectToMatch
77 * @param matchStrategy
78 * @return
79 * @throws MatchException
80 */
81 public <T extends IMatchable> List<T> findMatching(T objectToMatch, IMatchStrategy matchStrategy) throws MatchException;
82
83
84 public List getHqlResult(String hqlQuery);
85
86
87
88
89 }