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);
}
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));
}
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)));
}
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;
}
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);
}
Aggregations