Performed refactoring and code cleanup on service provider plug-in.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ServiceProviderPlugin / src / oic / simulator / serviceprovider / resource / LocalResourceAttribute.java
1 package oic.simulator.serviceprovider.resource;
2
3 import java.util.List;
4
5 import org.oic.simulator.AutomationType;
6 import org.oic.simulator.ResourceAttribute;
7 import org.oic.simulator.ResourceAttribute.Range;
8 import org.oic.simulator.ResourceAttribute.Type;
9
10 public class LocalResourceAttribute {
11
12     // Native object reference
13     private ResourceAttribute resourceAttribute;
14
15     private Object            attributeValue;
16     private List<String>      attValues;
17
18     private int               automationId;
19
20     private boolean           automationInProgress;
21
22     private int               automationUpdateInterval;
23
24     private AutomationType    automationType;
25
26     public ResourceAttribute getResourceAttribute() {
27         return resourceAttribute;
28     }
29
30     public void setResourceAttribute(ResourceAttribute resourceAttribute) {
31         this.resourceAttribute = resourceAttribute;
32     }
33
34     public String getAttributeName() {
35         return resourceAttribute.getName();
36     }
37
38     public Object getAttributeValue() {
39         return attributeValue;
40     }
41
42     public void setAttributeValue(Object attributeValue) {
43         this.attributeValue = attributeValue;
44     }
45
46     public Object[] getAllowedValues() {
47         return resourceAttribute.getAllowedValues();
48     }
49
50     public Object getMinValue() {
51         return resourceAttribute.getRange().getMin();
52     }
53
54     public Object getMaxValue() {
55         return resourceAttribute.getRange().getMax();
56     }
57
58     public boolean isAutomationInProgress() {
59         return automationInProgress;
60     }
61
62     public void setAutomationInProgress(boolean automationInProgress) {
63         this.automationInProgress = automationInProgress;
64     }
65
66     public int getAutomationUpdateInterval() {
67         return automationUpdateInterval;
68     }
69
70     public void setAutomationUpdateInterval(int automationUpdateInterval) {
71         this.automationUpdateInterval = automationUpdateInterval;
72     }
73
74     public AutomationType getAutomationType() {
75         return automationType;
76     }
77
78     public void setAutomationType(AutomationType automationType) {
79         this.automationType = automationType;
80     }
81
82     public int getAutomationId() {
83         return automationId;
84     }
85
86     public void setAutomationId(int automationId) {
87         this.automationId = automationId;
88     }
89
90     public Type getAttValType() {
91         return resourceAttribute.getType();
92     }
93
94     public Type getAttValBaseType() {
95         return resourceAttribute.getBaseType();
96     }
97
98     public List<String> getAttValues() {
99         return attValues;
100     }
101
102     public void setAttValues(List<String> attValues) {
103         this.attValues = attValues;
104     }
105
106     public void printAttributeDetails() {
107         System.out.println("Attribute Name:" + resourceAttribute.getName());
108         System.out.println("Attribute Value:" + resourceAttribute.getValue());
109         System.out.println("Attribute Base Type:"
110                 + resourceAttribute.getBaseType());
111         System.out.println("Attribute Type:" + resourceAttribute.getType());
112         System.out.print("Allowed Values:");
113         Object[] values = getAllowedValues();
114         for (Object obj : values) {
115             System.out.print(obj);
116         }
117         Range range = resourceAttribute.getRange();
118         if (null != range) {
119             System.out.println("Range:" + range.getMin() + " to "
120                     + range.getMax());
121         }
122     }
123 }