use of org.n52.shetland.ogc.gml.CodeType in project arctic-sea by 52North.
the class SosOffering method from.
/**
* Creates a set of {@literal SosOffering}s from SWE simple type.
*
* @param type
* the type (may be {@literal null})
*
* @return the set (never {@literal null})
*/
public static SosOffering from(SweAbstractSimpleType<?> type) {
if (type == null) {
return null;
}
String identifer = type.getValue().toString();
CodeType name = type.getName();
SosOffering offering = new SosOffering(identifer, name);
if (type.isSetDescription()) {
offering.setDescription(type.getDescription());
}
return offering;
}
use of org.n52.shetland.ogc.gml.CodeType in project arctic-sea by 52North.
the class UVFEncoder method writeMessStellenname.
private void writeMessStellenname(Writer fw, OmObservation o, String lineEnding) throws IOException {
if (o.getObservationConstellation().getFeatureOfInterest().isSetName()) {
final CodeType firstName = o.getObservationConstellation().getFeatureOfInterest().getFirstName();
String name = ensureIdentifierLength(firstName.isSetValue() ? firstName.getValue() : "", UVFConstants.MAX_IDENTIFIER_LENGTH);
writeToFile(fw, String.format("$sb Mess-Stellenname: %s", name), lineEnding);
}
}
use of org.n52.shetland.ogc.gml.CodeType in project arctic-sea by 52North.
the class SensorMLDecoderV101 method parseAbstractProcess.
private void parseAbstractProcess(final AbstractProcessType xbAbstractProcess, final AbstractProcess abstractProcess) throws DecodingException {
if (xbAbstractProcess.getId() != null) {
abstractProcess.setGmlId(xbAbstractProcess.getId());
}
if (xbAbstractProcess.getIdentificationArray() != null) {
parseIdentifications(abstractProcess, xbAbstractProcess.getIdentificationArray());
}
if (xbAbstractProcess.getClassificationArray() != null) {
abstractProcess.setClassifications(parseClassification(xbAbstractProcess.getClassificationArray()));
}
if (xbAbstractProcess.getCharacteristicsArray() != null) {
abstractProcess.setCharacteristics(parseCharacteristics(xbAbstractProcess.getCharacteristicsArray()));
}
if (xbAbstractProcess.getCapabilitiesArray() != null) {
parseCapabilities(abstractProcess, xbAbstractProcess.getCapabilitiesArray());
checkCapabilitiesForRemoval(xbAbstractProcess.getCapabilitiesArray()).forEach(xbAbstractProcess::removeCapabilities);
}
if (xbAbstractProcess.isSetDescription()) {
abstractProcess.addDescription(xbAbstractProcess.getDescription().getStringValue());
}
if (xbAbstractProcess.isSetValidTime()) {
abstractProcess.setValidTime(parseValidTime(xbAbstractProcess.getValidTime()));
}
if (xbAbstractProcess.getContactArray() != null) {
abstractProcess.setContact(parseContact(xbAbstractProcess.getContactArray()));
}
if (xbAbstractProcess.getDocumentationArray() != null) {
abstractProcess.setDocumentation(parseDocumentation(xbAbstractProcess.getDocumentationArray()));
}
if (xbAbstractProcess.getHistoryArray() != null) {
abstractProcess.setHistory(parseHistory(xbAbstractProcess.getHistoryArray()));
}
if (xbAbstractProcess.getKeywordsArray() != null) {
abstractProcess.setKeywords(parseKeywords(xbAbstractProcess.getKeywordsArray()));
}
if (xbAbstractProcess.getNameArray() != null) {
final int length = xbAbstractProcess.getNameArray().length;
for (int i = 0; i < length; i++) {
final Object decodedElement = decodeXmlElement(xbAbstractProcess.getNameArray(i));
if (decodedElement instanceof CodeType) {
abstractProcess.addName((CodeType) decodedElement);
}
}
}
}
use of org.n52.shetland.ogc.gml.CodeType in project arctic-sea by 52North.
the class SamplingEncoderv100 method addValuesToFeature.
private void addValuesToFeature(SamplingFeatureType xbSamplingFeature, AbstractSamplingFeature sampFeat) throws EncodingException {
xbSamplingFeature.setId(sampFeat.getGmlId());
if (sampFeat.isSetIdentifier()) {
sampFeat.getIdentifierCodeWithAuthority().setCodeSpace("uniquID");
xbSamplingFeature.addNewName().set(encodeObjectToXml(GmlConstants.NS_GML, sampFeat.getIdentifierCodeWithAuthority()));
}
if (sampFeat.isSetName()) {
for (CodeType sosName : sampFeat.getName()) {
xbSamplingFeature.addNewName().set(encodeObjectToXml(GmlConstants.NS_GML, sosName));
}
}
// TODO: CHECK
if (sampFeat.getSampledFeatures() != null && !sampFeat.getSampledFeatures().isEmpty()) {
for (AbstractFeature sampledFeature : sampFeat.getSampledFeatures()) {
FeaturePropertyType sp = xbSamplingFeature.addNewSampledFeature();
sp.setHref(sampledFeature.getIdentifier());
if (sampFeat.isSetName() && sampFeat.getFirstName().isSetValue()) {
sp.setTitle(sampFeat.getFirstName().getValue());
}
// xbSamplingFeature.addNewSampledFeature().set(createFeature(sampledFeature));
}
} else {
xbSamplingFeature.addNewSampledFeature().setHref(GmlConstants.NIL_UNKNOWN);
}
// set metadataProperty
setMetaDataProperty(xbSamplingFeature, sampFeat);
}
use of org.n52.shetland.ogc.gml.CodeType in project arctic-sea by 52North.
the class InsertResultTemplateRequestEncoderTest method setup.
@Before
public void setup() throws InvalidSridException, ParseException {
SensorML procedure = new SensorML();
procedure.setIdentifier(procedureIdentifier);
SamplingFeature featureOfInterest = new SamplingFeature(new CodeWithAuthority(featureIdentifier));
featureOfInterest.setIdentifier(featureIdentifier);
featureOfInterest.setName(new CodeType(featureName));
featureOfInterest.setFeatureType(SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_POINT);
featureOfInterest.setGeometry(JTSHelper.createGeometryFromWKT("POINT(30 10)", 4326));
observationTemplate = new OmObservationConstellation();
observationTemplate.addOffering(offering);
observationTemplate.setObservationType(OmConstants.OBS_TYPE_MEASUREMENT);
observationTemplate.setProcedure(procedure);
observationTemplate.setObservableProperty(new OmObservableProperty(observedProperty));
observationTemplate.setFeatureOfInterest(featureOfInterest);
SweTextEncoding textEncoding = new SweTextEncoding();
textEncoding.setBlockSeparator(blockSeparator);
textEncoding.setTokenSeparator(tokenSeparator);
SweDataRecord resultStructure = new SweDataRecord();
SweTime sweTime = new SweTime();
sweTime.setDefinition(field1Definition);
sweTime.setUom(field1Uom);
resultStructure.addField(new SweField(field1Name, sweTime));
request = new InsertResultTemplateRequest(SosConstants.SOS, Sos2Constants.SERVICEVERSION, Sos2Constants.Operations.InsertResultTemplate.name());
request.setResultEncoding(new SosResultEncoding(textEncoding));
request.setResultStructure(new SosResultStructure(resultStructure));
request.setIdentifier(templateIdentifier);
request.setObservationTemplate(observationTemplate);
Supplier<XmlOptions> xmlOptions = () -> new XmlOptions();
encoder = new InsertResultTemplateRequestEncoder();
encoder.setXmlOptions(xmlOptions);
OmEncoderv20 omEncoder = new OmEncoderv20();
omEncoder.setXmlOptions(xmlOptions);
SamplingEncoderv20 samsEncoder = new SamplingEncoderv20();
samsEncoder.setXmlOptions(xmlOptions);
GmlEncoderv321 gml32Encoder = new GmlEncoderv321();
gml32Encoder.setXmlOptions(xmlOptions);
SweCommonEncoderv20 sweEncoderv20 = new SweCommonEncoderv20();
sweEncoderv20.setXmlOptions(xmlOptions);
EncoderRepository encoderRepository = new EncoderRepository();
encoderRepository.setEncoders(Arrays.asList(encoder, omEncoder, samsEncoder, gml32Encoder, sweEncoderv20));
encoderRepository.init();
encoderRepository.getEncoders().stream().forEach(e -> ((AbstractDelegatingEncoder<?, ?>) e).setEncoderRepository(encoderRepository));
}
Aggregations