svn-gvsig-desktop / trunk / extensions / extMetadata / src / org / gvsig / metadata / extended / manager / MDElementImpl.java @ 24124
History | View | Annotate | Download (2.82 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 Geographic Information research group: http://www.geoinfo.uji.es
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI)
|
27 |
* Universitat Jaume I
|
28 |
* {{Task}}
|
29 |
*/
|
30 |
|
31 |
|
32 |
|
33 |
package org.gvsig.metadata.extended.manager; |
34 |
|
35 |
import java.util.Locale; |
36 |
|
37 |
import org.gvsig.metadata.extended.ExtendedMetadata; |
38 |
import org.gvsig.metadata.extended.MDElement; |
39 |
import org.gvsig.metadata.extended.registry.objects.MDElementDefinition; |
40 |
|
41 |
|
42 |
public class MDElementImpl implements MDElement{ |
43 |
|
44 |
private String id; |
45 |
private Object value; |
46 |
private MDElementDefinition type;
|
47 |
private Locale locale; |
48 |
|
49 |
private ExtendedMetadata father;
|
50 |
|
51 |
|
52 |
public MDElementImpl() {}
|
53 |
|
54 |
public MDElementImpl(Object value, MDElementDefinition type, Locale locale) { |
55 |
//this.id = id; Que poner como ID???
|
56 |
this.value = value;
|
57 |
this.type = type;
|
58 |
this.locale = locale;
|
59 |
} |
60 |
|
61 |
public String getId() { |
62 |
return this.id; |
63 |
} |
64 |
|
65 |
public Object getValue() { |
66 |
return this.value; |
67 |
} |
68 |
|
69 |
public MDElementDefinition getType() {
|
70 |
return this.type; |
71 |
} |
72 |
|
73 |
public Locale getLocale() { |
74 |
return this.locale; |
75 |
} |
76 |
|
77 |
public void setId(String id) { |
78 |
this.id = id;
|
79 |
} |
80 |
|
81 |
public void setValue(Object value) { |
82 |
this.value = value;
|
83 |
} |
84 |
|
85 |
public void setType(MDElementDefinition type) { |
86 |
this.type = type;
|
87 |
} |
88 |
|
89 |
public void setLocale(Locale locale) { |
90 |
this.locale = locale;
|
91 |
} |
92 |
|
93 |
public String getName() { |
94 |
return this.type.getName(); |
95 |
} |
96 |
|
97 |
public void setName(String name) { |
98 |
this.type.setName(name);
|
99 |
} |
100 |
|
101 |
/**
|
102 |
* @return the father
|
103 |
*/
|
104 |
public ExtendedMetadata getFather() {
|
105 |
return father;
|
106 |
} |
107 |
|
108 |
/**
|
109 |
* @param father the father to set
|
110 |
*/
|
111 |
public void setFather(ExtendedMetadata father) { |
112 |
this.father = father;
|
113 |
} |
114 |
|
115 |
public boolean hasFather() { |
116 |
return (father != null); |
117 |
} |
118 |
|
119 |
public int getLevel() { |
120 |
if(!this.hasFather()) |
121 |
return 0; |
122 |
else
|
123 |
return 1 + this.getFather().getLevel(); |
124 |
} |
125 |
} |