Example usage for org.apache.commons.collections CollectionUtils addAll

List of usage examples for org.apache.commons.collections CollectionUtils addAll

Introduction

In this page you can find the example usage for org.apache.commons.collections CollectionUtils addAll.

Prototype

public static void addAll(Collection collection, Object[] elements) 

Source Link

Document

Adds all elements in the array to the given collection.

Usage

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public List findAllRepositoriesInfo(Ticket ticket) throws RepositoryException {

    try {//from   w  w w. ja va 2s  .  co  m
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("findAllRepositoriesInfo");
        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_ANY);

        Object[] o = (Object[]) call.invoke(new Object[] { ticket });
        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;
    } catch (Exception e) {
        throw new RepositoryException(e);
    }
}

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public List createDocuments(Ticket ticket, List properties) throws RepositoryException, SecurityException {

    try {//from w w  w.j  a v a2s.  co  m
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("createDocuments");

        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);
        call.addParameter("properties", XMLType.XSD_ANY, ParameterMode.IN);

        call.setReturnType(XMLType.XSD_ANY);

        // TODO: Add N attachments
        Iterator it = properties.iterator();
        while (it.hasNext()) {
            DocumentProperties props = (DocumentProperties) it.next();
            byte[] content = (byte[]) props.getProperty(DocumentProperties.DOCUMENT_CONTENT).getValue();
            if (content != null) {
                props.setProperty(DocumentProperties.DOCUMENT_CONTENT, null);
                DataHandler handler = new DataHandler(
                        new ByteArrayDataSource(content, "application/octet-stream"));
                call.addAttachmentPart(handler);
            }
        }

        Object[] o = (Object[]) call.invoke(new Object[] { ticket, properties });
        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;
    } catch (Exception e) {
        // I don't know if there is a better way to do this
        AxisFault fault = (AxisFault) e;
        if (fault.getFaultString().indexOf("SecurityException") != -1) {
            throw new SecurityException(fault.getFaultString());
        } else {
            throw new RepositoryException(fault.getFaultString());
        }
    }
}

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public List findAllAuthors(Ticket ticket) throws RepositoryException {

    try {// ww  w.ja  va  2s  . com
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("findAllAuthors");
        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);

        call.setReturnType(XMLType.XSD_ANY);

        Object[] o = (Object[]) call.invoke(new Object[] { ticket });
        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;
    } catch (Exception e) {
        throw new RepositoryException(e);
    }
}

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public List findAllCategories(Ticket ticket) throws RepositoryException {

    try {/*from w  w  w  .jav  a 2s .c  om*/
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("findAllCategories");
        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);

        call.setReturnType(XMLType.XSD_ANY);

        Object[] o = (Object[]) call.invoke(new Object[] { ticket });
        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;
    } catch (Exception e) {
        throw new RepositoryException(e);
    }
}

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public List findCategoriesForNode(Ticket ticket, String nodeId) throws RepositoryException, SecurityException {
    try {//from   w  ww  . j  ava2  s  .  c  o m
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("findCategoriesForNode");
        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);
        call.addParameter("nodeId", XMLType.XSD_STRING, ParameterMode.IN);

        call.setReturnType(XMLType.XSD_ANY);

        Object[] o = (Object[]) call.invoke(new Object[] { ticket, nodeId });
        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;

    } catch (Exception e) {
        // I don't know if there is a better way to do this
        AxisFault fault = (AxisFault) e;
        if (fault.getFaultString().indexOf("SecurityException") != -1) {
            throw new SecurityException(fault.getFaultString());

        } else {
            throw new RepositoryException(fault.getFaultString());
        }
    }
}

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public List findNodesForCategory(Ticket ticket, String categoryId)
        throws CategoryNotFoundException, RepositoryException {
    try {/* www  .  j  a  v  a2s .  c  o m*/
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("findNodesForCategory");
        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);
        call.addParameter("categoryId", XMLType.XSD_STRING, ParameterMode.IN);

        call.setReturnType(XMLType.XSD_ANY);

        Object[] o = (Object[]) call.invoke(new Object[] { ticket, categoryId });
        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;

    } catch (Exception e) {
        // I don't know if there is a better way to do this
        AxisFault fault = (AxisFault) e;
        if (fault.getFaultString().indexOf("CategoryNotFoundException") != -1) {
            throw new CategoryNotFoundException();
        }
        throw new RepositoryException(e);
    }
}

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public List findAllLocks(Ticket ticket) throws RepositoryException, SecurityException {

    try {// w  w  w. j  ava  2  s  .  c  o m
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("findAllLocks");

        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);

        call.setReturnType(XMLType.XSD_ANY);

        Object[] o = (Object[]) call.invoke(new Object[] { ticket });

        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;
    } catch (Exception e) {
        // I don't know if there is a better way to do this
        AxisFault fault = (AxisFault) e;
        if (fault.getFaultString().indexOf("SecurityException") != -1) {
            throw new SecurityException(fault.getFaultString());
        } else {
            throw new RepositoryException(fault.getFaultString());
        }
    }
}

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public List findNodesForResource(Ticket ticket, String resourceId) throws RepositoryException {

    try {/*from ww w  .  jav  a2s.  co m*/
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("findNodesForResource");

        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);
        call.addParameter("resourceId", XMLType.XSD_STRING, ParameterMode.IN);

        call.setReturnType(XMLType.XSD_ANY);

        Object[] o = (Object[]) call.invoke(new Object[] { ticket, resourceId });
        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;

    } catch (Exception e) {
        AxisFault fault = (AxisFault) e;
        throw new RepositoryException(fault.getFaultString());
    }
}

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public List getVersions(Ticket ticket, String documentId) throws RepositoryException, SecurityException {

    try {//from ww w .  j  av  a  2 s. c  o  m
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("getVersions");
        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);
        call.addParameter("documentId", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_ANY);

        Object[] o = (Object[]) call.invoke(new Object[] { ticket, documentId });
        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;
    } catch (Exception e) {
        throw new RepositoryException(e);
    }
}

From source file:org.jlibrary.core.axis.client.AxisRepositoryDelegate.java

public Collection findDocumentsByName(Ticket ticket, String name) throws RepositoryException {

    try {/* ww w  .j a  va  2 s . co  m*/
        call.removeAllParameters();

        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName("findDocumentsByName");
        call.addParameter("ticket", XMLType.XSD_ANY, ParameterMode.IN);
        call.addParameter("name", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_ANY);

        Object[] o = (Object[]) call.invoke(new Object[] { ticket, name });
        ArrayList list = new ArrayList();
        CollectionUtils.addAll(list, o);
        return list;
    } catch (Exception e) {
        throw new RepositoryException(e);
    }
}