svn-gvsig-desktop / tags / v1_0_2_Build_902 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / parsers / LaitsGmuParser.java @ 10681
History | View | Annotate | Download (4.24 KB)
1 | 8604 | jorpiell | 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$
|
||
54 | * $Log$
|
||
55 | 8765 | jjdelcerro | * Revision 1.1.2.2 2006-11-15 00:08:08 jjdelcerro
|
56 | * *** empty log message ***
|
||
57 | *
|
||
58 | * Revision 1.2 2006/11/13 10:01:01 jorpiell
|
||
59 | * Nuevos parsers para el servidor de GMU
|
||
60 | *
|
||
61 | * Revision 1.1.2.1 2006/11/08 12:57:12 jorpiell
|
||
62 | 8604 | jorpiell | * Se han hecho numerosos cambios para que pueda funcionar el nomenclator de Simon y el cat?logo de GMU
|
63 | *
|
||
64 | *
|
||
65 | */
|
||
66 | /**
|
||
67 | * @author Jorge Piera Llodr? (piera_jor@gva.es)
|
||
68 | */
|
||
69 | public class LaitsGmuParser extends Record { |
||
70 | |||
71 | /**
|
||
72 | * Constructor
|
||
73 | *
|
||
74 | *
|
||
75 | * @param node Node with the answer
|
||
76 | * @param serverURL Server URL. Necessary to load the image (just Geonetwork)
|
||
77 | */
|
||
78 | public LaitsGmuParser(XMLNode node, URL serverURL) { |
||
79 | setNode(node); |
||
80 | setTitle(XMLTree.searchNodeValue(node,"granuleShortName"));
|
||
81 | setAbstract_(XMLTree.searchNodeValue(node, "description"));
|
||
82 | setPurpose(null);
|
||
83 | setKeyWords(null);
|
||
84 | setResources(getResources("OnlineAccessURLs->OnlineAccessURL"));
|
||
85 | setFileID(null);
|
||
86 | setServerURL(serverURL); |
||
87 | //Caution: getImageUrl uses serverURL and FileID!!!
|
||
88 | setImage(null);
|
||
89 | |||
90 | } |
||
91 | |||
92 | /**
|
||
93 | *
|
||
94 | *
|
||
95 | *
|
||
96 | * @return
|
||
97 | * @param label
|
||
98 | */
|
||
99 | private Resource[] getResources(String label) { |
||
100 | XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
|
||
101 | Coordinates coordinates = null;
|
||
102 | String srs = null; |
||
103 | |||
104 | if (nodes == null) { |
||
105 | return null; |
||
106 | } |
||
107 | Resource[] resources = new Resource[nodes.length]; |
||
108 | if (nodes.length > 0){ |
||
109 | srs = XMLTree.searchNodeValue(getNode(),"ogc:BBOX->referenceSystemNameCode");
|
||
110 | coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"ogc:BBOX->westBoundingCoordinate"), |
||
111 | XMLTree.searchNodeValue(getNode(),"ogc:BBOX->northBoundingCoordinate"),
|
||
112 | XMLTree.searchNodeValue(getNode(),"ogc:BBOX->eastBoundingCoordinate"),
|
||
113 | XMLTree.searchNodeValue(getNode(),"ogc:BBOX->southBoundingCoordinate"));
|
||
114 | } |
||
115 | |||
116 | |||
117 | for (int i = 0; i < resources.length; i++){ |
||
118 | resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
|
||
119 | "URL"),
|
||
120 | Resource.DOWNLOAD, |
||
121 | XMLTree.searchNodeValue(nodes[i], "orName"),
|
||
122 | XMLTree.searchNodeValue(nodes[i], "URLDescription"),
|
||
123 | XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
|
||
124 | "value"),
|
||
125 | srs, |
||
126 | coordinates); |
||
127 | if (resources[i].getLinkage() == null){ |
||
128 | resources[i].setLinkage("");
|
||
129 | } |
||
130 | |||
131 | } |
||
132 | |||
133 | |||
134 | return resources;
|
||
135 | } |
||
136 | |||
137 | |||
138 | } |