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 the best matching value for the given preference key.
53 public CdmPreference
find(PrefKey key
);
56 // Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
58 // * Retrieve the best matching value for the given preference key.
63 // public Object find(String subject, String predicate);
65 // Can not yet be created as we allow only PreferencePredicate for predicate key creation now.
67 // * Retrieve the database wide preference for the given predicate.
71 // public CdmPreference findDatabase(String predicate);
74 * Retrieve the database wide preference for the given predicate.
78 public CdmPreference
findDatabase(PreferencePredicate predicate
);
82 * Retrieve all matching values for the given preference key.
87 public List
<Object
> findAll(String subject
, String predicate
);
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.
97 public Object
find(TaxonNode taxonNode
, String predicate
);
99 public CdmPreference
find(TaxonNode taxonNode
, PreferencePredicate predicate
);
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.
109 public Object
find(CdmBase taxonNode
, String predicate
);
111 public List
<Object
> findAll();
113 //******************* SETTING **********************/
117 String
setCdmPrefs(CdmBase cdmBase
, String predicate
, String value
);
119 // String setEditorPrefs();
124 * Write the value for the preference's key
127 public void set(CdmPreference preference
);