use of net.opengis.samplingSpecimen.x20.SFSpecimenDocument 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.SFSpecimenDocument 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;
}
Aggregations