Revision 69e00fde
Added by Andreas Müller almost 8 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IPreferenceService.java | ||
---|---|---|
5 | 5 |
* |
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 |
*/
|
|
8 |
*/ |
|
9 | 9 |
package eu.etaxonomy.cdm.api.service; |
10 | 10 |
|
11 |
import java.util.List; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
11 | 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; |
|
12 | 18 |
|
13 | 19 |
/** |
20 |
* Service API for CDM Preferences. |
|
21 |
* |
|
22 |
* STATE: UNDER CONSTRUCTION |
|
23 |
* |
|
14 | 24 |
* @author a.mueller |
15 |
* @created 2013-09-09
|
|
25 |
* @date 03.06.2016
|
|
16 | 26 |
*/ |
17 | 27 |
public interface IPreferenceService { |
18 | 28 |
|
19 |
/** |
|
20 |
* Retrieve the best matching value for the given preference key. |
|
21 |
* @param key |
|
22 |
* @return |
|
23 |
*/ |
|
24 |
public CdmPreference get(CdmPreference.PrefKey key); |
|
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 the best matching value for the given preference key. |
|
50 |
* @param key |
|
51 |
* @return |
|
52 |
*/ |
|
53 |
public CdmPreference find(PrefKey key); |
|
54 |
|
|
55 |
|
|
56 |
// Can not yet be created as we allow only PreferencePredicate for predicate key creation now. |
|
57 |
// /** |
|
58 |
// * Retrieve the best matching value for the given preference key. |
|
59 |
// * @param subject |
|
60 |
// * @param predicate |
|
61 |
// * @return |
|
62 |
// */ |
|
63 |
// public Object find(String subject, String predicate); |
|
64 |
|
|
65 |
// Can not yet be created as we allow only PreferencePredicate for predicate key creation now. |
|
66 |
// /** |
|
67 |
// * Retrieve the database wide preference for the given predicate. |
|
68 |
// * @param key |
|
69 |
// * @return |
|
70 |
// */ |
|
71 |
// public CdmPreference findDatabase(String predicate); |
|
72 |
|
|
73 |
/** |
|
74 |
* Retrieve the database wide preference for the given predicate. |
|
75 |
* @param key |
|
76 |
* @return |
|
77 |
*/ |
|
78 |
public CdmPreference findDatabase(PreferencePredicate predicate); |
|
79 |
|
|
80 |
|
|
81 |
/** |
|
82 |
* Retrieve all matching values for the given preference key. |
|
83 |
* @param subject |
|
84 |
* @param predicate |
|
85 |
* @return |
|
86 |
*/ |
|
87 |
public List<Object> findAll(String subject, String predicate); |
|
88 |
|
|
89 |
/** |
|
90 |
* Returns the best matching preference that matches the given |
|
91 |
* predicate and the taxon node filter. Only DB preferences and |
|
92 |
* preferences defined on a TaxonNode are considered. |
|
93 |
* @param taxonNode |
|
94 |
* @param predicate |
|
95 |
* @return |
|
96 |
*/ |
|
97 |
public Object find(TaxonNode taxonNode, String predicate); |
|
98 |
|
|
99 |
public CdmPreference find(TaxonNode taxonNode, PreferencePredicate predicate); |
|
100 |
|
|
101 |
/** |
|
102 |
* Returns the best matching preference that matches the given |
|
103 |
* the predicate and the filter. Only DB preferences and preferences |
|
104 |
* defined on a TaxonNode are considered. |
|
105 |
* @param taxonNode |
|
106 |
* @param predicate |
|
107 |
* @return |
|
108 |
*/ |
|
109 |
public Object find(CdmBase taxonNode, String predicate); |
|
110 |
|
|
111 |
public List<Object> findAll(); |
|
112 |
|
|
113 |
//******************* SETTING **********************/ |
|
114 |
|
|
115 |
|
|
116 |
//returns old value |
|
117 |
String setCdmPrefs(CdmBase cdmBase, String predicate, String value ); |
|
118 |
|
|
119 |
// String setEditorPrefs(); |
|
120 |
|
|
121 |
|
|
25 | 122 |
|
26 | 123 |
/** |
27 | 124 |
* Write the value for the preference's key |
28 | 125 |
* @param preference |
29 | 126 |
*/ |
30 | 127 |
public void set(CdmPreference preference); |
31 |
|
|
32 |
/** |
|
33 |
* Return the number of all existing cdm preferences |
|
34 |
* @return |
|
35 |
*/ |
|
36 |
public int count(); |
|
128 |
|
|
37 | 129 |
|
38 | 130 |
} |
Also available in: Unified diff
Further develop the CDM preferences #3958