Search in sources :

Example 1 with Identifier

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

the class SweDataRecordTest method getFieldIndexByIdentifier_should_not_fail_on_bad_input.

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

Example 2 with Identifier

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

the class UVFEncoder method getFilename.

private String getFilename(List<OmObservation> observations) {
    Set<String> identifiers = new HashSet<>();
    for (OmObservation o : observations) {
        if (o.getObservationConstellation().isSetIdentifier()) {
            identifiers.add(o.getObservationConstellation().getIdentifier());
        }
    }
    StringBuffer pathBuffer = new StringBuffer();
    if (!identifiers.isEmpty()) {
        for (String identifier : identifiers) {
            pathBuffer.append(identifier).append("_");
        }
        pathBuffer.replace(pathBuffer.lastIndexOf("_"), pathBuffer.length(), "");
    } else {
        pathBuffer.append("_").append(Long.toString(java.lang.System.nanoTime()));
    }
    pathBuffer.append(".uvf");
    return pathBuffer.toString();
}
Also used : OmObservation(org.n52.shetland.ogc.om.OmObservation) HashSet(java.util.HashSet)

Example 3 with Identifier

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

the class FieldDecoderTest method checkCommon.

protected SweField checkCommon(ObjectNode json, boolean withValue) throws DecodingException {
    SweField field = validateWithValueAndDecode(json, withValue);
    assertThat(field, is(notNullValue()));
    errors.checkThat(field.getName().getValue(), is(NAME));
    assertThat(field.getElement(), is(notNullValue()));
    errors.checkThat(field.getElement().getDefinition(), is(DEFINITION));
    errors.checkThat(field.getElement().getDescription(), is(DESCRIPTION));
    errors.checkThat(field.getElement().getIdentifier(), is(IDENTIFIER));
    errors.checkThat(field.getElement().getLabel(), is(LABEL));
    return field;
}
Also used : SweField(org.n52.shetland.ogc.swe.SweField)

Example 4 with Identifier

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

the class SensorMLDecoderV20 method parseIdentifications.

private void parseIdentifications(DescribedObject describedObject, IdentifierListPropertyType[] identificationArray) {
    for (final IdentifierListPropertyType ilpt : identificationArray) {
        if (ilpt.isSetIdentifierList() && CollectionHelper.isNotNullOrEmpty(ilpt.getIdentifierList().getIdentifier2Array())) {
            for (final Identifier i : ilpt.getIdentifierList().getIdentifier2Array()) {
                if (i.getTerm() != null) {
                    final SmlIdentifier identifier = new SmlIdentifier();
                    parseTerm(i.getTerm(), identifier);
                    describedObject.addIdentifier(identifier);
                    if (isIdentificationProcedureIdentifier(identifier)) {
                        describedObject.setIdentifier(identifier.getValue());
                    }
                }
            }
        }
    }
}
Also used : Identifier(net.opengis.sensorml.x20.IdentifierListType.Identifier) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) IdentifierListPropertyType(net.opengis.sensorml.x20.IdentifierListPropertyType) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier)

Example 5 with Identifier

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

the class SpecimenDecoderv20 method parseSpatialSamplingFeature.

private AbstractFeature parseSpatialSamplingFeature(final SFSpecimenType sfst) throws DecodingException {
    final SfSpecimen specimen = new SfSpecimen(null, sfst.getId());
    // parse identifier, names, description
    parseAbstractFeatureType(sfst, specimen);
    specimen.setSampledFeatures(getSampledFeatures(sfst.getSampledFeatureArray()));
    specimen.setXml(getXmlDescription(sfst));
    if (sfst.getParameterArray() != null) {
        specimen.setParameters(parseNamedValueTypeArray(sfst.getParameterArray()));
    }
    // TODO
    sfst.getMaterialClass();
    specimen.setMaterialClass((ReferenceType) decodeXmlElement(sfst.getMaterialClass()));
    specimen.setSamplingTime(getSamplingTime(sfst));
    // samplingLocation
    if (sfst.isSetSamplingLocation()) {
        specimen.setSamplingLocation(getGeometry(sfst));
    }
    // sfst.getProcessingDetailsArray();
    if (sfst.isSetSize()) {
        specimen.setSize(getSize(sfst.getSize()));
    }
    // }
    if (sfst.isSetSpecimenType()) {
        specimen.setSpecimenType((ReferenceType) decodeXmlElement(sfst.getSpecimenType()));
    }
    return specimen;
}
Also used : SfSpecimen(org.n52.shetland.ogc.om.features.samplingFeatures.SfSpecimen)

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