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
.PreferencePredicate
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
20 * Service API for CDM Preferences.
22 * STATE: UNDER CONSTRUCTION
27 public interface IPreferenceService
{
32 // ********************* GETTING **********************/
36 * Return the number of all existing cdm preferences
42 * Returns all CDM preferences.
45 public List
<CdmPreference
> list();
49 * Retrieve all matching values for the given preference key.
54 public List
<CdmPreference
> list(String subject
, String predicate
);
58 * Retrieve the best matching value for the given preference key.
62 public CdmPreference
find(PrefKey key
);
65 // Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
67 // * Retrieve the best matching value for the given preference key.
72 // public Object find(String subject, String predicate);
74 // Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
76 // * Retrieve the database wide preference for the given predicate.
80 // public CdmPreference findDatabase(String predicate);
83 * Retrieve the database wide preference for the given predicate.
87 public CdmPreference
findDatabase(PreferencePredicate predicate
);
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.
98 public Object
find(TaxonNode taxonNode
, String predicate
);
100 public CdmPreference
find(TaxonNode taxonNode
, PreferencePredicate predicate
);
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.
107 * NOTE: This is not yet implemented!
113 public CdmPreference
find(CdmBase taxonNodeRelatedCdmBase
, String predicate
);
118 //******************* SETTING **********************/
122 * Write the value for the preference's key
125 public void set(CdmPreference preference
);
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 );
132 //// String setEditorPrefs();