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.Res;
19  import org.fourthline.cling.support.model.StorageMedium;
20  import org.fourthline.cling.support.model.container.Container;
21  
22  import java.util.List;
23  
24  import static org.fourthline.cling.support.model.DIDLObject.Property.UPNP;
25  
26  /**
27   * @author Christian Bauer
28   */
29  public class Movie extends VideoItem {
30  
31      public static final Class CLASS = new Class("object.item.videoItem.movie");
32  
33      public Movie() {
34          setClazz(CLASS);
35      }
36  
37      public Movie(Item other) {
38          super(other);
39      }
40  
41      public Movie(String id, Container parent, String title, String creator, Res... resource) {
42          this(id, parent.getId(), title, creator, resource);
43      }
44  
45      public Movie(String id, String parentID, String title, String creator, Res... resource) {
46          super(id, parentID, title, creator, resource);
47          setClazz(CLASS);
48      }
49  
50      public StorageMedium getStorageMedium() {
51          return getFirstPropertyValue(UPNP.STORAGE_MEDIUM.class);
52      }
53  
54      public Movie setStorageMedium(StorageMedium storageMedium) {
55          replaceFirstProperty(new UPNP.STORAGE_MEDIUM(storageMedium));
56          return this;
57      }
58  
59      public Integer getDVDRegionCode() {
60          return getFirstPropertyValue(UPNP.DVD_REGION_CODE.class);
61      }
62  
63      public Movie setDVDRegionCode(Integer DVDRegionCode) {
64          replaceFirstProperty(new UPNP.DVD_REGION_CODE(DVDRegionCode));
65          return this;
66      }
67  
68      public String getChannelName() {
69          return getFirstPropertyValue(UPNP.CHANNEL_NAME.class);
70      }
71  
72      public Movie setChannelName(String channelName) {
73          replaceFirstProperty(new UPNP.CHANNEL_NAME(channelName));
74          return this;
75      }
76  
77      public String getFirstScheduledStartTime() {
78          return getFirstPropertyValue(UPNP.SCHEDULED_START_TIME.class);
79      }
80  
81      public String[] getScheduledStartTimes() {
82          List<String> list = getPropertyValues(UPNP.SCHEDULED_START_TIME.class);
83          return list.toArray(new String[list.size()]);
84      }
85  
86      public Movie setScheduledStartTimes(String[] strings) {
87          removeProperties(UPNP.SCHEDULED_START_TIME.class);
88          for (String s : strings) {
89              addProperty(new UPNP.SCHEDULED_START_TIME(s));
90          }
91          return this;
92      }
93  
94      public String getFirstScheduledEndTime() {
95          return getFirstPropertyValue(UPNP.SCHEDULED_END_TIME.class);
96      }
97  
98      public String[] getScheduledEndTimes() {
99          List<String> list = getPropertyValues(UPNP.SCHEDULED_END_TIME.class);
100         return list.toArray(new String[list.size()]);
101     }
102 
103     public Movie setScheduledEndTimes(String[] strings) {
104         removeProperties(UPNP.SCHEDULED_END_TIME.class);
105         for (String s : strings) {
106             addProperty(new UPNP.SCHEDULED_END_TIME(s));
107         }
108         return this;
109     }
110 
111 }