Search in sources :

Example 1 with BoxGroupMembership

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

the class BoxGroupsManager method deleteGroupMembership.

/**
     * Delete group membership.
     * 
     * @param groupMembershipId
     *            - the id of group membership to delete.
     */
public void deleteGroupMembership(String groupMembershipId) {
    try {
        LOG.debug("Deleting groupMembership(id=" + groupMembershipId + ")");
        if (groupMembershipId == null) {
            throw new IllegalArgumentException("Parameter 'groupMemebershipId' can not be null");
        }
        BoxGroupMembership groupMembership = new BoxGroupMembership(boxConnection, groupMembershipId);
        groupMembership.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 : BoxGroupMembership(com.box.sdk.BoxGroupMembership) BoxAPIException(com.box.sdk.BoxAPIException)

Example 2 with BoxGroupMembership

use of com.box.sdk.BoxGroupMembership 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 3 with BoxGroupMembership

use of com.box.sdk.BoxGroupMembership 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)3 BoxGroupMembership (com.box.sdk.BoxGroupMembership)3