Search in sources :

Example 1 with UserRoleVO

use of com.centurylink.mdw.model.value.user.UserRoleVO in project mdw-designer by CenturyLinkCloud.

the class UserDataAccessRest method getRoleNames.

public List<String> getRoleNames() throws DataAccessException {
    try {
        String pathWithArgs = "Roles?format=json";
        String response = invokeResourceService(pathWithArgs);
        RoleList roleList = new RoleList(response);
        List<String> roleNames = new ArrayList<String>();
        for (UserRoleVO role : roleList.getItems()) {
            roleNames.add(role.getName());
        }
        return roleNames;
    } catch (IOException ex) {
        throw new DataAccessOfflineException(ex.getMessage(), ex);
    } catch (Exception ex) {
        throw new DataAccessException(ex.getMessage(), ex);
    }
}
Also used : DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) UserRoleVO(com.centurylink.mdw.model.value.user.UserRoleVO) RoleList(com.centurylink.mdw.model.value.user.RoleList) ArrayList(java.util.ArrayList) IOException(java.io.IOException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Aggregations

DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1 RoleList (com.centurylink.mdw.model.value.user.RoleList)1 UserRoleVO (com.centurylink.mdw.model.value.user.UserRoleVO)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1