Statistics
| Revision:

svn-gvsig-desktop / tags / v10_RC2c / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / parsers / LaitsGmuParser.java @ 8745

History | View | Annotate | Download (4.07 KB)

1
package es.gva.cit.catalogClient.schemas.parsers;
2

    
3
import java.net.URL;
4

    
5
import es.gva.cit.catalogClient.metadataXML.XMLNode;
6
import es.gva.cit.catalogClient.metadataXML.XMLTree;
7
import es.gva.cit.catalogClient.querys.Coordinates;
8
import es.gva.cit.catalogClient.schemas.discoverer.Record;
9
import es.gva.cit.catalogClient.schemas.discoverer.Resource;
10

    
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id: LaitsGmuParser.java 8745 2006-11-14 13:14:23Z  $
54
 * $Log$
55
 * Revision 1.1.2.1  2006-11-08 12:57:12  jorpiell
56
 * Se han hecho numerosos cambios para que pueda funcionar el nomenclator de Simon y el cat?logo de GMU
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
62
 */
63
public class LaitsGmuParser extends Record {
64

    
65
        /**
66
         * Constructor
67
         * 
68
         * 
69
         * @param node Node with the answer
70
         * @param serverURL Server URL. Necessary to load the image (just Geonetwork)
71
         */
72
            public  LaitsGmuParser(XMLNode node, URL serverURL) {        
73
                setNode(node);
74
                setTitle(XMLTree.searchNodeValue(node,"granuleShortName"));
75
                setAbstract_(XMLTree.searchNodeValue(node, "description"));
76
                setPurpose(null);
77
                setKeyWords(null);
78
                setResources(getResources("OnlineAccessURLs->OnlineAccessURL"));
79
                setFileID(null);
80
                setServerURL(serverURL);
81
                //Caution: getImageUrl uses serverURL and FileID!!!
82
                setImage(null);
83
                
84
            } 
85

    
86
        /**
87
         * 
88
         * 
89
         * 
90
         * @return 
91
         * @param label 
92
         */
93
            private Resource[] getResources(String label) {        
94
                XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
95
                Coordinates coordinates = null;
96
                String srs = null;
97
                
98
                if (nodes == null) {
99
                    return null;
100
                }
101
                Resource[] resources = new Resource[nodes.length];
102
                if (nodes.length > 0){
103
                        srs = XMLTree.searchNodeValue(getNode(),"ogc:BBOX->referenceSystemNameCode");
104
                        coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"ogc:BBOX->westBoundingCoordinate"),
105
                                        XMLTree.searchNodeValue(getNode(),"ogc:BBOX->northBoundingCoordinate"),
106
                                                XMLTree.searchNodeValue(getNode(),"ogc:BBOX->eastBoundingCoordinate"),
107
                                                XMLTree.searchNodeValue(getNode(),"ogc:BBOX->southBoundingCoordinate"));
108
                }
109
                        
110
                        
111
                for (int i = 0; i < resources.length; i++){
112
                            resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
113
                                "URL"),
114
                            Resource.DOWNLOAD,
115
                            XMLTree.searchNodeValue(nodes[i], "orName"),
116
                            XMLTree.searchNodeValue(nodes[i], "URLDescription"),
117
                            XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
118
                                "value"),
119
                                                srs,        
120
                                    coordinates);
121
                            if (resources[i].getLinkage() == null){
122
                                    resources[i].setLinkage("");
123
                            }
124
                            
125
                }
126
                
127
                
128
                return resources;
129
            }     
130
          
131
            
132
         }