2 * Copyright 2015 Samsung Electronics All Rights Reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package oic.simulator.clientcontroller.remoteresource;
21 import org.oic.simulator.SimulatorResourceModel;
22 import org.oic.simulator.client.SimulatorRemoteResource;
23 import org.oic.simulator.client.SimulatorRemoteResource.RequestType;
24 import org.oic.simulator.client.SimulatorRequestModel;
27 * This class represents a remote resource. It maintains all the necessary
28 * information about the resource.
30 public class RemoteResource {
32 private boolean observed;
34 // Native object references
35 private SimulatorRemoteResource remoteResourceRef;
36 private SimulatorResourceModel resourceModelRef;
37 private Map<RequestType, SimulatorRequestModel> requestModels;
38 private ResourceRepresentation mResourceRepresentation;
40 private boolean configUploaded;
42 private boolean getAutomtnInProgress;
43 private boolean putAutomtnInProgress;
44 private boolean postAutomtnInProgress;
46 private int getAutomtnId;
47 private int putAutomtnId;
48 private int postAutomtnId;
50 private boolean isFavorite;
52 public SimulatorResourceModel getResourceModelRef() {
53 return resourceModelRef;
56 public void setResourceModelRef(SimulatorResourceModel resourceModel) {
57 this.resourceModelRef = resourceModel;
60 public Map<RequestType, SimulatorRequestModel> getRequestModels() {
64 public void setRequestModels(
65 Map<RequestType, SimulatorRequestModel> requestModels) {
66 this.requestModels = requestModels;
69 public int getGetAutomtnId() {
73 public void setGetAutomtnId(int getAutomtnId) {
74 this.getAutomtnId = getAutomtnId;
77 public int getPutAutomtnId() {
81 public void setPutAutomtnId(int putAutomtnId) {
82 this.putAutomtnId = putAutomtnId;
85 public int getPostAutomtnId() {
89 public void setPostAutomtnId(int postAutomtnId) {
90 this.postAutomtnId = postAutomtnId;
93 public boolean isGetAutomtnInProgress() {
94 return getAutomtnInProgress;
97 public void setGetAutomtnInProgress(boolean getAutomtnInProgress) {
98 this.getAutomtnInProgress = getAutomtnInProgress;
101 public boolean isPutAutomtnInProgress() {
102 return putAutomtnInProgress;
105 public void setPutAutomtnInProgress(boolean putAutomtnInProgress) {
106 this.putAutomtnInProgress = putAutomtnInProgress;
109 public boolean isPostAutomtnInProgress() {
110 return postAutomtnInProgress;
113 public void setPostAutomtnInProgress(boolean postAutomtnInProgress) {
114 this.postAutomtnInProgress = postAutomtnInProgress;
117 public boolean isConfigUploaded() {
118 return configUploaded;
121 public void setConfigUploaded(boolean configUploaded) {
122 this.configUploaded = configUploaded;
125 public SimulatorRemoteResource getRemoteResourceRef() {
126 return remoteResourceRef;
129 public void setRemoteResourceRef(SimulatorRemoteResource resource) {
130 this.remoteResourceRef = resource;
133 public boolean isObserved() {
137 public void setObserved(boolean observed) {
138 this.observed = observed;
141 public RequestType getAutomationtype(int autoId) {
142 if (getAutomtnId == autoId) {
143 return RequestType.GET;
144 } else if (putAutomtnId == autoId) {
145 return RequestType.PUT;
147 return RequestType.POST;
151 public void updateAutomationStatus(int autoId, boolean status) {
152 if (getAutomtnId == autoId) {
153 getAutomtnInProgress = status;
154 } else if (putAutomtnId == autoId) {
155 putAutomtnInProgress = status;
157 postAutomtnInProgress = status;
161 public boolean isFavorite() {
165 public void setFavorite(boolean isFavorite) {
166 this.isFavorite = isFavorite;
169 public void setResourceRepresentation(SimulatorResourceModel resModel) {
170 mResourceRepresentation = new ResourceRepresentation(resModel);
173 public ResourceRepresentation getResourceRepresentation() {
174 return mResourceRepresentation;