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