Updated the order of imports in the source files of simulator plugins.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ClientControllerPlugin / src / oic / simulator / clientcontroller / remoteresource / RemoteResource.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package oic.simulator.clientcontroller.remoteresource;
18
19 import org.oic.simulator.SimulatorResourceModel;
20 import org.oic.simulator.client.SimulatorRemoteResource;
21
22 import oic.simulator.clientcontroller.utils.Constants;
23
24 /**
25  * This class represents a remote resource. It maintains all the necessary
26  * information about the resource.
27  */
28 public class RemoteResource {
29
30     private boolean                 observed;
31
32     // Native object references
33     private SimulatorRemoteResource remoteResourceRef;
34     private SimulatorResourceModel  resourceModelRef;
35     private ResourceRepresentation  mResourceRepresentation;
36
37     private boolean                 configUploaded;
38
39     private boolean                 getAutomtnInProgress;
40     private boolean                 putAutomtnInProgress;
41     private boolean                 postAutomtnInProgress;
42
43     private int                     getAutomtnId;
44     private int                     putAutomtnId;
45     private int                     postAutomtnId;
46
47     private boolean                 isFavorite;
48
49     public SimulatorResourceModel getResourceModelRef() {
50         return resourceModelRef;
51     }
52
53     public void setResourceModelRef(SimulatorResourceModel resourceModel) {
54         this.resourceModelRef = resourceModel;
55     }
56
57     public int getGetAutomtnId() {
58         return getAutomtnId;
59     }
60
61     public void setGetAutomtnId(int getAutomtnId) {
62         this.getAutomtnId = getAutomtnId;
63     }
64
65     public int getPutAutomtnId() {
66         return putAutomtnId;
67     }
68
69     public void setPutAutomtnId(int putAutomtnId) {
70         this.putAutomtnId = putAutomtnId;
71     }
72
73     public int getPostAutomtnId() {
74         return postAutomtnId;
75     }
76
77     public void setPostAutomtnId(int postAutomtnId) {
78         this.postAutomtnId = postAutomtnId;
79     }
80
81     public boolean isGetAutomtnInProgress() {
82         return getAutomtnInProgress;
83     }
84
85     public void setGetAutomtnInProgress(boolean getAutomtnInProgress) {
86         this.getAutomtnInProgress = getAutomtnInProgress;
87     }
88
89     public boolean isPutAutomtnInProgress() {
90         return putAutomtnInProgress;
91     }
92
93     public void setPutAutomtnInProgress(boolean putAutomtnInProgress) {
94         this.putAutomtnInProgress = putAutomtnInProgress;
95     }
96
97     public boolean isPostAutomtnInProgress() {
98         return postAutomtnInProgress;
99     }
100
101     public void setPostAutomtnInProgress(boolean postAutomtnInProgress) {
102         this.postAutomtnInProgress = postAutomtnInProgress;
103     }
104
105     public boolean isConfigUploaded() {
106         return configUploaded;
107     }
108
109     public void setConfigUploaded(boolean configUploaded) {
110         this.configUploaded = configUploaded;
111     }
112
113     public SimulatorRemoteResource getRemoteResourceRef() {
114         return remoteResourceRef;
115     }
116
117     public void setRemoteResourceRef(SimulatorRemoteResource resource) {
118         this.remoteResourceRef = resource;
119     }
120
121     public boolean isObserved() {
122         return observed;
123     }
124
125     public void setObserved(boolean observed) {
126         this.observed = observed;
127     }
128
129     public int getAutomationtype(int autoId) {
130         if (getAutomtnId == autoId) {
131             return Constants.GET_AUTOMATION_INDEX;
132         } else if (putAutomtnId == autoId) {
133             return Constants.PUT_AUTOMATION_INDEX;
134         } else {
135             return Constants.POST_AUTOMATION_INDEX;
136         }
137     }
138
139     public void updateAutomationStatus(int autoId, boolean status) {
140         if (getAutomtnId == autoId) {
141             getAutomtnInProgress = status;
142         } else if (putAutomtnId == autoId) {
143             putAutomtnInProgress = status;
144         } else {
145             postAutomtnInProgress = status;
146         }
147     }
148
149     public boolean isFavorite() {
150         return isFavorite;
151     }
152
153     public void setFavorite(boolean isFavorite) {
154         this.isFavorite = isFavorite;
155     }
156
157     public void setResourceRepresentation(SimulatorResourceModel resModel,
158             boolean ramlUploaded) {
159         if (mResourceRepresentation == null)
160             mResourceRepresentation = new ResourceRepresentation(resModel);
161         else
162             mResourceRepresentation.update(resModel, ramlUploaded);
163     }
164
165     public ResourceRepresentation getResourceRepresentation() {
166         return mResourceRepresentation;
167     }
168 }