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