svn-gvsig-desktop / branches / v10 / applications / appCatalogAndGazetteerClient / src / es / gva / cit / catalog / schemas / Iso19139Record.java @ 18617
History | View | Annotate | Download (3.3 KB)
1 | 16004 | jpiera | package es.gva.cit.catalog.schemas; |
---|---|---|---|
2 | |||
3 | import java.net.URI; |
||
4 | |||
5 | import es.gva.cit.catalog.metadataxml.XMLNode; |
||
6 | import es.gva.cit.catalog.metadataxml.XMLTree; |
||
7 | import es.gva.cit.catalog.querys.Coordinates; |
||
8 | |||
9 | public class Iso19139Record extends Record{ |
||
10 | |||
11 | public Iso19139Record() {
|
||
12 | |||
13 | } |
||
14 | |||
15 | /**
|
||
16 | * Constructor
|
||
17 | * @param node Node with the answer
|
||
18 | * @param serverURI Server URL. Necessary to load the image (just Geonetwork)
|
||
19 | */
|
||
20 | public Iso19139Record(URI uri, XMLNode node) { |
||
21 | super(uri,node);
|
||
22 | setTitle(node.searchNodeValue( |
||
23 | "identificationInfo->MD_DataIdentification->citation->CI_Citation->title->CharacterString"));
|
||
24 | setAbstract_(node.searchNodeValue("identificationInfo->MD_DataIdentification->abstract->gco:CharacterString"));
|
||
25 | setPurpose(node.searchNodeValue("dataIdInfo->idPurp"));
|
||
26 | setKeyWords(node.searchMultipleNodeValue( |
||
27 | "identificationInfo->MD_DataIdentification->descriptiveKeywords->MD_Keywords->keyword->gco:CharacterString"));
|
||
28 | setResources(getResources("distributionInfo->MD_Distribution->transferOptions->MD_DigitalTransferOptions->onLine->CI_OnlineResource"));
|
||
29 | setFileID(node.searchNodeValue("mdFileID"));
|
||
30 | setImageURL(node.searchNodeValue("dataIdInfo->graphOver"));
|
||
31 | |||
32 | } |
||
33 | |||
34 | /**
|
||
35 | *
|
||
36 | *
|
||
37 | *
|
||
38 | * @return
|
||
39 | * @param label
|
||
40 | */
|
||
41 | private Resource[] getResources(String label) { |
||
42 | XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label);
|
||
43 | Coordinates coordinates = null;
|
||
44 | String srs = null; |
||
45 | |||
46 | if (nodes == null) { |
||
47 | return null; |
||
48 | } |
||
49 | Resource[] resources = new Resource[nodes.length]; |
||
50 | if (nodes.length > 0){ |
||
51 | srs = XMLTree.searchNodeValue(getNode(),"refSysInfo->MdCoRefSys->refSysID->identCode");
|
||
52 | coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->westBL"), |
||
53 | XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->northBL"),
|
||
54 | XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->eastBL"),
|
||
55 | XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->southBL"));
|
||
56 | } |
||
57 | |||
58 | |||
59 | for (int i = 0; i < resources.length; i++){ |
||
60 | resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i],
|
||
61 | "linkage->URL"),
|
||
62 | XMLTree.searchNodeValue(nodes[i], "protocol->gco:CharacterString"),
|
||
63 | XMLTree.searchNodeValue(nodes[i], "name->gco:CharacterString"),
|
||
64 | XMLTree.searchNodeValue(nodes[i], "orDesc"),
|
||
65 | XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd",
|
||
66 | "value"),
|
||
67 | srs, |
||
68 | coordinates); |
||
69 | if (resources[i].getLinkage() == null){ |
||
70 | resources[i].setLinkage("");
|
||
71 | } |
||
72 | |||
73 | } |
||
74 | |||
75 | |||
76 | return resources;
|
||
77 | } |
||
78 | |||
79 | /*
|
||
80 | * (non-Javadoc)
|
||
81 | * @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode)
|
||
82 | */
|
||
83 | public boolean accept(URI uri, XMLNode node) { |
||
84 | if (node.getName().endsWith("MD_Metadata")){ |
||
85 | 18617 | jpiera | if (node.searchNode("identificationInfo->MD_DataIdentification->citation->CI_Citation->title")!=null){ |
86 | return true; |
||
87 | } |
||
88 | 16004 | jpiera | } |
89 | return false; |
||
90 | } |
||
91 | |||
92 | } |