merge
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / main / java / eu / etaxonomy / taxeditor / service / ICachedCommonService.java
1 // $Id$
2 /**
3 * Copyright (C) 2014 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 package eu.etaxonomy.taxeditor.service;
11
12 import java.util.UUID;
13
14 import eu.etaxonomy.cdm.model.common.CdmBase;
15
16 /**
17 * @author cmathew
18 * @date 14 Oct 2014
19 *
20 */
21 public interface ICachedCommonService {
22
23 public CdmBase find(Class<? extends CdmBase> clazz, int id);
24
25
26 /**
27 * Initializes a collection or map.
28 *
29 * @param ownerUuid uuid of owner cdm entity
30 * @param fieldName field name of collection or map
31 * @return initialised collection or map
32 */
33 public Object initializeCollection(UUID ownerUuid, String fieldName);
34
35 /**
36 * Checks if a collection or map is empty.
37 *
38 * @param ownerUuid uuid of owner cdm entity
39 * @param fieldName field name of collection or map
40 * @return true if the collection of map is empty, else false
41 */
42 public boolean isEmpty(UUID ownerUuid, String fieldName);
43
44 /**
45 * Returns the size of requested collection or map.
46 *
47 * @param ownerUuid uuid of owner cdm entity
48 * @param fieldName field name of collection or map
49 * @return the size of the persistent collection
50 */
51 public int size(UUID ownerUuid, String fieldName);
52
53 /**
54 * Checks whether an object is contained within a persistent collection.
55 *
56 * @param ownerUuid uuid of owner cdm entity
57 * @param fieldName field name of collection or map
58 * @param element the element to check for
59 * @return true if the element exists in the collection, false o/w
60 */
61 public boolean contains(UUID ownerUuid, String fieldName, Object element);
62
63 /**
64 * Checks whether an index object exists within a persistent collection
65 * (usually a map)
66 *
67 * @param ownerUuid uuid of owner cdm entity
68 * @param fieldName field name of map
69 * @param key the index object to look for.
70 * @return true if the index object exists in the collection, false o/w
71 */
72 public boolean containsKey(UUID ownerUuid, String fieldName, Object key);
73
74 /**
75 * checks whether an value object exists within a persistent collection
76 * (usually a map)
77 *
78 * @param ownerUuid uuid of owner cdm entity
79 * @param fieldName field name of map
80 * @param key the value object to look for.
81 * @return true if the value object exists in the collection, false o/w
82 */
83 public boolean containsValue(UUID ownerUuid, String fieldName, Object element);
84
85
86
87
88 }