1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.fourthline.cling.support.model.container;
17
18 import org.fourthline.cling.support.model.Person;
19 import org.fourthline.cling.support.model.PersonWithRole;
20 import org.fourthline.cling.support.model.StorageMedium;
21
22 import java.util.List;
23
24 import static org.fourthline.cling.support.model.DIDLObject.Property.DC;
25 import static org.fourthline.cling.support.model.DIDLObject.Property.UPNP;
26
27
28
29
30 public class PlaylistContainer extends Container {
31
32 public static final Class CLASS = new Class("object.container.playlistContainer");
33
34 public PlaylistContainer() {
35 setClazz(CLASS);
36 }
37
38 public PlaylistContainer(Container other) {
39 super(other);
40 }
41
42 public PlaylistContainer(String id, Container parent, String title, String creator, Integer childCount) {
43 this(id, parent.getId(), title, creator, childCount);
44 }
45
46 public PlaylistContainer(String id, String parentID, String title, String creator, Integer childCount) {
47 super(id, parentID, title, creator, CLASS, childCount);
48 }
49
50 public PersonWithRole getFirstArtist() {
51 return getFirstPropertyValue(UPNP.ARTIST.class);
52 }
53
54 public PersonWithRole[] getArtists() {
55 List<PersonWithRole> list = getPropertyValues(UPNP.ARTIST.class);
56 return list.toArray(new PersonWithRole[list.size()]);
57 }
58
59 public PlaylistContainer setArtists(PersonWithRole[] artists) {
60 removeProperties(UPNP.ARTIST.class);
61 for (PersonWithRole artist : artists) {
62 addProperty(new UPNP.ARTIST(artist));
63 }
64 return this;
65 }
66
67 public String getFirstGenre() {
68 return getFirstPropertyValue(UPNP.GENRE.class);
69 }
70
71 public String[] getGenres() {
72 List<String> list = getPropertyValues(UPNP.GENRE.class);
73 return list.toArray(new String[list.size()]);
74 }
75
76 public PlaylistContainer setGenres(String[] genres) {
77 removeProperties(UPNP.GENRE.class);
78 for (String genre : genres) {
79 addProperty(new UPNP.GENRE(genre));
80 }
81 return this;
82 }
83
84 public String getDescription() {
85 return getFirstPropertyValue(DC.DESCRIPTION.class);
86 }
87
88 public PlaylistContainer setDescription(String description) {
89 replaceFirstProperty(new DC.DESCRIPTION(description));
90 return this;
91 }
92
93 public String getLongDescription() {
94 return getFirstPropertyValue(UPNP.LONG_DESCRIPTION.class);
95 }
96
97 public PlaylistContainer setLongDescription(String description) {
98 replaceFirstProperty(new UPNP.LONG_DESCRIPTION(description));
99 return this;
100 }
101
102 public Person getFirstProducer() {
103 return getFirstPropertyValue(UPNP.PRODUCER.class);
104 }
105
106 public Person[] getProducers() {
107 List<Person> list = getPropertyValues(UPNP.PRODUCER.class);
108 return list.toArray(new Person[list.size()]);
109 }
110
111 public PlaylistContainer setProducers(Person[] persons) {
112 removeProperties(UPNP.PRODUCER.class);
113 for (Person p : persons) {
114 addProperty(new UPNP.PRODUCER(p));
115 }
116 return this;
117 }
118
119 public StorageMedium getStorageMedium() {
120 return getFirstPropertyValue(UPNP.STORAGE_MEDIUM.class);
121 }
122
123 public PlaylistContainer setStorageMedium(StorageMedium storageMedium) {
124 replaceFirstProperty(new UPNP.STORAGE_MEDIUM(storageMedium));
125 return this;
126 }
127
128 public String getDate() {
129 return getFirstPropertyValue(DC.DATE.class);
130 }
131
132 public PlaylistContainer setDate(String date) {
133 replaceFirstProperty(new DC.DATE(date));
134 return this;
135 }
136
137 public String getFirstRights() {
138 return getFirstPropertyValue(DC.RIGHTS.class);
139 }
140
141 public String[] getRights() {
142 List<String> list = getPropertyValues(DC.RIGHTS.class);
143 return list.toArray(new String[list.size()]);
144 }
145
146 public PlaylistContainer setRights(String[] rights) {
147 removeProperties(DC.RIGHTS.class);
148 for (String right : rights) {
149 addProperty(new DC.RIGHTS(right));
150 }
151 return this;
152 }
153
154 public Person getFirstContributor() {
155 return getFirstPropertyValue(DC.CONTRIBUTOR.class);
156 }
157
158 public Person[] getContributors() {
159 List<Person> list = getPropertyValues(DC.CONTRIBUTOR.class);
160 return list.toArray(new Person[list.size()]);
161 }
162
163 public PlaylistContainer setContributors(Person[] contributors) {
164 removeProperties(DC.CONTRIBUTOR.class);
165 for (Person p : contributors) {
166 addProperty(new DC.CONTRIBUTOR(p));
167 }
168 return this;
169 }
170
171 public String getLanguage() {
172 return getFirstPropertyValue(DC.LANGUAGE.class);
173 }
174
175 public PlaylistContainer setLanguage(String language) {
176 replaceFirstProperty(new DC.LANGUAGE(language));
177 return this;
178 }
179
180 }