Search in sources :

Example 16 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class UVFEncoder method writeLine2.

private void writeLine2(Writer fw, OmObservation o, TimePeriod centuries, String lineEnding) throws IOException {
    // 2.Zeile ABFLUSS m3/s 1900 1900
    StringBuilder sb = new StringBuilder(39);
    // Identifier
    AbstractPhenomenon observableProperty = o.getObservationConstellation().getObservableProperty();
    String observablePropertyIdentifier = observableProperty.getIdentifier();
    if (observablePropertyIdentifier != null && !observablePropertyIdentifier.isEmpty()) {
        observablePropertyIdentifier = ensureIdentifierLength(observablePropertyIdentifier, UVFConstants.MAX_IDENTIFIER_LENGTH);
    }
    sb.append(observablePropertyIdentifier);
    fillWithSpaces(sb, UVFConstants.MAX_IDENTIFIER_LENGTH);
    // Unit (optional)
    String unit = getUnit(o);
    if (unit != null && !unit.isEmpty()) {
        unit = ensureIdentifierLength(unit, UVFConstants.MAX_IDENTIFIER_LENGTH);
        sb.append(" ");
        sb.append(unit);
    }
    fillWithSpaces(sb, 30);
    // Centuries
    sb.append(centuries.getStart().getCenturyOfEra() + "00 " + centuries.getEnd().getCenturyOfEra() + "00");
    writeToFile(fw, sb.toString(), lineEnding);
}
Also used : AbstractPhenomenon(org.n52.shetland.ogc.om.AbstractPhenomenon)

Example 17 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class SweDataRecordTest method getFieldIndexByIdentifier_should_return_one.

@Test
public void getFieldIndexByIdentifier_should_return_one() {
    final SweDataRecord dataRecord = new SweDataRecord();
    dataRecord.addField(new SweField("identifier", new SweBoolean()));
    final SweBoolean b = new SweBoolean();
    final String definition = "test-element-definition";
    b.setDefinition(definition);
    final String name = "test-field-name";
    dataRecord.addField(new SweField(name, b));
    assertThat(dataRecord.getFieldIndexByIdentifier(definition), is(1));
    assertThat(dataRecord.getFieldIndexByIdentifier(name), is(1));
}
Also used : SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) Test(org.junit.Test)

Example 18 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class MeasurementDecodingTest method testIdentifier.

@Test
public void testIdentifier() {
    assertThat(observation, is(notNullValue()));
    final CodeWithAuthority cwa = observation.getIdentifierCodeWithAuthority();
    assertThat(cwa, is(notNullValue()));
    assertThat(cwa.getValue(), is(equalTo(IDENTIFIER)));
    assertThat(cwa.getCodeSpace(), is(equalTo(UNKNOWN_CODESPACE)));
}
Also used : CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) Test(org.junit.Test)

Example 19 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class SwesDecoderv20 method parseRelatedFeature.

private List<SwesFeatureRelationship> parseRelatedFeature(final RelatedFeature[] relatedFeatureArray) throws DecodingException {
    List<SwesFeatureRelationship> sosRelatedFeatures = new ArrayList<>(relatedFeatureArray.length);
    for (final RelatedFeature relatedFeature : relatedFeatureArray) {
        final SwesFeatureRelationship sosFeatureRelationship = new SwesFeatureRelationship();
        final FeaturePropertyType fpt = relatedFeature.getFeatureRelationship().getTarget();
        if (fpt.getHref() != null && !fpt.getHref().isEmpty()) {
            final String identifier = fpt.getHref();
            final AbstractSamplingFeature feature = new SamplingFeature(new CodeWithAuthority(identifier));
            if (fpt.getTitle() != null && !fpt.getTitle().isEmpty()) {
                feature.setName(Lists.newArrayList(new CodeType(fpt.getTitle())));
            }
            if (checkForRequestUrl(fpt.getHref())) {
                feature.setUrl(fpt.getHref());
            }
            feature.setFeatureType(OGCConstants.UNKNOWN);
            sosFeatureRelationship.setFeature(feature);
        } else {
            final Object decodedObject = decodeXmlElement(fpt);
            if (decodedObject instanceof AbstractSamplingFeature) {
                sosFeatureRelationship.setFeature((AbstractSamplingFeature) decodedObject);
            } else {
                throw new DecoderResponseUnsupportedException(fpt.xmlText(), decodedObject);
            }
        }
        sosFeatureRelationship.setRole(relatedFeature.getFeatureRelationship().getRole());
        sosRelatedFeatures.add(sosFeatureRelationship);
    }
    return sosRelatedFeatures;
}
Also used : DecoderResponseUnsupportedException(org.n52.svalbard.decode.exception.DecoderResponseUnsupportedException) AbstractSamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.AbstractSamplingFeature) RelatedFeature(net.opengis.swes.x20.InsertSensorType.RelatedFeature) ArrayList(java.util.ArrayList) CodeType(org.n52.shetland.ogc.gml.CodeType) AbstractSamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.AbstractSamplingFeature) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) OwsServiceCommunicationObject(org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject) XmlObject(org.apache.xmlbeans.XmlObject) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) SwesFeatureRelationship(org.n52.shetland.ogc.swes.SwesFeatureRelationship) FeaturePropertyType(net.opengis.gml.x32.FeaturePropertyType)

Example 20 with Identifier

use of org.n52.shetland.inspire.base.Identifier in project arctic-sea by 52North.

the class AbstractProcessDecoder method parseInspireId.

private void parseInspireId(ProcessType pt, Process process) {
    IdentifierType identifier = pt.getInspireId().getIdentifier();
    String localId = identifier.getLocalId();
    String namespace = identifier.getNamespace();
    CodeWithAuthority codeWithAuthority;
    if (localId.contains(namespace)) {
        codeWithAuthority = new CodeWithAuthority(localId, namespace);
    } else {
        codeWithAuthority = new CodeWithAuthority(getIdentifier(localId, namespace), namespace);
    }
    process.setIdentifier(codeWithAuthority);
}
Also used : CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) IdentifierType(eu.europa.ec.inspire.schemas.base.x33.IdentifierType)

Aggregations

Test (org.junit.Test)8 CodeType (org.n52.shetland.ogc.gml.CodeType)5 XmlObject (org.apache.xmlbeans.XmlObject)4 CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)4 SmlIdentifier (org.n52.shetland.ogc.sensorML.elements.SmlIdentifier)4 Identifier (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier)3 Identifier (org.n52.shetland.inspire.base.Identifier)3 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)3 URI (java.net.URI)2 Identification (net.opengis.sensorML.x101.IdentificationDocument.Identification)2 IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)2 XmlString (org.apache.xmlbeans.XmlString)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 Contact (org.n52.shetland.inspire.base2.Contact)2 RelatedParty (org.n52.shetland.inspire.base2.RelatedParty)2