Search in sources :

Example 1 with PT_FreeText

use of org.n52.shetland.iso.gmd.PT_FreeText in project arctic-sea by 52North.

the class EReportingHeaderEncoder method encodeNillableFreeText.

protected void encodeNillableFreeText(QName qn, Nillable<PT_FreeText> nillable) throws XMLStreamException {
    if (!nillable.isAbsent()) {
        if (nillable.isNil()) {
            empty(qn);
            encodeGCONilAttr(nillable);
        } else {
            for (LocalisedCharacterString lcs : nillable.get().getTextGroup()) {
                start(qn);
                start(GcoConstants.QN_GCO_CHARACTER_STRING);
                chars(lcs.getValue());
                endInline(GcoConstants.QN_GCO_CHARACTER_STRING);
                end(qn);
            }
        }
    }
}
Also used : LocalisedCharacterString(org.n52.shetland.iso.gmd.LocalisedCharacterString)

Example 2 with PT_FreeText

use of org.n52.shetland.iso.gmd.PT_FreeText in project arctic-sea by 52North.

the class EReportingHeaderEncoderTest method testValidity.

@Test
public void testValidity() throws XMLStreamException, OwsExceptionReport, SAXException, MalformedURLException, IOException, URISyntaxException, EncodingException {
    EReportingHeader header = new EReportingHeader().setInspireID(new Identifier("id", "namespace").setVersionId(Nillable.missing())).setChange(new EReportingChange("Changed because... you know")).setReportingPeriod(Referenceable.of(Nillable.present(new TimeInstant(DateTime.now())))).setReportingAuthority(new RelatedParty().setIndividualName(Nillable.missing()).setOrganisationName("Organisation").setPositionName("Postionti").addRole(new Reference().setHref(URI.create("http://hallo"))).addRole(Nillable.withheld()).setContact(new Contact().addTelephoneFacsimile("1234").addTelephoneFacsimile(Nillable.missing()).addTelephoneVoice("asdfasdf").setHoursOfService(new PT_FreeText().addTextGroup(new LocalisedCharacterString("asdfasdf"))).setWebsite(Nillable.unknown()).setElectronicMailAddress(Nillable.unknown()).setAddress(new AddressRepresentation().setPostCode("12341234").setAddressFeature(new Reference().setHref(URI.create("http://asdfasdf"))).addLocatorDesignator("localtor").addAddressArea(Nillable.withheld()).addAddressArea(new GeographicalName().setGrammaticalGender(new CodeType("a", new URI("b"))).setGrammaticalNumber(new CodeType("c", new URI("d"))).setLanguage("eng").setNativeness(new CodeType("<asdfasdf")).setNameStatus(Nillable.unknown()).addSpelling(new Spelling().setScript("asdfasdf").setText("asdfasdf").setTransliterationScheme("asdfasdfasdf")).setPronunciation(new Pronunciation().setIPA("asdfasdf").setSoundLink(URI.create("http://asdfasdf")))).addAdminUnit(new GeographicalName().setGrammaticalGender(new CodeType("a", new URI("b"))).setGrammaticalNumber(new CodeType("c", new URI("d"))).setLanguage("eng").setNativeness(new CodeType("<asdfasdf")).setNameStatus(Nillable.unknown()).addSpelling(new Spelling().setScript("asdfasdf").setText("asdfasdf").setTransliterationScheme("asdfasdfasdf")).setPronunciation(new Pronunciation().setIPA("asdfasdf").setSoundLink(URI.create("http://asdfasdf")))).addPostName(Nillable.withheld()).addPostName(new GeographicalName().setGrammaticalGender(new CodeType("a", new URI("b"))).setGrammaticalNumber(new CodeType("c", new URI("d"))).setLanguage("eng").setNativeness(new CodeType("<asdfasdf")).setNameStatus(Nillable.unknown()).addSpelling(new Spelling().setScript("asdfasdf").setText("asdfasdf").setTransliterationScheme("asdfasdfasdf")).setPronunciation(new Pronunciation().setIPA("asdfasdf").setSoundLink(URI.create("http://asdfasdf")))).addThoroughfare(Nillable.withheld()).addThoroughfare(new GeographicalName().setGrammaticalGender(new CodeType("a", new URI("b"))).setGrammaticalNumber(new CodeType("c", new URI("d"))).setLanguage("eng").setNativeness(new CodeType("<asdfasdf")).setNameStatus(Nillable.unknown()).addSpelling(new Spelling().setScript("asdfasdf").setText("asdfasdf").setTransliterationScheme("asdfasdfasdf")).setPronunciation(new Pronunciation().setIPA("asdfasdf").setSoundLink(URI.create("http://asdfasdf")))))));
    validate(header);
}
Also used : LocalisedCharacterString(org.n52.shetland.iso.gmd.LocalisedCharacterString) Spelling(org.n52.shetland.inspire.Spelling) Pronunciation(org.n52.shetland.inspire.Pronunciation) Reference(org.n52.shetland.w3c.xlink.Reference) PT_FreeText(org.n52.shetland.iso.gmd.PT_FreeText) URI(java.net.URI) Contact(org.n52.shetland.inspire.base2.Contact) Identifier(org.n52.shetland.inspire.base.Identifier) EReportingHeader(org.n52.shetland.aqd.EReportingHeader) AddressRepresentation(org.n52.shetland.inspire.ad.AddressRepresentation) GeographicalName(org.n52.shetland.inspire.GeographicalName) RelatedParty(org.n52.shetland.inspire.base2.RelatedParty) CodeType(org.n52.shetland.ogc.gml.CodeType) EReportingChange(org.n52.shetland.aqd.EReportingChange) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Test(org.junit.Test)

Example 3 with PT_FreeText

use of org.n52.shetland.iso.gmd.PT_FreeText in project arctic-sea by 52North.

the class AbstractJSONDecoder method parseFreeText.

protected PT_FreeText parseFreeText(JsonNode n) {
    LocalisedCharacterString localisedCharacterString = new LocalisedCharacterString("");
    if (n.isArray()) {
        ArrayNode arrayNode = (ArrayNode) n;
        Iterator<JsonNode> it = arrayNode.iterator();
        while (it.hasNext()) {
            final JsonNode next = it.next();
            if (next.has(AQDJSONConstants.TEXT)) {
                localisedCharacterString.setValue(next.get(AQDJSONConstants.TEXT).asText());
            } else if (next.has(AQDJSONConstants.LANGUAGE)) {
                localisedCharacterString.setLocale(next.get(AQDJSONConstants.LANGUAGE).asText());
            }
        }
    }
    return new PT_FreeText().addTextGroup(localisedCharacterString);
}
Also used : LocalisedCharacterString(org.n52.shetland.iso.gmd.LocalisedCharacterString) JsonNode(com.fasterxml.jackson.databind.JsonNode) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) PT_FreeText(org.n52.shetland.iso.gmd.PT_FreeText)

Example 4 with PT_FreeText

use of org.n52.shetland.iso.gmd.PT_FreeText in project arctic-sea by 52North.

the class AbstractJSONDecoder method parsePTFreeText.

protected PT_FreeText parsePTFreeText(JsonNode node) {
    PT_FreeText ptFreeText = new PT_FreeText();
    ptFreeText.addTextGroup(new LocalisedCharacterString(node.textValue()));
    return ptFreeText;
}
Also used : LocalisedCharacterString(org.n52.shetland.iso.gmd.LocalisedCharacterString) PT_FreeText(org.n52.shetland.iso.gmd.PT_FreeText)

Example 5 with PT_FreeText

use of org.n52.shetland.iso.gmd.PT_FreeText in project arctic-sea by 52North.

the class EReportingHeaderJSONDecoderTest method checkPtFreeText.

private void checkPtFreeText(PT_FreeText decoded, PT_FreeText original) {
    assertThat(decoded.isSetTextGroup(), is(true));
    assertThat(decoded.getTextGroup().size(), equalTo(original.getTextGroup().size()));
    Iterator<LocalisedCharacterString> decodedIterator = decoded.getTextGroup().iterator();
    Iterator<LocalisedCharacterString> originalIterator = original.getTextGroup().iterator();
    while (decodedIterator.hasNext() && originalIterator.hasNext()) {
        LocalisedCharacterString decodedLCS = decodedIterator.next();
        LocalisedCharacterString originalLCS = originalIterator.next();
        assertThat(decodedLCS.isSetLocale(), equalTo(originalLCS.isSetLocale()));
        if (decodedLCS.isSetLocale() && originalLCS.isSetLocale()) {
            assertThat(decodedLCS.getLocale(), equalTo(originalLCS.getLocale()));
        }
        assertThat(decodedLCS.getValue(), equalTo(originalLCS.getValue()));
    }
}
Also used : LocalisedCharacterString(org.n52.shetland.iso.gmd.LocalisedCharacterString)

Aggregations

LocalisedCharacterString (org.n52.shetland.iso.gmd.LocalisedCharacterString)6 PT_FreeText (org.n52.shetland.iso.gmd.PT_FreeText)4 RelatedParty (org.n52.shetland.inspire.base2.RelatedParty)3 URI (java.net.URI)2 Test (org.junit.Test)2 EReportingChange (org.n52.shetland.aqd.EReportingChange)2 EReportingHeader (org.n52.shetland.aqd.EReportingHeader)2 GeographicalName (org.n52.shetland.inspire.GeographicalName)2 Pronunciation (org.n52.shetland.inspire.Pronunciation)2 Spelling (org.n52.shetland.inspire.Spelling)2 AddressRepresentation (org.n52.shetland.inspire.ad.AddressRepresentation)2 Identifier (org.n52.shetland.inspire.base.Identifier)2 Contact (org.n52.shetland.inspire.base2.Contact)2 CodeType (org.n52.shetland.ogc.gml.CodeType)2 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)2 Reference (org.n52.shetland.w3c.xlink.Reference)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 RelatedPartyType (eu.europa.ec.inspire.schemas.base2.x20.RelatedPartyType)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1