2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.api
.service
;
11 import java
.util
.List
;
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
.IPreferencePredicate
;
17 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferenceSubject
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
21 * Service API for CDM Preferences.
23 * STATE: UNDER CONSTRUCTION
28 public interface IPreferenceService
{
33 // ********************* GETTING **********************/
37 * Return the number of all existing cdm preferences
43 * Returns all CDM preferences.
46 public List
<CdmPreference
> list();
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
55 public List
<CdmPreference
> list(String subject
, String predicate
);
59 * Retrieve the best matching value for the given preference key.
60 * @param key the key defining the data to retrieve
63 public CdmPreference
find(PrefKey key
);
66 // Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
68 // * Retrieve the best matching value for the given preference key.
73 // public Object find(String subject, String predicate);
75 // Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
77 // * Retrieve the database wide preference for the given predicate.
81 // public CdmPreference findDatabase(String predicate);
84 * Retrieve the database wide preference for the given predicate.
88 public CdmPreference
findDatabase(IPreferencePredicate predicate
);
91 * Retrieve the vaadin wide preference for the given predicate.
95 public CdmPreference
findVaadin(IPreferencePredicate predicate
);
99 * Retrieve the TaxEditor wide preference for the given predicate.
103 public CdmPreference
findTaxEditor(IPreferencePredicate predicate
);
106 * Returns the best matching preference that matches the given
107 * predicate and the taxon node filter. Only DB preferences and
108 * preferences defined on a TaxonNode are considered.
113 public Object
find(TaxonNode taxonNode
, String predicate
);
115 public CdmPreference
find(TaxonNode taxonNode
, IPreferencePredicate predicate
);
118 * Returns the best matching preference that matches the given
119 * predicate and the filter. Only DB preferences and preferences
120 * defined on a TaxonNode are considered.
122 * NOTE: This is not yet implemented!
128 public CdmPreference
find(CdmBase taxonNodeRelatedCdmBase
, String predicate
);
133 //******************* SETTING **********************/
137 * Write the value for the preference's key
140 public void set(CdmPreference preference
);
144 //we need to decide if we want to keep this method
145 // //returns old value
146 // String setCdmPrefs(CdmBase cdmBase, String predicate, String value );
148 //// String setEditorPrefs();