Project

General

Profile

Revision 1396c2bc

ID1396c2bc52792c3a5c2320418302036c26d993f9
Parent b13fab25
Child b4e979be

Added by Andreas Müller over 4 years ago

#3958 Latest update to IPreferenceService classes

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IPreferenceService.java
46 46

  
47 47

  
48 48
     /**
49
     * Retrieve all matching values for the given preference key.
50
     * @param subject
51
     * @param predicate
52
     * @return
53
     */
54
     public List<CdmPreference> list(String subject, String predicate);
55

  
56

  
57
     /**
49 58
      * Retrieve the best matching value for the given preference key.
50 59
      * @param key
51 60
      * @return
......
79 88

  
80 89

  
81 90
     /**
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 91
      * Returns the best matching preference that matches the given
91 92
      * predicate and the taxon node filter. Only DB preferences and
92 93
      * preferences defined on a TaxonNode are considered.
......
100 101

  
101 102
     /**
102 103
      * Returns the best matching preference that matches the given
103
      * the predicate and the filter. Only DB preferences and preferences
104
      * predicate and the filter. Only DB preferences and preferences
104 105
      * defined on a TaxonNode are considered.
106
      *
107
      * NOTE: This is not yet implemented!
108
      *
105 109
      * @param taxonNode
106 110
      * @param predicate
107 111
      * @return
108 112
      */
109
     public Object find(CdmBase taxonNode, String predicate);
113
     public CdmPreference find(CdmBase taxonNodeRelatedCdmBase, String predicate);
114

  
115

  
110 116

  
111
     public List<Object> findAll();
112 117

  
113 118
 //******************* SETTING **********************/
114 119

  
115 120

  
116
     //returns old value
117
     String setCdmPrefs(CdmBase cdmBase, String predicate, String value );
121
     /**
122
      * Write the value for the preference's key
123
      * @param preference
124
      */
125
     public void set(CdmPreference preference);
118 126

  
119
//     String setEditorPrefs();
120 127

  
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 );
131
//
132
////     String setEditorPrefs();
121 133

  
122 134

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

  
129 136

  
130 137
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/PreferenceServiceImpl.java
89 89
// ********************** NOT YET HANDLED *******************/
90 90

  
91 91

  
92
//    /* (non-Javadoc)
93
//     * @see eu.etaxonomy.cdm.api.service.IPreferenceService#find(java.lang.String, java.lang.String)
94
//     */
95
//    @Override
96
//    public Object find(String subject, String predicate) {
97
//        // TODO Auto-generated method stub
98
//        return null;
99
//    }
100

  
101
    /* (non-Javadoc)
102
     * @see eu.etaxonomy.cdm.api.service.IPreferenceService#findAll(java.lang.String, java.lang.String)
103
     */
104 92
    @Override
105
    public List<Object> findAll(String subject, String predicate) {
106
        // TODO Auto-generated method stub
107
        return null;
93
    public List<CdmPreference> list(String subject, String predicate) {
94
        //FIXME
95
        throw new RuntimeException("list(String, String) not yet implemented" );
108 96
    }
109 97

  
110

  
111
    /* (non-Javadoc)
112
     * @see eu.etaxonomy.cdm.api.service.IPreferenceService#find(eu.etaxonomy.cdm.model.common.CdmBase, java.lang.String)
113
     */
114 98
    @Override
115
    public Object find(CdmBase taxonNode, String predicate) {
116
        // TODO Auto-generated method stub
117
        return null;
99
    //this method is only partly implemented
100
    public CdmPreference find(CdmBase taxonNodeRelatedCdmBase, String predicate) {
101
        TaxonNode taxonNode = mapToTaxonNode(taxonNodeRelatedCdmBase);
102
        return dao.find(taxonNode, predicate);
118 103
    }
119 104

  
120
    /* (non-Javadoc)
121
     * @see eu.etaxonomy.cdm.api.service.IPreferenceService#findAll()
105
    /**
106
     * @param taxonNodeRelatedCdmBase
107
     * @return
122 108
     */
123
    @Override
124
    public List<Object> findAll() {
125
        // TODO Auto-generated method stub
126
        return null;
109
    private TaxonNode mapToTaxonNode(CdmBase taxonNodeRelatedCdmBase) {
110
        if (taxonNodeRelatedCdmBase == null){
111
            return null;
112
        }else if (taxonNodeRelatedCdmBase.isInstanceOf(TaxonNode.class)){
113
            return CdmBase.deproxy(taxonNodeRelatedCdmBase, TaxonNode.class);
114
        }else{
115
            throw new RuntimeException("mapToTaxonNode not yet implemented for " + taxonNodeRelatedCdmBase.getClass().getSimpleName());
116
        }
127 117
    }
128 118

  
129
    /* (non-Javadoc)
130
     * @see eu.etaxonomy.cdm.api.service.IPreferenceService#setCdmPrefs(eu.etaxonomy.cdm.model.common.CdmBase, java.lang.String, java.lang.String)
131
     */
132
    @Override
133
    public String setCdmPrefs(CdmBase cdmBase, String predicate, String value) {
134
        // TODO Auto-generated method stub
135
        return null;
136
    }
119

  
120
//    @Override
121
//    public String setCdmPrefs(CdmBase cdmBase, String predicate, String value) {
122
//        // TODO Auto-generated method stub
123
//        return null;
124
//    }
137 125

  
138 126

  
139 127
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)