Search in sources :

Example 1 with CswRecordConverter

use of org.codice.ddf.spatial.ogc.csw.catalog.converter.CswRecordConverter in project ddf by codice.

the class TransactionMessageBodyReader method readFrom.

@Override
public CswTransactionRequest readFrom(Class<CswTransactionRequest> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> multivaluedMap, InputStream inputStream) throws IOException, WebApplicationException {
    XStream xStream = new XStream(new Xpp3Driver());
    TransactionRequestConverter transactionRequestConverter = new TransactionRequestConverter(cswRecordConverter, registry);
    transactionRequestConverter.setCswRecordConverter(new CswRecordConverter(metacardType));
    xStream.registerConverter(transactionRequestConverter);
    xStream.alias("csw:" + CswConstants.TRANSACTION, CswTransactionRequest.class);
    xStream.alias(CswConstants.TRANSACTION, CswTransactionRequest.class);
    return (CswTransactionRequest) xStream.fromXML(inputStream);
}
Also used : Xpp3Driver(com.thoughtworks.xstream.io.xml.Xpp3Driver) TransactionRequestConverter(org.codice.ddf.spatial.ogc.csw.catalog.converter.TransactionRequestConverter) XStream(com.thoughtworks.xstream.XStream) CswTransactionRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.CswTransactionRequest) CswRecordConverter(org.codice.ddf.spatial.ogc.csw.catalog.converter.CswRecordConverter)

Example 2 with CswRecordConverter

use of org.codice.ddf.spatial.ogc.csw.catalog.converter.CswRecordConverter in project ddf by codice.

the class TestTransactionMessageBodyReader method setup.

@Before
public void setup() {
    cswRecordConverter = new CswRecordConverter(CswQueryFactoryTest.getCswMetacardType());
    new CoreAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
    new ContactAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
    new LocationAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
    new MediaAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
    new TopicAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
    new AssociationsAttributes().getAttributeDescriptors().stream().forEach(d -> registry.register(d));
}
Also used : ContactAttributes(ddf.catalog.data.impl.types.ContactAttributes) LocationAttributes(ddf.catalog.data.impl.types.LocationAttributes) CoreAttributes(ddf.catalog.data.impl.types.CoreAttributes) AssociationsAttributes(ddf.catalog.data.impl.types.AssociationsAttributes) MediaAttributes(ddf.catalog.data.impl.types.MediaAttributes) CswRecordConverter(org.codice.ddf.spatial.ogc.csw.catalog.converter.CswRecordConverter) TopicAttributes(ddf.catalog.data.impl.types.TopicAttributes) Before(org.junit.Before)

Aggregations

CswRecordConverter (org.codice.ddf.spatial.ogc.csw.catalog.converter.CswRecordConverter)2 XStream (com.thoughtworks.xstream.XStream)1 Xpp3Driver (com.thoughtworks.xstream.io.xml.Xpp3Driver)1 AssociationsAttributes (ddf.catalog.data.impl.types.AssociationsAttributes)1 ContactAttributes (ddf.catalog.data.impl.types.ContactAttributes)1 CoreAttributes (ddf.catalog.data.impl.types.CoreAttributes)1 LocationAttributes (ddf.catalog.data.impl.types.LocationAttributes)1 MediaAttributes (ddf.catalog.data.impl.types.MediaAttributes)1 TopicAttributes (ddf.catalog.data.impl.types.TopicAttributes)1 CswTransactionRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.CswTransactionRequest)1 TransactionRequestConverter (org.codice.ddf.spatial.ogc.csw.catalog.converter.TransactionRequestConverter)1 Before (org.junit.Before)1