Updated try catch

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@131344 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-09-14 10:54:24 +00:00
parent a7b07bfb3c
commit bc2c710a4e
1 changed files with 29 additions and 32 deletions

View File

@ -27,11 +27,12 @@ import org.gcube.vomanagement.usermanagement.model.GatewayRolesNames;
import eu.trentorise.opendata.jackan.model.CkanOrganization;
/**
* The Class UserUtil.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Nov 17, 2015
* Sep 14, 2016
*/
public class UserUtil {
@ -46,9 +47,6 @@ public class UserUtil {
* @return the user full name if is available, the input parameter portalLogin otherwise
*/
public static String getUserFullName(String portalLogin){
// return user.getPortalLogin(); //for testing in eclipse
// logger.trace("Finding full name for: "+portalLogin);
if(portalLogin==null)
return "";
@ -58,26 +56,22 @@ public class UserUtil {
GCubeUser curr = null;
try {
try {
curr = um.getUserByScreenName(portalLogin);
} catch (UserManagementSystemException e) {
curr = um.getUserByScreenName(portalLogin);
logger.error("UserManagementSystemException, during getting fullname for: "+portalLogin);
} catch (UserRetrievalFault e) {
logger.error("UserRetrievalFault, during getting fullname for: "+portalLogin);
}
} catch (UserManagementSystemException e) {
logger.error("UserManagementSystemException, during getting fullname for: "+portalLogin);
} catch (UserRetrievalFault e) {
logger.error("UserRetrievalFault, during getting fullname for: "+portalLogin);
}catch (Exception e) {
logger.error("An error occurred in getUserFullName "+e,e);
logger.warn("Return portal login "+portalLogin);
return portalLogin;
}
if (curr != null){
// logger.trace("Return "+curr.getFullname() +" full name for: "+portalLogin);
if (curr != null)
return curr.getFullname();
}
}else{
logger.trace("DEVELOPEMENT MODE ON");
logger.trace("Returning input login: "+portalLogin);
@ -169,13 +163,14 @@ public class UserUtil {
}
/**
* Retrieve the highest ckan role the user has and also retrieve the list of organizations (scopes) in which the user has the ckan-admin role
* Retrieve the highest ckan role the user has and also retrieve the list of organizations (scopes) in which the user has the ckan-admin role.
*
* @param currentScope the current scope
* @param username the current username
* @param groupName the current groupName
* @param gcubeCkanDataCatalogServiceImpl
* @param orgsInWhichAdminRole
* @param ckanUtils ckanUtils
* @param workspaceInstance the workspace instance
* @param orgsInWhichAdminRole the orgs in which admin role
* @return true, if successful
*/
public static boolean hasAdminRole(String currentScope, String username, String groupName, GWTWorkspaceServiceImpl workspaceInstance, List<OrganizationBean> orgsInWhichAdminRole){
@ -278,16 +273,17 @@ public class UserUtil {
}
/**
* Check if the role admin is set or must be set into the ckan instance at this scope
* @param username
* @param gCubeGroupName
* @param correspondentRoleToCheck
* @param workspaceInstance
* @param groupManager
* @param groupId
* @param orgsInWhichAdminRole
* @throws UserManagementSystemException
* @throws GroupRetrievalFault
* Check if the role admin is set or must be set into the ckan instance at this scope.
*
* @param username the username
* @param gCubeGroupName the g cube group name
* @param correspondentRoleToCheck the correspondent role to check
* @param workspaceInstance the workspace instance
* @param groupManager the group manager
* @param groupId the group id
* @param orgsInWhichAdminRole the orgs in which admin role
* @throws UserManagementSystemException the user management system exception
* @throws GroupRetrievalFault the group retrieval fault
*/
private static void checkIfRoleIsSetInCkanInstance(String username,
String gCubeGroupName,
@ -318,9 +314,10 @@ public class UserUtil {
}
/**
* Retrieve the ckan roles among a list of liferay roles
* @param roles
* @return
* Retrieve the ckan roles among a list of liferay roles.
*
* @param roles the roles
* @return the liferay highest role in org
*/
private static RolesIntoOrganization getLiferayHighestRoleInOrg(
List<GCubeRole> roles) {