View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14   */
15  
16  package org.fourthline.cling.support.model.item;
17  
18  import org.fourthline.cling.support.model.Person;
19  import org.fourthline.cling.support.model.PersonWithRole;
20  import org.fourthline.cling.support.model.Res;
21  import org.fourthline.cling.support.model.StorageMedium;
22  import org.fourthline.cling.support.model.container.Container;
23  
24  import java.util.List;
25  
26  import static org.fourthline.cling.support.model.DIDLObject.Property.DC;
27  import static org.fourthline.cling.support.model.DIDLObject.Property.UPNP;
28  
29  /**
30   * @author Christian Bauer
31   */
32  public class MusicVideoClip extends VideoItem {
33  
34      public static final Class CLASS = new Class("object.item.videoItem.musicVideoClip");
35  
36      public MusicVideoClip() {
37          setClazz(CLASS);
38      }
39  
40      public MusicVideoClip(Item other) {
41          super(other);
42      }
43  
44      public MusicVideoClip(String id, Container parent, String title, String creator, Res... resource) {
45          this(id, parent.getId(), title, creator, resource);
46      }
47  
48      public MusicVideoClip(String id, String parentID, String title, String creator, Res... resource) {
49          super(id, parentID, title, creator, resource);
50          setClazz(CLASS);
51      }
52  
53      public PersonWithRole getFirstArtist() {
54          return getFirstPropertyValue(UPNP.ARTIST.class);
55      }
56  
57      public PersonWithRole[] getArtists() {
58          List<PersonWithRole> list = getPropertyValues(UPNP.ARTIST.class);
59          return list.toArray(new PersonWithRole[list.size()]);
60      }
61  
62      public MusicVideoClip setArtists(PersonWithRole[] artists) {
63          removeProperties(UPNP.ARTIST.class);
64          for (PersonWithRole artist : artists) {
65              addProperty(new UPNP.ARTIST(artist));
66          }
67          return this;
68      }
69  
70      public StorageMedium getStorageMedium() {
71          return getFirstPropertyValue(UPNP.STORAGE_MEDIUM.class);
72      }
73  
74      public MusicVideoClip setStorageMedium(StorageMedium storageMedium) {
75          replaceFirstProperty(new UPNP.STORAGE_MEDIUM(storageMedium));
76          return this;
77      }
78  
79      public String getAlbum() {
80          return getFirstPropertyValue(UPNP.ALBUM.class);
81      }
82  
83      public MusicVideoClip setAlbum(String album) {
84          replaceFirstProperty(new UPNP.ALBUM(album));
85          return this;
86      }
87  
88      public String getFirstScheduledStartTime() {
89          return getFirstPropertyValue(UPNP.SCHEDULED_START_TIME.class);
90      }
91  
92      public String[] getScheduledStartTimes() {
93          List<String> list = getPropertyValues(UPNP.SCHEDULED_START_TIME.class);
94          return list.toArray(new String[list.size()]);
95      }
96  
97      public MusicVideoClip setScheduledStartTimes(String[] strings) {
98          removeProperties(UPNP.SCHEDULED_START_TIME.class);
99          for (String s : strings) {
100             addProperty(new UPNP.SCHEDULED_START_TIME(s));
101         }
102         return this;
103     }
104 
105     public String getFirstScheduledEndTime() {
106         return getFirstPropertyValue(UPNP.SCHEDULED_END_TIME.class);
107     }
108 
109     public String[] getScheduledEndTimes() {
110         List<String> list = getPropertyValues(UPNP.SCHEDULED_END_TIME.class);
111         return list.toArray(new String[list.size()]);
112     }
113 
114     public MusicVideoClip setScheduledEndTimes(String[] strings) {
115         removeProperties(UPNP.SCHEDULED_END_TIME.class);
116         for (String s : strings) {
117             addProperty(new UPNP.SCHEDULED_END_TIME(s));
118         }
119         return this;
120     }
121 
122     public Person getFirstContributor() {
123         return getFirstPropertyValue(DC.CONTRIBUTOR.class);
124     }
125 
126     public Person[] getContributors() {
127         List<Person> list = getPropertyValues(DC.CONTRIBUTOR.class);
128         return list.toArray(new Person[list.size()]);
129     }
130 
131     public MusicVideoClip setContributors(Person[] contributors) {
132         removeProperties(DC.CONTRIBUTOR.class);
133         for (Person p : contributors) {
134             addProperty(new DC.CONTRIBUTOR(p));
135         }
136         return this;
137     }
138 
139     public String getDate() {
140         return getFirstPropertyValue(DC.DATE.class);
141     }
142 
143     public MusicVideoClip setDate(String date) {
144         replaceFirstProperty(new DC.DATE(date));
145         return this;
146     }
147 
148 
149 }