Statistics
| Revision:

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 @ 3308

History | View | Annotate | Download (3.27 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(JsonObject jsonData) {
41
        this.topologyPlanCode = jsonData.getString("TopologyPlanCode", null);
42
        this.name = jsonData.getString("Name", null);
43
        this.description = jsonData.getString("Description", null);
44
        this.data = jsonData.getString("Data", null);
45
    }
46

    
47

    
48
    @Override
49
    public String getTopologyPlanCode() {
50
        return this.topologyPlanCode;
51
    }
52

    
53
    @Override
54
    public String getName() {
55
        return this.name;
56
    }
57

    
58
    @Override
59
    public String getDescription() {
60
        return this.description;
61
    }
62

    
63
    @Override
64
    public String getData() {
65
        return this.data;
66
    }
67

    
68
    @Override
69
    public String getLabel() {
70
        return this.getName();
71
    }
72

    
73
    @Override
74
    public VCSGisTopologyPlan getValue() {
75
        return this;
76
    }
77

    
78
    @Override
79
    public void copyFrom(VCSGisTopologyPlan other) {
80
        this.topologyPlanCode = other.getTopologyPlanCode();
81
        this.name = other.getName();
82
        this.description = other.getDescription();
83
        this.data = other.getData();
84
    }
85

    
86
    @Override
87
    public JsonObject toJson() {
88
        return this.toJsonBuilder().build();
89
    }
90

    
91
    @Override
92
    public JsonObjectBuilder toJsonBuilder() {
93
        return VCSGisTopologyPlanImpl.toJsonBuilder(this);
94
    }
95
    
96

    
97
    @Override
98
    public String toString() {
99
        return VCSGisTopologyPlanImpl.toString(this);
100
    }
101

    
102
    public static JsonObjectBuilder toJsonBuilder(VCSGisTopologyPlan topologyPlan) {
103
        JsonObjectBuilder builder = Json.createObjectBuilder();
104
        builder.add("TopologyPlanCode", topologyPlan.getTopologyPlanCode());
105
        builder.add("Name", topologyPlan.getName());
106
        builder.add("Description", topologyPlan.getDescription());
107
        builder.add("Data", topologyPlan.getData());
108
        return builder;
109
    }
110
    
111
    public static String getLabel(VCSGisTopologyPlan topologyPlan) {
112
        return topologyPlan.getName();
113
    }
114
    
115
    public static String toString(VCSGisTopologyPlan topologyPlan) {
116
        return topologyPlan.getName();
117
    }
118

    
119
}