use of org.n52.shetland.iso.gmd.GmdCitation in project arctic-sea by 52North.
the class Iso19139GmdEncoderTest method checkMDMetadataEncoding.
// @Test
// public void checkMDMetadataReferenceEncoding() throws EncodingException {
// MDMetadata mdMmetadata = new MDMetadata(new SimpleAttrs().setHref("href").setTitle("title"));
// XmlObject xmlObject = encoder.encode(mdMmetadata);
// xmlObject.validate();
// errors.checkThat(xmlObject, instanceOf(MDMetadataPropertyType.class));
// }
@Test
public void checkMDMetadataEncoding() throws EncodingException {
MDDataIdentification identificationInfo = new MDDataIdentification(new GmdCitation("title", new GmdCitationDate(GmdDateType.publication(), "2018-10-11")), "abstrakt", "ger");
MDMetadata mdMmetadata = new MDMetadata(new CiResponsibleParty(new org.n52.shetland.iso.gco.Role(CodeList.CiRoleCodes.CI_RoleCode_author.name())), DateTime.now(), identificationInfo);
XmlObject xmlObject = encoder.encode(mdMmetadata, EncodingContext.of(XmlBeansEncodingFlags.PROPERTY_TYPE));
xmlObject.validate();
errors.checkThat(xmlObject, instanceOf(MDMetadataPropertyType.class));
}
use of org.n52.shetland.iso.gmd.GmdCitation 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();
}
}
Aggregations