Project

General

Profile

Download (3.4 KB) Statistics
| Branch: | Tag: | Revision:
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 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

    
122

    
123
	/**
124
	 * Write the value for the preference's key
125
	 * @param preference
126
	 */
127
	public void set(CdmPreference preference);
128

    
129

    
130
}
(54-54/97)