svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libGeocoding / src / org / gvsig / geocoding / address / impl / DefaultRelationsComponent.java @ 28375
History | View | Annotate | Download (2.71 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 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2008 Prodevelop S.L. main development
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.geocoding.address.impl; |
29 |
|
30 |
import org.gvsig.geocoding.address.RelationsComponent; |
31 |
import org.gvsig.tools.persistence.PersistenceException; |
32 |
import org.gvsig.tools.persistence.PersistentState; |
33 |
|
34 |
/**
|
35 |
* RelationsComponent class implementation, relation between the keys of the extension
|
36 |
* (elements) and fields of the data source
|
37 |
*
|
38 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
|
39 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
|
40 |
*/
|
41 |
|
42 |
public class DefaultRelationsComponent implements RelationsComponent { |
43 |
|
44 |
private static final String ELEMENT = "element"; |
45 |
private static final String FIELD = "field"; |
46 |
|
47 |
private String element; |
48 |
private String field; |
49 |
|
50 |
/**
|
51 |
* RelationsComponent constructor
|
52 |
*
|
53 |
* @param elementy
|
54 |
* @param field
|
55 |
*/
|
56 |
public DefaultRelationsComponent(String element, String field) { |
57 |
this.element = element;
|
58 |
this.field = field;
|
59 |
} |
60 |
|
61 |
/**
|
62 |
* Get key element
|
63 |
*
|
64 |
* @return
|
65 |
*/
|
66 |
public String getKeyElement() { |
67 |
return element;
|
68 |
} |
69 |
|
70 |
/**
|
71 |
* Get field descriptor
|
72 |
*
|
73 |
* @return
|
74 |
*/
|
75 |
public String getValue() { |
76 |
return field;
|
77 |
} |
78 |
|
79 |
/**
|
80 |
* Saves the internal state of the object on the provided PersistentState
|
81 |
* object.
|
82 |
*
|
83 |
* @param state
|
84 |
*/
|
85 |
public void saveToState(PersistentState state) throws PersistenceException { |
86 |
state.set(ELEMENT, this.element);
|
87 |
state.set(FIELD, this.field);
|
88 |
|
89 |
} |
90 |
|
91 |
/**
|
92 |
* Set the state of the object from the state passed as parameter.
|
93 |
*
|
94 |
* @param state
|
95 |
*/
|
96 |
public void setState(PersistentState state) throws PersistenceException { |
97 |
this.element = (String) state.get(ELEMENT); |
98 |
this.field = (String) state.get(FIELD); |
99 |
} |
100 |
|
101 |
} |