Пример #1
0
  /**
   * Transforms a list of KeywordBean object into its iso19139 representation.
   *
   * <pre>
   *  <gmd:MD_Keywords>
   *  	<gmd:keyword>
   *  		<gco:CharacterString>Keyword 1</gco:CharacterString>
   *  	</gmd:keyword>
   * 		<gmd:keyword>
   *  		<gco:CharacterString>Keyword 2</gco:CharacterString>
   *  	</gmd:keyword>
   *  	<gmd:type>
   *  		<gmd:MD_KeywordTypeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_KeywordTypeCode" codeListValue="TYPE"/>
   *  	</gmd:type>
   *  	<gmd:thesaurusName>
   *  		<gmd:CI_Citation id="geonetwork.thesaurus.register.theme.bc44a748-f1a1-4775-9395-a4a6d8bb8df6">
   *  			<gmd:title>
   *  				<gco:CharacterString>THESAURUS NAME</gco:CharacterString>
   *  			</gmd:title>
   *  			<gmd:date gco:nilReason="unknown"/>
   * 			<gmd:otherCitationDetails>
   * 				<gmx:FileName src="http://localhost:8080/geonetwork/srv/eng/metadata.show?uuid=bc44a748-f1a1-4775-9395-a4a6d8bb8df6">register.theme.bc44a748-f1a1-4775-9395-a4a6d8bb8df6</gmx:FileName>
   * 			</gmd:otherCitationDetails>
   *  		</gmd:CI_Citation>
   *  	</gmd:thesaurusName>
   *  </gmd:MD_Keywords>
   *  </pre>
   *
   * @param kbList
   * @return a complex iso19139 representation of the keyword
   */
  public static Element getComplexIso19139Elt(List<KeywordBean> kbList) {
    Element root = new Element("MD_Keywords", NS_GMD);

    Element cs = new Element("CharacterString", NS_GCO);

    List<Element> keywords = new ArrayList<Element>();

    String thName = "";
    Element type = null;
    Element thesaurusName = null;

    for (KeywordBean kb : kbList) {
      Element keyword = new Element("keyword", NS_GMD);

      cs.setText(kb.getValue());
      keyword.addContent((Content) cs.clone());
      keywords.add((Element) keyword.detach());
      thName = kb.getThesaurus();
      if (type == null) type = KeywordBean.createKeywordTypeElt(kb);
      if (thesaurusName == null) thesaurusName = KeywordBean.createThesaurusNameElt(kb);
    }

    // Add elements to the root MD_Keywords element.
    root.addContent(keywords);
    root.addContent(type);
    root.addContent(thesaurusName);

    return root;
  }
Пример #2
0
  /**
   * Transforms a KeywordBean object into its iso19139 representation.
   *
   * <pre>
   * 		<gmd:keyword xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="">
   *   		<gco:CharacterString>A KEYWORD GENERATED BY XLINK SERVICE</gco:CharacterString>
   * 	</gmd:keyword>
   *  	<gmd:type>
   *  		<gmd:MD_KeywordTypeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_KeywordTypeCode" codeListValue="TYPE"/>
   *  	</gmd:type>
   *  	<gmd:thesaurusName>
   *  		<gmd:CI_Citation "id="geonetwork.thesaurus.register.theme.bc44a748-f1a1-4775-9395-a4a6d8bb8df6">
   *  			<gmd:title>
   *  				<gco:CharacterString>THESAURUS NAME</gco:CharacterString>
   *  			</gmd:title>
   *  			<gmd:date gco:nilReason="unknown"/>
   * 			<gmd:otherCitationDetails>
   * 				<gmx:FileName src="http://localhost:8080/geonetwork/srv/eng/metadata.show?uuid=bc44a748-f1a1-4775-9395-a4a6d8bb8df6">register.theme.bc44a748-f1a1-4775-9395-a4a6d8bb8df6</gmx:FileName>
   * 			</gmd:otherCitationDetails>
   *  		</gmd:CI_Citation>
   *  	</gmd:thesaurusName>
   * </pre>
   *
   * @return an iso19139 representation of the keyword
   */
  public Element getIso19139() {
    Element ele = new Element("MD_Keywords", NS_GMD);
    Element el = new Element("keyword", NS_GMD);
    Element cs = new Element("CharacterString", NS_GCO);
    cs.setText(this.value);

    Element type = KeywordBean.createKeywordTypeElt(this);

    Element thesaurusName = KeywordBean.createThesaurusNameElt(this);

    el.addContent(cs);

    ele.addContent(el);
    ele.addContent(type);
    ele.addContent(thesaurusName);

    return ele;
  }