View Javadoc
1   /*
2    * Licensed to The Apereo Foundation under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional
4    * information regarding copyright ownership.
5    *
6    *
7    * The Apereo Foundation licenses this file to you under the Educational
8    * Community License, Version 2.0 (the "License"); you may not use this file
9    * except in compliance with the License. You may obtain a copy of the License
10   * at:
11   *
12   *   http://opensource.org/licenses/ecl2.txt
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
17   * License for the specific language governing permissions and limitations under
18   * the License.
19   *
20   */
21  
22  
23  package org.opencastproject.metadata.api;
24  
25  import org.opencastproject.metadata.api.util.Interval;
26  import org.opencastproject.util.data.NonEmptyList;
27  
28  import java.util.Date;
29  import java.util.List;
30  import java.util.Optional;
31  
32  /**
33   * Provides access to a commonly accepted set of metadata.
34   * <p>
35   * Please note that there is <em>no</em> default implementation with setters for each field available
36   * to enforce a different style of usage. Whenever you need to return <code>StaticMetadata</code>
37   * create an anonymous implementation with each getter implementation annotated with <code>@Override</code>.
38   * This way the compiler helps you to ensure that each field is actually set. When it comes to refactoring this
39   * interface, say a field is added and anotherone gets removed a simple compiler run detects all places you
40   * need to change in your client code to adjust to the new schema. So it is highly recommended to stay
41   * away from the traditional setter idiom.
42   */
43  public interface StaticMetadata {
44  
45    Optional<String> getId();
46  
47    Optional<Long> getExtent();
48  
49    Optional<String> getLanguage();
50  
51    Optional<String> getIsPartOf();
52  
53    Optional<String> getReplaces();
54  
55    Optional<String> getType();
56  
57    Optional<Interval> getAvailable();
58  
59    Optional<Date[]> getTemporalPeriod();
60  
61    Optional<Date> getTemporalInstant();
62  
63    Optional<Long> getTemporalDuration();
64  
65    NonEmptyList<MetadataValue<String>> getTitles();
66  
67    List<MetadataValue<String>> getSubjects();
68  
69    List<MetadataValue<String>> getCreators();
70  
71    List<MetadataValue<String>> getPublishers();
72  
73    List<MetadataValue<String>> getContributors();
74  
75    List<MetadataValue<String>> getDescription();
76  
77    List<MetadataValue<String>> getRightsHolders();
78  
79    List<MetadataValue<String>> getSpatials();
80  
81    List<MetadataValue<String>> getAccessRights();
82  
83    List<MetadataValue<String>> getLicenses();
84  
85  }