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.container;
17  
18  import java.net.URI;
19  import java.util.List;
20  
21  import static org.fourthline.cling.support.model.DIDLObject.Property.UPNP;
22  
23  /**
24   * @author Christian Bauer
25   */
26  public class MusicArtist extends PersonContainer {
27  
28      public static final Class CLASS = new Class("object.container.person.musicArtist");
29  
30      public MusicArtist() {
31          setClazz(CLASS);
32      }
33  
34      public MusicArtist(Container other) {
35          super(other);
36      }
37  
38      public MusicArtist(String id, Container parent, String title, String creator, Integer childCount) {
39          this(id, parent.getId(), title, creator, childCount);
40      }
41  
42      public MusicArtist(String id, String parentID, String title, String creator, Integer childCount) {
43          super(id, parentID, title, creator, childCount);
44          setClazz(CLASS);
45      }
46  
47      public String getFirstGenre() {
48          return getFirstPropertyValue(UPNP.GENRE.class);
49      }
50  
51      public String[] getGenres() {
52          List<String> list = getPropertyValues(UPNP.GENRE.class);
53          return list.toArray(new String[list.size()]);
54      }
55  
56      public MusicArtist setGenres(String[] genres) {
57          removeProperties(UPNP.GENRE.class);
58          for (String genre : genres) {
59              addProperty(new UPNP.GENRE(genre));
60          }
61          return this;
62      }
63  
64      public URI getArtistDiscographyURI() {
65          return getFirstPropertyValue(UPNP.ARTIST_DISCO_URI.class);
66      }
67  
68      public MusicArtist setArtistDiscographyURI(URI uri) {
69          replaceFirstProperty(new UPNP.ARTIST_DISCO_URI(uri));
70          return this;
71      }
72  
73  }