use of net.opengis.cat.csw.v_2_0_2.EchoedRequestType in project ddf by codice.
the class CswQueryResponseTransformer method writeAcknowledgement.
private ByteArrayOutputStream writeAcknowledgement(GetRecordsType request) throws CatalogTransformerException {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
JAXBContext jaxBContext = JAXBContext.newInstance("net.opengis.cat.csw.v_2_0_2:" + "net.opengis.filter.v_1_1_0:net.opengis.gml.v_3_1_1:net.opengis.ows.v_1_0_0");
Marshaller marshaller = jaxBContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
AcknowledgementType ack = new AcknowledgementType();
EchoedRequestType echoedRequest = new EchoedRequestType();
JAXBElement<GetRecordsType> jaxBRequest = new ObjectFactory().createGetRecords(request);
echoedRequest.setAny(jaxBRequest);
ack.setEchoedRequest(echoedRequest);
try {
ack.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
} catch (DatatypeConfigurationException e) {
LOGGER.debug("Failed to set timestamp on Acknowledgement, Exception {}", e);
}
JAXBElement<AcknowledgementType> jaxBAck = new ObjectFactory().createAcknowledgement(ack);
marshaller.marshal(jaxBAck, byteArrayOutputStream);
return byteArrayOutputStream;
} catch (JAXBException e) {
throw new CatalogTransformerException(e);
}
}
use of net.opengis.cat.csw.v_2_0_2.EchoedRequestType in project ddf by codice.
the class CswSubscriptionEndpoint method createAcknowledgment.
private Response createAcknowledgment(GetRecordsType request) {
AcknowledgementType acknowledgementType = new AcknowledgementType();
if (request != null) {
EchoedRequestType echoedRequest = new EchoedRequestType();
echoedRequest.setAny(objectFactory.createGetRecords(request));
acknowledgementType.setEchoedRequest(echoedRequest);
acknowledgementType.setRequestId(request.getRequestId());
}
if (datatypeFactory != null) {
acknowledgementType.setTimeStamp(datatypeFactory.newXMLGregorianCalendar());
}
return Response.ok().entity(acknowledgementType).build();
}
Aggregations