Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / extensions / extPublish / src / org / gvsig / publish / ogcmetadata / OGCCommonMetadata.java @ 19900

History | View | Annotate | Download (3.77 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *   Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Iba?ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *   +34 963862235
28
 *   gvsig@gva.es
29
 *   www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.publish.ogcmetadata;
42

    
43
import org.gvsig.publish.IPublishPersistence;
44
import org.gvsig.publish.PublishLogger;
45

    
46
import com.iver.utiles.XMLEntity;
47

    
48
/**
49
 * This class represents any OGC entity metadata 
50
 * 
51
 * @author Jos? Vicente Hig?n (josevicente.higon@iver.es)
52
 *
53
 */
54
public class OGCCommonMetadata implements IPublishPersistence, IOGCCommonMetadata{
55
        
56
        private String name=null;
57
        private String title = null;
58
        private String description = null;
59
        /*
60
         * (non-Javadoc)
61
         * @see org.gvsig.publish.IPublishPersistence#getVersion()
62
         */
63
        public int getVersion(){
64
                return 1;
65
        }
66

    
67
        /* (non-Javadoc)
68
         * @see org.gvsig.publish.ogcmetadata.ICommonOGCMetadata#getName()
69
         */
70
        public String getName(){
71
                return name;
72
        }
73
        /* (non-Javadoc)
74
         * @see org.gvsig.publish.ogcmetadata.ICommonOGCMetadata#setName(java.lang.String)
75
         */
76
        public void setName(String name){
77
                this.name = name;
78
        }
79
        /* (non-Javadoc)
80
         * @see org.gvsig.publish.ogcmetadata.ICommonOGCMetadata#getTitle()
81
         */
82
        public String getTitle(){
83
                return title;
84
        }
85
        /* (non-Javadoc)
86
         * @see org.gvsig.publish.ogcmetadata.ICommonOGCMetadata#setTitle(java.lang.String)
87
         */
88
        public void setTitle(String title){
89
                this.title = title;
90
        }
91
        /* (non-Javadoc)
92
         * @see org.gvsig.publish.ogcmetadata.ICommonOGCMetadata#getAbstract()
93
         */
94
        public String getAbstract(){
95
                return description;
96
        }
97
        /* (non-Javadoc)
98
         * @see org.gvsig.publish.ogcmetadata.ICommonOGCMetadata#setAbstract(java.lang.String)
99
         */
100
        public void setAbstract(String description){
101
                this.description = description;
102
        }
103
/*
104
 * (non-Javadoc)
105
 * @see com.iver.utiles.IPersistance#setXMLEntity(com.iver.utiles.XMLEntity)
106
 */        
107
        public void setXMLEntity(XMLEntity xml) {
108
                //check version
109
                int version = xml.getIntProperty("version");                
110
                if (version!= getVersion()){
111
                        PublishLogger.getLog().error("ERROR: " + getClassName() + ": the version doesn't match!");
112
                        return;
113
                }        
114
                //set properties
115
                setTitle(xml.getStringProperty("ogctitle"));
116
                setName(xml.getStringProperty("ogcname"));
117
                setAbstract(xml.getStringProperty("ogcabstract"));
118
        }
119
        /*
120
         * (non-Javadoc)
121
         * @see com.iver.utiles.IPersistance#getXMLEntity()
122
         */
123
        public XMLEntity getXMLEntity() {                
124
                XMLEntity xml=new XMLEntity();
125
                //put version and className
126
                xml.setName(getClassName());
127
                xml.putProperty("version", getVersion());
128
                
129
                //put properties
130
                xml.putProperty("ogcname", getName());
131
                xml.putProperty("ogctitle", getTitle());
132
                xml.putProperty("ogcabstract", getAbstract());
133
                return xml;
134
        }
135
/*
136
 * (non-Javadoc)
137
 * @see com.iver.utiles.IPersistance#getClassName()
138
 */
139
        public String getClassName() {
140
                
141
                return "OGCCommonMetadata";
142
        }
143

    
144
}