svn-gvsig-desktop / tags / v1_1_Build_1008 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / schemas / parsers / DublinCoreParser.java @ 12520
History | View | Annotate | Download (3.14 KB)
1 | 3566 | jorpiell | |
---|---|---|---|
2 | 3593 | jorpiell | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
3 | 3509 | jorpiell | *
|
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 | 3593 | jorpiell | * Av. Blasco Ib??ez, 50
|
25 | 3509 | jorpiell | * 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 es.gva.cit.catalogClient.metadataXML.XMLNode; |
||
44 | import es.gva.cit.catalogClient.metadataXML.XMLTree; |
||
45 | import es.gva.cit.catalogClient.querys.Coordinates; |
||
46 | import es.gva.cit.catalogClient.schemas.discoverer.Record; |
||
47 | import es.gva.cit.catalogClient.schemas.discoverer.Resource; |
||
48 | |||
49 | /**
|
||
50 | * This class parses a XMLNode that contains a DublinCore tree
|
||
51 | 3566 | jorpiell | *
|
52 | *
|
||
53 | 3509 | jorpiell | * @author Jorge Piera Llodra (piera_jor@gva.es)
|
54 | */
|
||
55 | public class DublinCoreParser extends Record { |
||
56 | 3566 | jorpiell | |
57 | /**
|
||
58 | *
|
||
59 | *
|
||
60 | *
|
||
61 | * @param node
|
||
62 | */
|
||
63 | public DublinCoreParser(XMLNode node) {
|
||
64 | 3509 | jorpiell | setNode(node); |
65 | setTitle(XMLTree.searchNodeValue(node,"dc:title"));
|
||
66 | setAbstract_(XMLTree.searchNodeValue(node, "dc:subject"));
|
||
67 | setPurpose(XMLTree.searchNodeValue(node, "dc:description"));
|
||
68 | setResources(getResources(node)); |
||
69 | |||
70 | 3566 | jorpiell | } |
71 | |||
72 | /**
|
||
73 | * It parses the resource tags
|
||
74 | *
|
||
75 | *
|
||
76 | * @return
|
||
77 | * @param node
|
||
78 | */
|
||
79 | public Resource[] getResources(XMLNode node) { |
||
80 | 3509 | jorpiell | String format = XMLTree.searchNodeValue(node, "dc:format"); |
81 | String source = XMLTree.searchNodeValue(node, "dc:source"); |
||
82 | Coordinates coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:westlimit"), |
||
83 | XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:northlimit"),
|
||
84 | XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:eastlimit"),
|
||
85 | XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:southlimit"));
|
||
86 | |||
87 | if ((source == null) || (format == null)){ |
||
88 | return null; |
||
89 | } |
||
90 | |||
91 | if (format.toLowerCase().equals("shapefile")) |
||
92 | format = Resource.DOWNLOAD; |
||
93 | |||
94 | if (format.toLowerCase().trim().equals("web page")) |
||
95 | format = Resource.WEBSITE; |
||
96 | |||
97 | Resource[] resources = new Resource[1]; |
||
98 | resources[0] = new Resource(source,format,"","","","",coordinates); |
||
99 | |||
100 | return resources;
|
||
101 | 3566 | jorpiell | } |
102 | } |