Statistics
| Revision:

root / trunk / applications / appCatalogAndGazetteerClient / src / es / gva / cit / catalog / schemas / DublinCoreRecord.java @ 15558

History | View | Annotate | Download (3.34 KB)

1

    
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42
package es.gva.cit.catalog.schemas;
43
import java.net.URI;
44

    
45
import es.gva.cit.catalog.metadataxml.XMLNode;
46
import es.gva.cit.catalog.metadataxml.XMLTree;
47
import es.gva.cit.catalog.querys.Coordinates;
48

    
49
/**
50
 * This class parses a XMLNode that contains a DublinCore tree
51
 * 
52
 * 
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class DublinCoreRecord extends Record {
56

    
57
        public  DublinCoreRecord() {   
58

    
59
        }
60

    
61
        /**
62
         * @param node 
63
         */
64
        public  DublinCoreRecord(URI uri,XMLNode node) {        
65
                super(uri,node);            
66
                setTitle(XMLTree.searchNodeValue(node,"dc:title"));
67
                setAbstract_(XMLTree.searchNodeValue(node, "dc:subject"));
68
                setPurpose(XMLTree.searchNodeValue(node, "dc:description"));
69
                setResources(getResources(node));          
70
        } 
71

    
72
        /**
73
         * It parses the resource tags
74
         * 
75
         * 
76
         * @return 
77
         * @param node 
78
         */
79
        public Resource[] getResources(XMLNode node) {        
80
                String format = XMLTree.searchNodeValue(node, "dc:format");
81
                String source = XMLTree.searchNodeValue(node, "dc:source");
82
                Coordinates coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:westlimit"),
83
                                XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:northlimit"),
84
                                XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:eastlimit"),
85
                                XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:southlimit"));
86

    
87
                if ((source == null) || (format == null)){
88
                        return null;
89
                }
90

    
91
                if (format.toLowerCase().equals("shapefile"))
92
                        format = Resource.DOWNLOAD;
93

    
94
                if (format.toLowerCase().trim().equals("web page"))
95
                        format = Resource.WEBSITE;
96

    
97
                Resource[] resources = new Resource[1];
98
                resources[0] = new Resource(source,format,"","","","",coordinates);
99

    
100
                return resources;
101
        }
102

    
103
        /*
104
         * (non-Javadoc)
105
         * @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
106
         */
107
        public boolean accept(URI uri, XMLNode node) {
108
                if ((node.getName().equals("dc:metadata")) ||
109
                                (node.getName().equals("simpledc")) ||
110
                                (node.getName().equals("csw:SummaryRecord")) ||
111
                                (node.getName().equals("csw:Record"))){
112
                        return true;
113
                }
114
                return false;
115
        } 
116
}