use of org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.DataAvailability in project arctic-sea by 52North.
the class GetDataAvailabilityV20StreamWriter method writeGetDataAvailabilityResponse.
@Override
protected void writeGetDataAvailabilityResponse() throws XMLStreamException, EncodingException {
start(GetDataAvailabilityConstants.GDA_GET_DATA_AVAILABILITY_20_RESPONSE);
namespace(GetDataAvailabilityConstants.NS_GDA_PREFIX, GetDataAvailabilityConstants.NS_GDA_20);
namespace(GmlConstants.NS_GML_PREFIX, GmlConstants.NS_GML_32);
namespace(SweConstants.NS_SWE_PREFIX, SweConstants.NS_SWE_20);
namespace(W3CConstants.NS_XLINK_PREFIX, W3CConstants.NS_XLINK);
schemaLocation(Sets.newHashSet(GetDataAvailabilityConstants.GET_DATA_AVAILABILITY_20_SCHEMA_LOCATION));
for (DataAvailability da : getElement()) {
wirteDataAvailabilityMember(da);
}
end(GetDataAvailabilityConstants.GDA_GET_DATA_AVAILABILITY_20_RESPONSE);
}
use of org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.DataAvailability in project arctic-sea by 52North.
the class GetDataAvailabilityJsonEncoder method encodeResponse.
@Override
protected void encodeResponse(ObjectNode json, GetDataAvailabilityResponse t) throws EncodingException {
ArrayNode a = json.putArray(GetDataAvailabilityConstants.DATA_AVAILABILITY);
for (DataAvailability da : t.getDataAvailabilities()) {
ObjectNode objectNode = a.addObject();
objectNode.put(JSONConstants.FEATURE_OF_INTEREST, da.getFeatureOfInterest().getHref()).put(JSONConstants.PROCEDURE, da.getProcedure().getHref()).put(JSONConstants.OBSERVED_PROPERTY, da.getObservedProperty().getHref()).set(JSONConstants.PHENOMENON_TIME, encodeObjectToJson(da.getPhenomenonTime()));
if (t.isSetResponseFormat() && GetDataAvailabilityConstants.NS_GDA_20.equals(t.getResponseFormat())) {
if (da.isSetOffering()) {
objectNode.put(JSONConstants.OFFERING, da.getOffering().getHref());
}
if (da.isSetFormatDescriptors()) {
ObjectNode fdNode = objectNode.putObject(GetDataAvailabilityConstants.FORMAT_DESCRIPTOR);
encodeProcedureFormatDescriptor(da.getFormatDescriptor().getProcedureDescriptionFormatDescriptor(), fdNode);
encodeObservationFormatDescriptor(da.getFormatDescriptor().getObservationFormatDescriptors(), fdNode);
}
}
if (da.isSetCount()) {
objectNode.put(JSONConstants.COUNT, da.getCount());
}
}
}
use of org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.DataAvailability in project arctic-sea by 52North.
the class GetDataAvailabilityStreamWriter method writeGetDataAvailabilityResponse.
@Override
protected void writeGetDataAvailabilityResponse() throws XMLStreamException, EncodingException {
start(GetDataAvailabilityConstants.GDA_GET_DATA_AVAILABILITY_RESPONSE);
namespace(GetDataAvailabilityConstants.NS_GDA_PREFIX, GetDataAvailabilityConstants.NS_GDA);
namespace(GmlConstants.NS_GML_PREFIX, GmlConstants.NS_GML_32);
namespace(SweConstants.NS_SWE_PREFIX, SweConstants.NS_SWE_20);
namespace(W3CConstants.NS_XLINK_PREFIX, W3CConstants.NS_XLINK);
schemaLocation(Sets.newHashSet(GetDataAvailabilityConstants.GET_DATA_AVAILABILITY_SCHEMA_LOCATION));
for (DataAvailability da : getElement()) {
wirteDataAvailabilityMember(da);
}
end(GetDataAvailabilityConstants.GDA_GET_DATA_AVAILABILITY_RESPONSE);
}
use of org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.DataAvailability in project arctic-sea by 52North.
the class GetDataAvailabilityResponseDecoder method parseDataAvalabilities.
private Collection<DataAvailability> parseDataAvalabilities(net.opengis.sosgda.x20.GetDataAvailabilityResponseType response) throws DecodingException {
List<DataAvailability> availabilities = Lists.newArrayList();
if (CollectionHelper.isNotNullOrEmpty(response.getDataAvailabilityMemberArray())) {
Map<String, TimePeriod> periods = Maps.newHashMap();
for (net.opengis.sosgda.x20.DataAvailabilityMemberType damt : response.getDataAvailabilityMemberArray()) {
ReferenceType procedure = decodeXmlElement(damt.getProcedure());
ReferenceType offering = decodeXmlElement(damt.getOffering());
ReferenceType featureOfInterest = decodeXmlElement(damt.getFeatureOfInterest());
ReferenceType observedProperty = decodeXmlElement(damt.getObservedProperty());
TimePeriod phenomenonTime = getPhenomenonTime(damt.getPhenomenonTime().getAbstractTimeObject(), damt.getPhenomenonTime().getHref(), periods);
DataAvailability dataAvailability = new DataAvailability(procedure, observedProperty, featureOfInterest, offering, phenomenonTime);
FormatDescriptor formatDescriptor = createFormatDescriptor(damt.getFormatDescriptor());
if (formatDescriptor != null) {
dataAvailability.setFormatDescriptor(formatDescriptor);
}
availabilities.add(dataAvailability);
}
}
return availabilities;
}
use of org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.DataAvailability in project arctic-sea by 52North.
the class GetDataAvailabilityResponseDecoder method parseDataAvalabilities.
private Collection<DataAvailability> parseDataAvalabilities(GetDataAvailabilityResponseType response) throws DecodingException {
List<DataAvailability> availabilities = Lists.newArrayList();
if (CollectionHelper.isNotNullOrEmpty(response.getDataAvailabilityMemberArray())) {
Map<String, TimePeriod> periods = Maps.newHashMap();
for (DataAvailabilityMemberType damt : response.getDataAvailabilityMemberArray()) {
ReferenceType procedure = decodeXmlElement(damt.getProcedure());
ReferenceType featureOfInterest = decodeXmlElement(damt.getFeatureOfInterest());
ReferenceType observedProperty = decodeXmlElement(damt.getObservedProperty());
TimePeriod phenomenonTime = getPhenomenonTime(damt.getPhenomenonTime().getAbstractTimeObject(), damt.getPhenomenonTime().getHref(), periods);
availabilities.add(new DataAvailability(procedure, observedProperty, featureOfInterest, null, phenomenonTime));
}
}
return availabilities;
}
Aggregations