Search in sources :

Example 1 with CICitationType

use of org.isotc211.x2005.gmd.CICitationType in project arctic-sea by 52North.

the class Iso19139GmdEncoder method encodeCiCitation.

private void encodeCiCitation(CICitationPropertyType cicpt, GmdCitation citation) {
    if (citation.isSetSimpleAttrs()) {
        cicpt.setHref(citation.getSimpleAttrs().getHref());
        if (citation.getSimpleAttrs().isSetTitle()) {
            cicpt.setTitle(citation.getSimpleAttrs().getTitle());
        }
        if (citation.getSimpleAttrs().isSetRole()) {
            cicpt.setRole(citation.getSimpleAttrs().getRole());
        }
    } else {
        CICitationType cict = cicpt.addNewCICitation();
        cict.addNewTitle().setCharacterString(citation.getTitle());
        CIDateType cidt = cict.addNewDate().addNewCIDate();
        CodeListValueType clvt = cidt.addNewDateType().addNewCIDateTypeCode();
        GmdCitationDate gmdCitationDate = citation.getDate();
        GmdDateType gmdDateType = gmdCitationDate.getDateType();
        clvt.setCodeList(gmdDateType.getCodeList());
        clvt.setCodeListValue(gmdDateType.getCodeListValue());
        if (gmdDateType.getCodeSpace() != null && !gmdDateType.getCodeSpace().isEmpty()) {
            clvt.setCodeSpace(gmdDateType.getCodeSpace());
        }
        clvt.setStringValue(gmdDateType.getValue());
        XmlCursor newCursor = cidt.addNewDate().newCursor();
        newCursor.toNextToken();
        newCursor.beginElement(QN_GCO_DATE);
        newCursor.insertChars(gmdCitationDate.getDate());
        newCursor.dispose();
    }
}
Also used : GmdCitationDate(org.n52.shetland.iso.gmd.GmdCitationDate) GmdDateType(org.n52.shetland.iso.gmd.GmdDateType) CICitationType(org.isotc211.x2005.gmd.CICitationType) CIDateType(org.isotc211.x2005.gmd.CIDateType) CodeListValueType(org.isotc211.x2005.gco.CodeListValueType) XmlCursor(org.apache.xmlbeans.XmlCursor)

Aggregations

XmlCursor (org.apache.xmlbeans.XmlCursor)1 CodeListValueType (org.isotc211.x2005.gco.CodeListValueType)1 CICitationType (org.isotc211.x2005.gmd.CICitationType)1 CIDateType (org.isotc211.x2005.gmd.CIDateType)1 GmdCitationDate (org.n52.shetland.iso.gmd.GmdCitationDate)1 GmdDateType (org.n52.shetland.iso.gmd.GmdDateType)1