Project

General

Profile

Download (3.91 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.metadata.PreferenceSubject;
18
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
19

    
20
/**
21
 * Service API for CDM Preferences.
22
 *
23
 * STATE: UNDER CONSTRUCTION
24
 *
25
 * @author a.mueller
26
 * @since 03.06.2016
27
 */
28
public interface IPreferenceService {
29

    
30

    
31

    
32

    
33
 // ********************* GETTING **********************/
34

    
35

    
36
    /**
37
     * Return the number of all existing cdm preferences
38
     * @return
39
     */
40
    public int count();
41

    
42
     /**
43
      * Returns all CDM preferences.
44
      * @return
45
      */
46
     public List<CdmPreference> list();
47

    
48

    
49
     /**
50
     * Retrieve all matching values for the given preference key.
51
     * @param subject the {@link PreferenceSubject} represented as string
52
     * @param predicate the predicate to retrieve
53
     * @return
54
     */
55
     public List<CdmPreference> list(String subject, String predicate);
56

    
57

    
58
     /**
59
      * Retrieve the best matching value for the given preference key.
60
      * @param key the key defining the data to retrieve
61
      * @return
62
      */
63
     public CdmPreference find(PrefKey key);
64

    
65

    
66
  // Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
67
//     /**
68
//      * Retrieve the best matching value for the given preference key.
69
//      * @param subject
70
//      * @param predicate
71
//      * @return
72
//      */
73
//     public Object find(String subject, String predicate);
74

    
75
// Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
76
//     /**
77
//      * Retrieve the database wide preference for the given predicate.
78
//      * @param key
79
//      * @return
80
//      */
81
//     public CdmPreference findDatabase(String predicate);
82

    
83
     /**
84
      * Retrieve the database wide preference for the given predicate.
85
      * @param key
86
      * @return
87
      */
88
     public CdmPreference findDatabase(PreferencePredicate predicate);
89

    
90
     /**
91
      * Retrieve the vaadin wide preference for the given predicate.
92
      * @param key
93
      * @return
94
      */
95
     public CdmPreference findVaadin(PreferencePredicate predicate);
96

    
97
     /**
98
      * Returns the best matching preference that matches the given
99
      * predicate and the taxon node filter. Only DB preferences and
100
      * preferences defined on a TaxonNode are considered.
101
      * @param taxonNode
102
      * @param predicate
103
      * @return
104
      */
105
     public Object find(TaxonNode taxonNode, String predicate);
106

    
107
     public CdmPreference find(TaxonNode taxonNode, PreferencePredicate predicate);
108

    
109
     /**
110
      * Returns the best matching preference that matches the given
111
      * predicate and the filter. Only DB preferences and preferences
112
      * defined on a TaxonNode are considered.
113
      *
114
      * NOTE: This is not yet implemented!
115
      *
116
      * @param taxonNode
117
      * @param predicate
118
      * @return
119
      */
120
     public CdmPreference find(CdmBase taxonNodeRelatedCdmBase, String predicate);
121

    
122

    
123

    
124

    
125
 //******************* SETTING **********************/
126

    
127

    
128
     /**
129
      * Write the value for the preference's key
130
      * @param preference
131
      */
132
     public void set(CdmPreference preference);
133

    
134

    
135
     //we need to decide if we want to keep this method
136
//     //returns old value
137
//     String setCdmPrefs(CdmBase cdmBase, String predicate, String value );
138
//
139
////     String setEditorPrefs();
140

    
141

    
142

    
143

    
144
}
(54-54/105)