ref #6072 test missing entity in webservice
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IPreferenceService.java
1 /**
2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9 package eu.etaxonomy.cdm.api.service;
10
11 import java.util.List;
12
13 import eu.etaxonomy.cdm.model.common.CdmBase;
14 import eu.etaxonomy.cdm.model.metadata.CdmPreference;
15 import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
16 import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
17 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
18
19 /**
20 * Service API for CDM Preferences.
21 *
22 * STATE: UNDER CONSTRUCTION
23 *
24 * @author a.mueller
25 * @date 03.06.2016
26 */
27 public interface IPreferenceService {
28
29
30
31
32 // ********************* GETTING **********************/
33
34
35 /**
36 * Return the number of all existing cdm preferences
37 * @return
38 */
39 public int count();
40
41 /**
42 * Returns all CDM preferences.
43 * @return
44 */
45 public List<CdmPreference> list();
46
47
48 /**
49 * Retrieve all matching values for the given preference key.
50 * @param subject
51 * @param predicate
52 * @return
53 */
54 public List<CdmPreference> list(String subject, String predicate);
55
56
57 /**
58 * Retrieve the best matching value for the given preference key.
59 * @param key
60 * @return
61 */
62 public CdmPreference find(PrefKey key);
63
64
65 // Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
66 // /**
67 // * Retrieve the best matching value for the given preference key.
68 // * @param subject
69 // * @param predicate
70 // * @return
71 // */
72 // public Object find(String subject, String predicate);
73
74 // Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
75 // /**
76 // * Retrieve the database wide preference for the given predicate.
77 // * @param key
78 // * @return
79 // */
80 // public CdmPreference findDatabase(String predicate);
81
82 /**
83 * Retrieve the database wide preference for the given predicate.
84 * @param key
85 * @return
86 */
87 public CdmPreference findDatabase(PreferencePredicate predicate);
88
89
90 /**
91 * Returns the best matching preference that matches the given
92 * predicate and the taxon node filter. Only DB preferences and
93 * preferences defined on a TaxonNode are considered.
94 * @param taxonNode
95 * @param predicate
96 * @return
97 */
98 public Object find(TaxonNode taxonNode, String predicate);
99
100 public CdmPreference find(TaxonNode taxonNode, PreferencePredicate predicate);
101
102 /**
103 * Returns the best matching preference that matches the given
104 * predicate and the filter. Only DB preferences and preferences
105 * defined on a TaxonNode are considered.
106 *
107 * NOTE: This is not yet implemented!
108 *
109 * @param taxonNode
110 * @param predicate
111 * @return
112 */
113 public CdmPreference find(CdmBase taxonNodeRelatedCdmBase, String predicate);
114
115
116
117
118 //******************* SETTING **********************/
119
120
121 /**
122 * Write the value for the preference's key
123 * @param preference
124 */
125 public void set(CdmPreference preference);
126
127
128 //we need to decide if we want to keep this method
129 // //returns old value
130 // String setCdmPrefs(CdmBase cdmBase, String predicate, String value );
131 //
132 //// String setEditorPrefs();
133
134
135
136
137 }