use of net.opengis.samplingSpecimen.x20.SFSpecimenType in project arctic-sea by 52North.
the class SpecimenDecoderv20 method getXmlDescription.
private String getXmlDescription(final SFSpecimenType sfst) {
final SFSpecimenDocument sfsd = SFSpecimenDocument.Factory.newInstance(getXmlOptions());
sfsd.setSFSpecimen(sfst);
return sfsd.xmlText(getXmlOptions());
}
use of net.opengis.samplingSpecimen.x20.SFSpecimenType in project arctic-sea by 52North.
the class SpecimenEncoderv20 method addSize.
private void addSize(SFSpecimenType sfst, SfSpecimen specimen) {
if (specimen.isSetSize()) {
Size size = sfst.addNewSize();
size.setDoubleValue(specimen.getSize().getValue().doubleValue());
if (specimen.getSize().isSetUnit()) {
size.setUom(specimen.getSize().getUnit());
}
}
}
use of net.opengis.samplingSpecimen.x20.SFSpecimenType in project arctic-sea by 52North.
the class SpecimenEncoderv20 method createSpecimen.
private XmlObject createSpecimen(SfSpecimen specimen) throws EncodingException {
SFSpecimenDocument sfsd = SFSpecimenDocument.Factory.newInstance(getXmlOptions());
if (specimen.isSetXml()) {
try {
final XmlObject feature = XmlObject.Factory.parse(specimen.getXml(), getXmlOptions());
XmlHelper.updateGmlIDs(feature.getDomNode().getFirstChild(), specimen.getGmlId(), null);
if (XmlHelper.getNamespace(feature).equals(SfConstants.NS_SPEC) && feature instanceof SFSpecimenType) {
sfsd.setSFSpecimen((SFSpecimenType) feature);
addName(sfsd.getSFSpecimen(), specimen);
addDescription(sfsd.getSFSpecimen(), specimen);
return sfsd;
}
addName(((SFSpecimenDocument) feature).getSFSpecimen(), specimen);
addDescription(((SFSpecimenDocument) feature).getSFSpecimen(), specimen);
return feature;
} catch (final XmlException xmle) {
throw new EncodingException("Error while encoding GetFeatureOfInterest response, invalid specimen description!", xmle);
}
}
final SFSpecimenType sfst = sfsd.addNewSFSpecimen();
// TODO: CHECK for all fields set gml:id
addId(sfst, specimen);
addIdentifier(sfst, specimen);
// set type
addFeatureType(sfst, specimen);
addName(sfst, specimen);
addDescription(sfst, specimen);
// set sampledFeatures
addSampledFeatures(sfst, specimen);
addParameter(sfst, specimen);
// set specimen specific data
addMaterialClass(sfst, specimen);
addSamplingTime(sfst, specimen);
addSamplingMethod(sfst, specimen);
addSamplingLocation(sfst, specimen);
addProcessingDetails(sfst, specimen);
addSize(sfst, specimen);
addCurrentLocation(sfst, specimen);
addSpecimenType(sfst, specimen);
specimen.wasEncoded();
return sfsd;
}
use of net.opengis.samplingSpecimen.x20.SFSpecimenType in project arctic-sea by 52North.
the class SpecimenEncoderv20 method addCurrentLocation.
private void addCurrentLocation(SFSpecimenType sfst, SfSpecimen specimen) {
if (specimen.isSetCurrentLocation()) {
if (!specimen.getCurrentLocation().getInstance().isPresent()) {
Reference reference = specimen.getCurrentLocation().getReference();
LocationPropertyType lpt = sfst.addNewCurrentLocation();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(lpt::setActuate);
reference.getArcrole().ifPresent(lpt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(lpt::setHref);
reference.getRole().ifPresent(lpt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(lpt::setShow);
reference.getTitle().ifPresent(lpt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(lpt::setType);
}
}
}
use of net.opengis.samplingSpecimen.x20.SFSpecimenType in project arctic-sea by 52North.
the class SpecimenEncoderv20 method addSamplingMethod.
private void addSamplingMethod(SFSpecimenType sfst, SfSpecimen specimen) {
if (specimen.isSetSamplingMethod()) {
if (!specimen.getSamplingMethod().getInstance().isPresent()) {
sfst.addNewSamplingMethod().setHref(specimen.getSamplingMethod().getReference().getHref().get().toString());
Reference reference = specimen.getCurrentLocation().getReference();
SFProcessPropertyType sfppt = sfst.addNewSamplingMethod();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(sfppt::setActuate);
reference.getArcrole().ifPresent(sfppt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(sfppt::setHref);
reference.getRole().ifPresent(sfppt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(sfppt::setShow);
reference.getTitle().ifPresent(sfppt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(sfppt::setType);
}
}
}
Aggregations