@Override
    public void update(String roleId, UpdateRoleBean bean) throws RoleNotFoundException, NotAuthorizedException {
        securityContext.checkAdminPermissions();

        try {
            RoleBean role = getRoleFromStorage(roleId);
            if (bean.getDescription() != null) {
                role.setDescription(bean.getDescription());
            }
            if (bean.getAutoGrant() != null) {
                role.setAutoGrant(bean.getAutoGrant());
            }
            if (bean.getName() != null) {
                role.setName(bean.getName());
            }
            if (bean.getPermissions() != null) {
                role.getPermissions().clear();
                role.getPermissions().addAll(bean.getPermissions());
            }
            storage.updateRole(role);
        } catch (StorageException e) {
            throw new SystemErrorException(e);
        }
    }
@see IRoleResource#update(java.lang.String, io.apiman.manager.api.beans.idm.UpdateRoleBean)
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/RoleResourceImpl.java