Search in sources :

Example 66 with BoxAPIException

use of com.box.sdk.BoxAPIException in project camel by apache.

the class BoxGroupsManager method getGroupMembershipInfo.

/**
     * Get group membership information.
     * 
     * @param groupMemebershipId
     *            - the id of group membership.
     * @return The group information.
     */
public BoxGroupMembership.Info getGroupMembershipInfo(String groupMemebershipId) {
    try {
        LOG.debug("Getting info for groupMemebership(id=" + groupMemebershipId + ")");
        if (groupMemebershipId == null) {
            throw new IllegalArgumentException("Parameter 'groupMemebershipId' can not be null");
        }
        BoxGroupMembership group = new BoxGroupMembership(boxConnection, groupMemebershipId);
        return group.getInfo();
    } catch (BoxAPIException e) {
        throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
    }
}
Also used : BoxGroupMembership(com.box.sdk.BoxGroupMembership) BoxAPIException(com.box.sdk.BoxAPIException)

Example 67 with BoxAPIException

use of com.box.sdk.BoxAPIException in project camel by apache.

the class BoxGroupsManager method deleteGroup.

/**
     * Delete group.
     * 
     * @param groupId
     *            - the id of group to delete.
     */
public void deleteGroup(String groupId) {
    try {
        LOG.debug("Deleting group(" + groupId + ")");
        if (groupId == null) {
            throw new IllegalArgumentException("Parameter 'groupId' can not be null");
        }
        BoxGroup group = new BoxGroup(boxConnection, groupId);
        group.delete();
    } catch (BoxAPIException e) {
        throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
    }
}
Also used : BoxGroup(com.box.sdk.BoxGroup) BoxAPIException(com.box.sdk.BoxAPIException)

Example 68 with BoxAPIException

use of com.box.sdk.BoxAPIException in project camel by apache.

the class BoxGroupsManager method getGroupMemberships.

/**
     * Get information about all of the group memberships for this group.
     * 
     * @param groupId
     *            - the id of group.
     * @return The group information.
     */
public Collection<BoxGroupMembership.Info> getGroupMemberships(String groupId) {
    try {
        LOG.debug("Getting information about all memberships for group(id=" + groupId + ")");
        if (groupId == null) {
            throw new IllegalArgumentException("Parameter 'groupId' can not be null");
        }
        BoxGroup group = new BoxGroup(boxConnection, groupId);
        return group.getMemberships();
    } catch (BoxAPIException e) {
        throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
    }
}
Also used : BoxGroup(com.box.sdk.BoxGroup) BoxAPIException(com.box.sdk.BoxAPIException)

Example 69 with BoxAPIException

use of com.box.sdk.BoxAPIException in project camel by apache.

the class BoxGroupsManager method getGroupInfo.

/**
     * Get group information.
     * 
     * @param groupId
     *            - the id of group.
     * @return The group information.
     */
public BoxGroup.Info getGroupInfo(String groupId) {
    try {
        LOG.debug("Getting info for group(id=" + groupId + ")");
        if (groupId == null) {
            throw new IllegalArgumentException("Parameter 'groupId' can not be null");
        }
        BoxGroup group = new BoxGroup(boxConnection, groupId);
        return group.getInfo();
    } catch (BoxAPIException e) {
        throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
    }
}
Also used : BoxGroup(com.box.sdk.BoxGroup) BoxAPIException(com.box.sdk.BoxAPIException)

Example 70 with BoxAPIException

use of com.box.sdk.BoxAPIException in project camel by apache.

the class BoxGroupsManager method updateGroupMembershipInfo.

/**
     * Update group membership information.
     * 
     * @param groupMembershipId
     *            - the id of group membership to update.
     * @param info
     *            - the updated information.
     * @return The group information.
     */
public BoxGroupMembership updateGroupMembershipInfo(String groupMemebershipId, BoxGroupMembership.Info info) {
    try {
        LOG.debug("Updating info for groupMembership(id=" + groupMemebershipId + ")");
        if (groupMemebershipId == null) {
            throw new IllegalArgumentException("Parameter 'groupMemebershipId' can not be null");
        }
        if (info == null) {
            throw new IllegalArgumentException("Parameter 'info' can not be null");
        }
        BoxGroupMembership groupMembership = new BoxGroupMembership(boxConnection, groupMemebershipId);
        groupMembership.updateInfo(info);
        return groupMembership;
    } catch (BoxAPIException e) {
        throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
    }
}
Also used : BoxGroupMembership(com.box.sdk.BoxGroupMembership) BoxAPIException(com.box.sdk.BoxAPIException)

Aggregations

BoxAPIException (com.box.sdk.BoxAPIException)74 BoxFile (com.box.sdk.BoxFile)24 BoxFolder (com.box.sdk.BoxFolder)17 BoxUser (com.box.sdk.BoxUser)8 BoxTask (com.box.sdk.BoxTask)6 BoxCollaboration (com.box.sdk.BoxCollaboration)4 BoxComment (com.box.sdk.BoxComment)4 BoxGroup (com.box.sdk.BoxGroup)4 BoxFileVersion (com.box.sdk.BoxFileVersion)3 BoxGroupMembership (com.box.sdk.BoxGroupMembership)3 FailingHttpStatusCodeException (com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException)3 IOException (java.io.IOException)3 GeneralSecurityException (java.security.GeneralSecurityException)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Test (org.junit.Test)3 BoxItem (com.box.sdk.BoxItem)2 BoxTaskAssignment (com.box.sdk.BoxTaskAssignment)2 IAccessTokenCache (com.box.sdk.IAccessTokenCache)2