Statistics
| Revision:

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

History | View | Annotate | Download (3.83 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

    
48
/**
49
 * This class is used to parse the metadata retreived using
50
 * the CSW deegree server.
51
 * 
52
 * 
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class DeegreeISO19115Record extends Record {
56

    
57
        public  DeegreeISO19115Record() {        
58

    
59
        }
60
        
61
        /**
62
         * @param node 
63
         */
64
        public  DeegreeISO19115Record(URI uri,XMLNode node) {        
65
                super(uri,node);
66

    
67
                setTitle(XMLTree.searchNodeValue(node,
68
                                "iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:citation->smXML:CI_Citation->smXML:title->smXML:CharacterString"));
69
                setAbstract_(XMLTree.searchNodeValue(node,
70
                "iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:abstract->smXML:CharacterString"));
71
                setPurpose(XMLTree.searchNodeValue(node,
72
                "iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:purpose->smXML:CharacterString"));
73
                setKeyWords(XMLTree.searchMultipleNodeValue(node,
74
                "iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:descriptiveKeywords->smXML:MD_Keywords->smXML:keyword->smXML:CharacterString"));
75
                setResources(getResources("iso19115:distributionInfo->smXML:MD_Distribution->smXML:distributor->smXML:MD_Distributor->smXML:distributorContact->smXML:CI_ResponsibleParty->smXML:contactInfo->smXML:CI_Contact->smXML:onlineResource->smXML:CI_OnlineResource"));
76
                setImageURL("iso19115:identificationInfo->smXML:MD_DataIdentification->smXML:graphicOverview->smXML:MD_BrowseGraphic->smXML:fileName->smXML:CharacterString");
77
        } 
78

    
79
        /**
80
         * It parses the online resources
81
         * 
82
         * 
83
         * @return Resource
84
         * @param label Label that contains the resource root
85
         */
86
        private Resource[] getResources(String label) {        
87
                XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
88

    
89
                if (nodes == null) {
90
                        return null;
91
                }
92
                Resource[] resources = new Resource[nodes.length];
93

    
94
                for (int i = 0; i < resources.length; i++)
95
                        resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],"smXML:linkage->smXML:URL"),
96
                                        XMLTree.searchNodeValue(nodes[i],"smXML:protocol->smXML:CharacterString"),
97
                                        XMLTree.searchNodeValue(nodes[i],"smXML:name->smXML:CharacterString"),
98
                                        XMLTree.searchNodeValue(nodes[i],"smXML:description->smXML:CharacterString"),
99
                                        "",
100
                                        "",        
101
                                        null);
102
                return resources;
103
        }
104

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