View Javadoc

1   /* 
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.om.impl;
18  import java.util.Collection;
19  import java.util.Locale;
20  
21  import org.apache.jetspeed.om.common.DublinCore;
22  import org.apache.jetspeed.om.common.GenericMetadata;
23  
24  /***
25   * DublinCoreImpl
26   * <br/>
27   * Implementation that allows retrieving information according to the 
28   * Dublin Core specification 
29   * (<a href="http://www.dublincore.org">http://www.dublincore.org</a>)
30   * 
31   * @author <a href="mailto:jford@apache.org">Jeremy Ford</a>
32   * @version $Id: DublinCoreImpl.java 517719 2007-03-13 15:05:48Z ate $
33   *
34   */
35  public class DublinCoreImpl implements DublinCore
36  {
37      public static final String TITLE = "title";
38      public static final String CONTRIBUTOR = "contributor";
39      public static final String COVERAGE = "coverage";
40      public static final String CREATOR = "creator";
41      public static final String DESCRIPTION = "description";
42      public static final String FORMAT = "format";
43      public static final String IDENTIFIER = "identifier";
44      public static final String LANGUAGE = "language";
45      public static final String PUBLISHER = "publisher";
46      public static final String RELATION = "relation";
47      public static final String RIGHT = "right";
48      public static final String SOURCE = "source";
49      public static final String SUBJECT = "subject";
50      public static final String TYPE = "type";
51      
52      GenericMetadata metadata = null;
53      
54      /***
55       * @param md
56       */
57      public DublinCoreImpl(GenericMetadata md) {
58          
59          this.metadata = md;
60      }
61  
62      /*** 
63       * @return Returns the titles
64       */
65      public Collection getTitles()
66      {
67          return metadata.getFields(TITLE);
68      }
69  
70      /*** 
71       * @param titles The titles to set
72       */
73      public void setTitles(Collection titles)
74      {
75          metadata.setFields(TITLE, titles);
76      }
77  
78      /***
79       * @return Returns the contributors.
80       */
81      public Collection getContributors() {
82          return metadata.getFields(CONTRIBUTOR);
83      }
84  
85      /***
86       * @param contributors The contributors to set.
87       */
88      public void setContributors(Collection contributors) {
89          metadata.setFields(CONTRIBUTOR, contributors);
90      }
91  
92      /***
93       * @return Returns the coverages.
94       */
95      public Collection getCoverages() {
96          return metadata.getFields(COVERAGE);
97      }
98  
99      /***
100      * @param coverages The coverages to set.
101      */
102     public void setCoverages(Collection coverages) {
103         metadata.setFields(COVERAGE, coverages);
104     }
105 
106     /***
107      * @return Returns the creators.
108      */
109     public Collection getCreators() {
110         return metadata.getFields(CREATOR);
111     }
112 
113     /***
114      * @param creators The creators to set.
115      */
116     public void setCreators(Collection creators) {
117         metadata.setFields(CREATOR, creators);
118     }
119 
120     /***
121      * @return Returns the descriptions.
122      */
123     public Collection getDescriptions() {
124         return metadata.getFields(DESCRIPTION);
125     }
126 
127     /***
128      * @param descriptions The descriptions to set.
129      */
130     public void setDescriptions(Collection descriptions) {
131         metadata.setFields(DESCRIPTION, descriptions);
132     }
133 
134     /***
135      * @return Returns the formats.
136      */
137     public Collection getFormats() {
138         return metadata.getFields(FORMAT);
139     }
140 
141     /***
142      * @param formats The formats to set.
143      */
144     public void setFormats(Collection formats) {
145         metadata.setFields(FORMAT, formats);
146     }
147 
148     /***
149      * @return Returns the identifiers.
150      */
151     public Collection getIdentifiers() {
152         return metadata.getFields(IDENTIFIER);
153     }
154 
155     /***
156      * @param identifiers The identifiers to set.
157      */
158     public void setIdentifiers(Collection identifiers) {
159         metadata.setFields(IDENTIFIER, identifiers);
160     }
161 
162     /***
163      * @return Returns the languages.
164      */
165     public Collection getLanguages() {
166         return metadata.getFields(LANGUAGE);
167     }
168 
169     /***
170      * @param languages The languages to set.
171      */
172     public void setLanguages(Collection languages) {
173         metadata.setFields(LANGUAGE, languages);
174     }
175 
176     /***
177      * @return Returns the publishers.
178      */
179     public Collection getPublishers() {
180         return metadata.getFields(PUBLISHER);
181     }
182 
183     /***
184      * @param publishers The publishers to set.
185      */
186     public void setPublishers(Collection publishers) {
187         metadata.setFields(PUBLISHER, publishers);
188     }
189 
190     /***
191      * @return Returns the relations.
192      */
193     public Collection getRelations() {
194         return metadata.getFields(RELATION);
195     }
196 
197     /***
198      * @param relations The relations to set.
199      */
200     public void setRelations(Collection relations) {
201         metadata.setFields(RELATION, relations);
202     }
203 
204     /***
205      * @return Returns the rights.
206      */
207     public Collection getRights() {
208         return metadata.getFields(RIGHT);
209     }
210 
211     /***
212      * @param rights The rights to set.
213      */
214     public void setRights(Collection rights) {
215         metadata.setFields(RIGHT, rights);
216     }
217 
218     /***
219      * @return Returns the sources.
220      */
221     public Collection getSources() {
222         return metadata.getFields(SOURCE);
223     }
224 
225     /***
226      * @param sources The sources to set.
227      */
228     public void setSources(Collection sources) {
229         metadata.setFields(SOURCE, sources);
230     }
231 
232     /***
233      * @return Returns the subjects.
234      */
235     public Collection getSubjects() {
236         return metadata.getFields(SUBJECT);
237     }
238 
239     /***
240      * @param subjects The subjects to set.
241      */
242     public void setSubjects(Collection subjects) {
243         metadata.setFields(SUBJECT, subjects);
244     }
245 
246     /***
247      * @return Returns the types.
248      */
249     public Collection getTypes() {
250         return metadata.getFields(TYPE);
251     }
252 
253     /***
254      * @param types The types to set.
255      */
256     public void setTypes(Collection types) {
257         metadata.setFields(TYPE, types);
258     }
259 
260     /* (non-Javadoc)
261      * @see org.apache.jetspeed.om.common.DublinCore#addContributor(java.util.Locale, java.lang.String)
262      */
263     public void addContributor(Locale locale, String contributor) {
264         metadata.addField(locale, CONTRIBUTOR, contributor);
265     }
266 
267     /* (non-Javadoc)
268      * @see org.apache.jetspeed.om.common.DublinCore#addCoverage(java.util.Locale, java.lang.String)
269      */
270     public void addCoverage(Locale locale, String coverage) {
271         metadata.addField(locale, COVERAGE, coverage);
272     }
273 
274     /* (non-Javadoc)
275      * @see org.apache.jetspeed.om.common.DublinCore#addCreator(java.util.Locale, java.lang.String)
276      */
277     public void addCreator(Locale locale, String creator) {
278         metadata.addField(locale, CREATOR, creator);
279     }
280 
281     /* (non-Javadoc)
282      * @see org.apache.jetspeed.om.common.DublinCore#addDescription(java.util.Locale, java.lang.String)
283      */
284     public void addDescription(Locale locale, String description) {
285         metadata.addField(locale, DESCRIPTION, description);
286     }
287 
288     /* (non-Javadoc)
289      * @see org.apache.jetspeed.om.common.DublinCore#addFormat(java.util.Locale, java.lang.String)
290      */
291     public void addFormat(Locale locale, String format) {
292         metadata.addField(locale, FORMAT, format);
293     }
294 
295     /* (non-Javadoc)
296      * @see org.apache.jetspeed.om.common.DublinCore#addIdentifier(java.util.Locale, java.lang.String)
297      */
298     public void addIdentifier(Locale locale, String identifier) {
299         metadata.addField(locale, IDENTIFIER, identifier);
300     }
301 
302     /* (non-Javadoc)
303      * @see org.apache.jetspeed.om.common.DublinCore#addLanguage(java.util.Locale, java.lang.String)
304      */
305     public void addLanguage(Locale locale, String language) {
306         metadata.addField(locale, LANGUAGE, language);
307     }
308 
309     /* (non-Javadoc)
310      * @see org.apache.jetspeed.om.common.DublinCore#addPublisher(java.util.Locale, java.lang.String)
311      */
312     public void addPublisher(Locale locale, String publisher) {
313         metadata.addField(locale, PUBLISHER, publisher);
314     }
315 
316     /* (non-Javadoc)
317      * @see org.apache.jetspeed.om.common.DublinCore#addRelation(java.util.Locale, java.lang.String)
318      */
319     public void addRelation(Locale locale, String relation) {
320         metadata.addField(locale, RELATION, relation);
321     }
322 
323     /* (non-Javadoc)
324      * @see org.apache.jetspeed.om.common.DublinCore#addRight(java.util.Locale, java.lang.String)
325      */
326     public void addRight(Locale locale, String right) {
327         metadata.addField(locale, RIGHT, right);
328     }
329 
330     /* (non-Javadoc)
331      * @see org.apache.jetspeed.om.common.DublinCore#addSource(java.util.Locale, java.lang.String)
332      */
333     public void addSource(Locale locale, String source) {
334         metadata.addField(locale, SOURCE, source);
335     }
336 
337     /* (non-Javadoc)
338      * @see org.apache.jetspeed.om.common.DublinCore#addSubject(java.util.Locale, java.lang.String)
339      */
340     public void addSubject(Locale locale, String subject) {
341         metadata.addField(locale, SUBJECT, subject);
342         
343     }
344     
345     /* (non-Javadoc)
346      * @see org.apache.jetspeed.om.common.DublinCore#addDisplayName(java.util.Locale, java.lang.String)
347      */
348     public void addTitle(Locale locale, String title) {
349         metadata.addField(locale, TITLE, title);
350     }
351 
352     /* (non-Javadoc)
353      * @see org.apache.jetspeed.om.common.DublinCore#addType(java.util.Locale, java.lang.String)
354      */
355     public void addType(Locale locale, String type) {
356         metadata.addField(locale, TYPE, type);
357     }
358 }