Search in sources :

Example 1 with DocumentCitation

use of org.n52.shetland.inspire.base2.DocumentCitation in project arctic-sea by 52North.

the class DocumentCitationTypeDecoder method decode.

@Override
public DocumentCitation decode(XmlObject xmlObject) throws DecodingException {
    if (xmlObject instanceof DocumentCitationType) {
        DocumentCitation documentCitation = new DocumentCitation();
        DocumentCitationType dct = (DocumentCitationType) xmlObject;
        documentCitation.setDescription(dct.getDescription().getStringValue());
        if (dct.isNilDate()) {
            if (dct.getDate().isSetNilReason()) {
                documentCitation.setDate(Nillable.<DateTime>nil(dct.getDate().getNilReason().toString()));
            }
        } else {
            documentCitation.setDate(new DateTime(dct.getDate().getCIDate().getDate().getDate().getTime()));
        }
        if (dct.getLinkArray() != null) {
            for (Link link : dct.getLinkArray()) {
                if (link.isNil() && link.isSetNilReason()) {
                    documentCitation.addLink(Nillable.<String>nil(link.getNilReason().toString()));
                } else {
                    documentCitation.addLink(link.getStringValue());
                }
            }
        }
        return documentCitation;
    }
    throw new UnsupportedDecoderInputException(this, xmlObject);
}
Also used : DocumentCitationType(eu.europa.ec.inspire.schemas.base2.x20.DocumentCitationType) DocumentCitation(org.n52.shetland.inspire.base2.DocumentCitation) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) DateTime(org.joda.time.DateTime) Link(eu.europa.ec.inspire.schemas.base2.x20.DocumentCitationType.Link)

Aggregations

DocumentCitationType (eu.europa.ec.inspire.schemas.base2.x20.DocumentCitationType)1 Link (eu.europa.ec.inspire.schemas.base2.x20.DocumentCitationType.Link)1 DateTime (org.joda.time.DateTime)1 DocumentCitation (org.n52.shetland.inspire.base2.DocumentCitation)1 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)1