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