Statistics
| Revision:

root / tags / Root_CatalogYNomenclator_v1_1_0_1005 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / parsers / GeonetworkISO19115Parser.java @ 12457

History | View | Annotate | Download (4.04 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.catalogClient.schemas.parsers;
43
import java.net.URL;
44

    
45
import es.gva.cit.catalogClient.metadataXML.XMLNode;
46
import es.gva.cit.catalogClient.metadataXML.XMLTree;
47
import es.gva.cit.catalogClient.querys.Coordinates;
48
import es.gva.cit.catalogClient.schemas.discoverer.Record;
49
import es.gva.cit.catalogClient.schemas.discoverer.Resource;
50

    
51
/**
52
 * 
53
 * 
54
 * 
55
 * @author Jorge Piera Llodra (piera_jor@gva.es)
56
 */
57
public class GeonetworkISO19115Parser extends Record {
58

    
59
/**
60
 * Constructor
61
 * 
62
 * 
63
 * @param node Node with the answer
64
 * @param serverURL Server URL. Necessary to load the image (just Geonetwork)
65
 */
66
    public  GeonetworkISO19115Parser(XMLNode node, URL serverURL) {        
67
        setNode(node);
68
        setTitle(XMLTree.searchNodeValue(node,
69
                "dataIdInfo->idCitation->resTitle"));
70
        setAbstract_(XMLTree.searchNodeValue(node, "dataIdInfo->idAbs"));
71
        setPurpose(XMLTree.searchNodeValue(node, "dataIdInfo->idPurp"));
72
        setKeyWords(XMLTree.searchMultipleNodeValue(node,
73
                "dataIdInfo->descKeys->keyword"));
74
        setResources(getResources("distInfo->distTranOps->onLineSrc"));
75
        setFileID(XMLTree.searchNodeValue(node,"mdFileID"));
76
        setServerURL(serverURL);
77
        //Caution: getImageUrl uses serverURL and FileID!!!
78
        setImage(getImageUrl("dataIdInfo->graphOver"));
79
        
80
    } 
81

    
82
/**
83
 * 
84
 * 
85
 * 
86
 * @return 
87
 * @param label 
88
 */
89
    private Resource[] getResources(String label) {        
90
        XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
91
        Coordinates coordinates = null;
92
        String srs = null;
93
        
94
        if (nodes == null) {
95
            return null;
96
        }
97
        Resource[] resources = new Resource[nodes.length];
98
        if (nodes.length > 0){
99
                srs = XMLTree.searchNodeValue(getNode(),"refSysInfo->MdCoRefSys->refSysID->identCode");
100
                coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->westBL"),
101
                                XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->northBL"),
102
                                        XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->eastBL"),
103
                                        XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->southBL"));
104
        }
105
                
106
                
107
        for (int i = 0; i < resources.length; i++){
108
                    resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
109
                        "linkage"),
110
                    XMLTree.searchNodeValue(nodes[i], "protocol"),
111
                    XMLTree.searchNodeValue(nodes[i], "orName"),
112
                    XMLTree.searchNodeValue(nodes[i], "orDesc"),
113
                    XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
114
                        "value"),
115
                                        srs,        
116
                            coordinates);
117
                    if (resources[i].getLinkage() == null){
118
                            resources[i].setLinkage("");
119
                    }
120
                    
121
        }
122
        
123
        
124
        return resources;
125
    }     
126
  
127
    
128
 }