Search in sources :

Example 1 with QueryEx

use of com.emc.nas.vnxfile.xmlapi.QueryEx in project coprhd-controller by CoprHD.

the class VNXFileInputRequestBuilder method getQueryExParamPacket.

public InputStream getQueryExParamPacket(Object queryParam) throws JAXBException {
    InputStream inputStream = null;
    List<RequestEx> requests = new ArrayList<RequestEx>(1);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    RequestPacket requestPacket = new RequestPacket();
    try {
        QueryEx query = new QueryEx();
        query.getQueryRequestChoiceEx().add(queryParam);
        RequestEx request = new RequestEx();
        request.setQuery(query);
        requests.add(request);
        APIVersion apiVer = APIVersion.V_1_1;
        requestPacket.setApiVersion(apiVer);
        requestPacket.getRequestOrRequestEx().addAll(requests);
        _marshaller.marshal(requestPacket, outputStream);
        inputStream = new ByteArrayInputStream(outputStream.toByteArray());
    } finally {
        try {
            outputStream.close();
        } catch (IOException e) {
            _logger.error("Exception occurred while closing the stream due to ", e);
        }
    }
    return inputStream;
}
Also used : RequestPacket(com.emc.nas.vnxfile.xmlapi.RequestPacket) APIVersion(com.emc.nas.vnxfile.xmlapi.APIVersion) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) RequestEx(com.emc.nas.vnxfile.xmlapi.RequestEx) QueryEx(com.emc.nas.vnxfile.xmlapi.QueryEx)

Aggregations

APIVersion (com.emc.nas.vnxfile.xmlapi.APIVersion)1 QueryEx (com.emc.nas.vnxfile.xmlapi.QueryEx)1 RequestEx (com.emc.nas.vnxfile.xmlapi.RequestEx)1 RequestPacket (com.emc.nas.vnxfile.xmlapi.RequestPacket)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1