Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / org.gvsig.hyperlink.app / org.gvsig.hyperlink.app.extension / src / main / java / org / gvsig / hyperlink / app / extension / config / LinkConfig.java @ 33402

History | View | Annotate | Download (3.04 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

    
23
package org.gvsig.hyperlink.app.extension.config;
24

    
25
import org.gvsig.utils.IPersistence;
26
import org.gvsig.utils.XMLEntity;
27

    
28
public class LinkConfig implements IPersistence {
29

    
30
    private String fieldName;
31
    private String extension = "";
32
    private String actionCode;
33

    
34
    protected LinkConfig() {
35
    }
36

    
37
    public LinkConfig(String actionCode, String fieldName) {
38
        this.actionCode = actionCode;
39
        this.fieldName = fieldName;
40
    }
41

    
42
    public LinkConfig(String actionCode, String fieldName, String extension) {
43
        this.actionCode = actionCode;
44
        this.fieldName = fieldName;
45
        this.extension = extension;
46
    }
47

    
48
    public String getFieldName() {
49
        return fieldName;
50
    }
51

    
52
    public String getActionCode() {
53
        return actionCode;
54
    }
55

    
56
    public void setFieldName(String fieldName) {
57
        this.fieldName = fieldName;
58
    }
59

    
60
    public void setActionCode(String actionCode) {
61
        this.actionCode = actionCode;
62
    }
63

    
64
    public void setExtension(String extension) {
65
        this.extension = extension;
66
    }
67

    
68
    public String getExtension() {
69
        return extension;
70
    }
71

    
72
    public String getClassName() {
73
        return this.getClass().getName();
74
    }
75

    
76
    public XMLEntity getXMLEntity() {
77
        XMLEntity xml = new XMLEntity();
78
        xml.putProperty("className", this.getClassName());
79
        xml.putProperty("actionCode", getActionCode());
80
        xml.putProperty("fieldName", getFieldName());
81
        xml.putProperty("extension", getExtension());
82
        return xml;
83
    }
84

    
85
    public void setXMLEntity(XMLEntity xml) {
86
        if (xml.contains("actionCode")) {
87
            setActionCode(xml.getStringProperty("actionCode"));
88
        } else {
89
            setActionCode("");
90
        }
91
        if (xml.contains("fieldName")) {
92
            setFieldName(xml.getStringProperty("fieldName"));
93
        } else {
94
            setFieldName("");
95
        }
96
        if (xml.contains("extension")) {
97
            setExtension(xml.getStringProperty("extension"));
98
        }
99
    }
100

    
101
    public static LinkConfig createFromXMLEntity(XMLEntity xml) {
102
        LinkConfig link = new LinkConfig();
103
        link.setXMLEntity(xml);
104
        return link;
105
    }
106
}