gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org.gvsig.vcsgis.lib / org.gvsig.vcsgis.lib.impl / src / main / java / org / gvsig / vcsgis / lib / VCSGisTopologyPlanImpl.java @ 3315
History | View | Annotate | Download (3.32 KB)
1 |
/*
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2020 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18 |
*
|
19 |
* For any additional information, do not hesitate to contact us
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
21 |
*/
|
22 |
|
23 |
package org.gvsig.vcsgis.lib; |
24 |
|
25 |
import javax.json.JsonObject; |
26 |
import org.gvsig.json.Json; |
27 |
import org.gvsig.json.JsonObjectBuilder; |
28 |
|
29 |
/**
|
30 |
*
|
31 |
* @author gvSIG Team
|
32 |
*/
|
33 |
public class VCSGisTopologyPlanImpl implements VCSGisTopologyPlan { |
34 |
|
35 |
private String topologyPlanCode; |
36 |
private String name; |
37 |
private String description; |
38 |
private String data; |
39 |
|
40 |
public VCSGisTopologyPlanImpl() {
|
41 |
|
42 |
} |
43 |
|
44 |
public VCSGisTopologyPlanImpl(JsonObject jsonData) {
|
45 |
this.topologyPlanCode = jsonData.getString("TopologyPlanCode", null); |
46 |
this.name = jsonData.getString("Name", null); |
47 |
this.description = jsonData.getString("Description", null); |
48 |
this.data = jsonData.getString("Data", null); |
49 |
} |
50 |
|
51 |
@Override
|
52 |
public String getTopologyPlanCode() { |
53 |
return this.topologyPlanCode; |
54 |
} |
55 |
|
56 |
@Override
|
57 |
public String getName() { |
58 |
return this.name; |
59 |
} |
60 |
|
61 |
@Override
|
62 |
public String getDescription() { |
63 |
return this.description; |
64 |
} |
65 |
|
66 |
@Override
|
67 |
public String getData() { |
68 |
return this.data; |
69 |
} |
70 |
|
71 |
@Override
|
72 |
public String getLabel() { |
73 |
return this.getName(); |
74 |
} |
75 |
|
76 |
@Override
|
77 |
public VCSGisTopologyPlan getValue() {
|
78 |
return this; |
79 |
} |
80 |
|
81 |
@Override
|
82 |
public void copyFrom(VCSGisTopologyPlan other) { |
83 |
this.topologyPlanCode = other.getTopologyPlanCode();
|
84 |
this.name = other.getName();
|
85 |
this.description = other.getDescription();
|
86 |
this.data = other.getData();
|
87 |
} |
88 |
|
89 |
@Override
|
90 |
public JsonObject toJson() {
|
91 |
return this.toJsonBuilder().build(); |
92 |
} |
93 |
|
94 |
@Override
|
95 |
public JsonObjectBuilder toJsonBuilder() {
|
96 |
return VCSGisTopologyPlanImpl.toJsonBuilder(this); |
97 |
} |
98 |
|
99 |
|
100 |
@Override
|
101 |
public String toString() { |
102 |
return VCSGisTopologyPlanImpl.toString(this); |
103 |
} |
104 |
|
105 |
public static JsonObjectBuilder toJsonBuilder(VCSGisTopologyPlan topologyPlan) { |
106 |
JsonObjectBuilder builder = Json.createObjectBuilder(); |
107 |
builder.add("TopologyPlanCode", topologyPlan.getTopologyPlanCode());
|
108 |
builder.add("Name", topologyPlan.getName());
|
109 |
builder.add("Description", topologyPlan.getDescription());
|
110 |
builder.add("Data", topologyPlan.getData());
|
111 |
return builder;
|
112 |
} |
113 |
|
114 |
public static String getLabel(VCSGisTopologyPlan topologyPlan) { |
115 |
return topologyPlan.getName();
|
116 |
} |
117 |
|
118 |
public static String toString(VCSGisTopologyPlan topologyPlan) { |
119 |
return topologyPlan.getName();
|
120 |
} |
121 |
|
122 |
} |