root / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / parsers / dublinCore / DublinCoreRecordsParser.java @ 3486
History | View | Annotate | Download (3.1 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package es.gva.cit.catalogClient.parsers.dublinCore; |
42 |
|
43 |
import es.gva.cit.catalogClient.metadataXML.XMLNode; |
44 |
import es.gva.cit.catalogClient.metadataXML.XMLTree; |
45 |
import es.gva.cit.catalogClient.parsers.AbstractTags; |
46 |
import es.gva.cit.catalogClient.parsers.Resource; |
47 |
import es.gva.cit.catalogClient.querys.Coordinates; |
48 |
|
49 |
/**
|
50 |
* This class parses a XMLNode that contains a DublinCore tree
|
51 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
52 |
*/
|
53 |
public class DublinCoreRecordsParser extends AbstractTags { |
54 |
public DublinCoreRecordsParser(XMLNode node){
|
55 |
setNode(node); |
56 |
setTitle(XMLTree.searchNodeValue(node,"dc:title"));
|
57 |
setAbstract_(XMLTree.searchNodeValue(node, "dc:subject"));
|
58 |
setPurpose(XMLTree.searchNodeValue(node, "dc:description"));
|
59 |
setResources(getResources(node)); |
60 |
|
61 |
} |
62 |
|
63 |
/**
|
64 |
* It parses the resource tags
|
65 |
* @param node
|
66 |
* @return
|
67 |
*/
|
68 |
public Resource[] getResources(XMLNode node){ |
69 |
String format = XMLTree.searchNodeValue(node, "dc:format"); |
70 |
String source = XMLTree.searchNodeValue(node, "dc:source"); |
71 |
Coordinates coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:westlimit"), |
72 |
XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:northlimit"),
|
73 |
XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:eastlimit"),
|
74 |
XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:southlimit"));
|
75 |
|
76 |
if ((source == null) || (format == null)){ |
77 |
return null; |
78 |
} |
79 |
|
80 |
if (format.toLowerCase().equals("shapefile")) |
81 |
format = Resource.DOWNLOAD; |
82 |
|
83 |
if (format.toLowerCase().trim().equals("web page")) |
84 |
format = Resource.WEBSITE; |
85 |
|
86 |
Resource[] resources = new Resource[1]; |
87 |
resources[0] = new Resource(source,format,"","","","",coordinates); |
88 |
|
89 |
return resources;
|
90 |
} |
91 |
|
92 |
|
93 |
} |