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 org.fourthline.cling.support.model.StorageMedium;
19  
20  import static org.fourthline.cling.support.model.DIDLObject.Property.UPNP;
21  
22  /**
23   * @author Christian Bauer
24   */
25  public class StorageSystem extends Container {
26  
27      public static final Class CLASS = new Class("object.container.storageSystem");
28  
29      public StorageSystem() {
30          setClazz(CLASS);
31      }
32  
33      public StorageSystem(Container other) {
34          super(other);
35      }
36  
37      public StorageSystem(String id, Container parent, String title, String creator, Integer childCount,
38                           Long storageTotal, Long storageUsed, Long storageFree, Long storageMaxPartition, StorageMedium storageMedium) {
39          this(id, parent.getId(), title, creator, childCount, storageTotal, storageUsed, storageFree, storageMaxPartition, storageMedium);
40      }
41  
42      public StorageSystem(String id, String parentID, String title, String creator, Integer childCount,
43                           Long storageTotal, Long storageUsed, Long storageFree, Long storageMaxPartition, StorageMedium storageMedium) {
44          super(id, parentID, title, creator, CLASS, childCount);
45          if (storageTotal != null)
46              setStorageTotal(storageTotal);
47          if (storageUsed!= null)
48              setStorageUsed(storageUsed);
49          if (storageFree != null)
50              setStorageFree(storageFree);
51          if (storageMaxPartition != null)
52              setStorageMaxPartition(storageMaxPartition);
53          if (storageMedium != null)
54              setStorageMedium(storageMedium);
55      }
56  
57      public Long getStorageTotal() {
58          return getFirstPropertyValue(UPNP.STORAGE_TOTAL.class);
59      }
60  
61      public StorageSystem setStorageTotal(Long l) {
62          replaceFirstProperty(new UPNP.STORAGE_TOTAL(l));
63          return this;
64      }
65  
66      public Long getStorageUsed() {
67          return getFirstPropertyValue(UPNP.STORAGE_USED.class);
68      }
69  
70      public StorageSystem setStorageUsed(Long l) {
71          replaceFirstProperty(new UPNP.STORAGE_USED(l));
72          return this;
73      }
74  
75      public Long getStorageFree() {
76          return getFirstPropertyValue(UPNP.STORAGE_FREE.class);
77      }
78  
79      public StorageSystem setStorageFree(Long l) {
80          replaceFirstProperty(new UPNP.STORAGE_FREE(l));
81          return this;
82      }
83  
84      public Long getStorageMaxPartition() {
85          return getFirstPropertyValue(UPNP.STORAGE_MAX_PARTITION.class);
86      }
87  
88      public StorageSystem setStorageMaxPartition(Long l) {
89          replaceFirstProperty(new UPNP.STORAGE_MAX_PARTITION(l));
90          return this;
91      }
92  
93      public StorageMedium getStorageMedium() {
94          return getFirstPropertyValue(UPNP.STORAGE_MEDIUM.class);
95      }
96  
97      public StorageSystem setStorageMedium(StorageMedium storageMedium) {
98          replaceFirstProperty(new UPNP.STORAGE_MEDIUM(storageMedium));
99          return this;
100     }
101 
102 }