Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ClientControllerPlugin / src / oic / simulator / clientcontroller / remoteresource / PutPostAttributeModel.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 java.util.List;
20
21 /**
22  * This is a helper class for showing the resource attributes in PUT and POST
23  * dialogs.
24  */
25 public class PutPostAttributeModel {
26
27     private String       attName;
28     private String       attValue;
29     private List<String> values;
30     boolean              modified;
31
32     public String getAttName() {
33         return attName;
34     }
35
36     public void setAttName(String attName) {
37         this.attName = attName;
38     }
39
40     public String getAttValue() {
41         return attValue;
42     }
43
44     public void setAttValue(String attValue) {
45         this.attValue = attValue;
46     }
47
48     public List<String> getValues() {
49         return values;
50     }
51
52     public void setValues(List<String> values) {
53         this.values = values;
54     }
55
56     public boolean isModified() {
57         return modified;
58     }
59
60     public void setModified(boolean modified) {
61         this.modified = modified;
62     }
63
64     public static PutPostAttributeModel getModel(
65             RemoteResourceAttribute attribute) {
66         PutPostAttributeModel putPostModel = null;
67         if (null != attribute) {
68             putPostModel = new PutPostAttributeModel();
69             putPostModel.setAttName(attribute.getAttributeName());
70             putPostModel.setAttValue(String.valueOf(attribute
71                     .getAttributeValue()));
72             putPostModel.setValues(attribute.getAllValues());
73             putPostModel.setModified(false);
74         }
75         return putPostModel;
76     }
77
78     @Override
79     public String toString() {
80         return attName + "," + attValue + "\n";
81     }
82
83 }