ref 8432:TDM - DatabasesManager - Support Java 8 compatibility

https://support.d4science.org/issues/8432

Updated to support Java 8 compatibility

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@148378 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-05-09 09:40:05 +00:00
parent e1e322c6c6
commit 96a00cbb66
5 changed files with 36 additions and 39 deletions

View File

@ -6,14 +6,22 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry excluding="**" kind="src" output="target/databases-manager-portlet-1.8.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>

View File

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="${module}">
<wb-module deploy-name="databases-manager-portlet-1.8.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="data-miner-manager-cl-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/data-miner-manager-cl/data-miner-manager-cl">
<dependency-type>uses</dependency-type>
</dependent-module>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="databases-manager-portlet"/>
</wb-module>

View File

@ -27,7 +27,7 @@ public class UIDGenerator {
* @param len
* the desired number of characters
* @param radix
* the number of allowable values for each character (must be <=
* the number of allowable values for each character (must be &lt;=
* 62)
* @return random uuid
*/

View File

@ -2,10 +2,9 @@ package org.gcube.portlets.user.databasesmanager.server.util;
import java.io.Serializable;
/**
/*
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*/
public class ServiceCredentials implements Serializable {
@ -33,9 +32,8 @@ public class ServiceCredentials implements Serializable {
this.token = token;
}
public ServiceCredentials(String userName, String fullName, String name,
String lastName, String email, String scope, String groupId,
String groupName, String userAvatarURL, String token) {
public ServiceCredentials(String userName, String fullName, String name, String lastName, String email,
String scope, String groupId, String groupName, String userAvatarURL, String token) {
super();
this.userName = userName;
this.fullName = fullName;
@ -131,11 +129,9 @@ public class ServiceCredentials implements Serializable {
@Override
public String toString() {
return "ServiceCredentials [userName=" + userName + ", fullName="
+ fullName + ", name=" + name + ", lastName=" + lastName
+ ", email=" + email + ", scope=" + scope + ", groupId="
+ groupId + ", groupName=" + groupName + ", userAvatarURL="
+ userAvatarURL + ", token=" + token + "]";
return "ServiceCredentials [userName=" + userName + ", fullName=" + fullName + ", name=" + name + ", lastName="
+ lastName + ", email=" + email + ", scope=" + scope + ", groupId=" + groupId + ", groupName="
+ groupName + ", userAvatarURL=" + userAvatarURL + ", token=" + token + "]";
}
}

View File

@ -12,7 +12,6 @@ import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
public class SessionUtil {
private static final Logger logger = Logger.getLogger(SessionUtil.class);
@ -20,23 +19,25 @@ public class SessionUtil {
/**
*
* @param httpServletRequest
* @return
* @throws TDGWTServiceException
* http servlet request
* @return ServiceCredentials
* @throws ServiceException ServiceException
*/
public static ServiceCredentials getServiceCredentials(
HttpServletRequest httpServletRequest) throws org.gcube.portlets.user.databasesmanager.shared.exception.ServiceException {
public static ServiceCredentials getServiceCredentials(HttpServletRequest httpServletRequest)
throws ServiceException {
return getServiceCredentials(httpServletRequest, null);
}
/**
*
* @param httpServletRequest
* http servlet request
* @param scopeGroupId
* @return
* @throws TDGWTServiceException
* scope
* @return ServiceCredentials
* @throws ServiceException ServiceException
*/
public static ServiceCredentials getServiceCredentials(
HttpServletRequest httpServletRequest, String scopeGroupId)
public static ServiceCredentials getServiceCredentials(HttpServletRequest httpServletRequest, String scopeGroupId)
throws ServiceException {
ServiceCredentials sCredentials = null;
@ -94,8 +95,7 @@ public class SessionUtil {
GCubeUser gCubeUser = pContext.getCurrentUser(httpServletRequest);
if (gCubeUser == null) {
String error = "Error retrieving gCubeUser in scope " + scope
+ ": " + gCubeUser;
String error = "Error retrieving gCubeUser in scope " + scope + ": " + gCubeUser;
logger.error(error);
throw new ServiceException(error);
}
@ -103,8 +103,7 @@ public class SessionUtil {
userName = gCubeUser.getUsername();
if (userName == null || userName.isEmpty()) {
String error = "Error retrieving username in scope " + scope
+ ": " + userName;
String error = "Error retrieving username in scope " + scope + ": " + userName;
logger.error(error);
throw new ServiceException(error);
}
@ -112,8 +111,7 @@ public class SessionUtil {
token = pContext.getCurrentUserToken(scope, userName);
if (token == null || token.isEmpty()) {
String error = "Error retrieving token for " + userName
+ " in " + scope + ": " + token;
String error = "Error retrieving token for " + userName + " in " + scope + ": " + token;
logger.error(error);
throw new ServiceException(error);
}
@ -157,22 +155,19 @@ public class SessionUtil {
} else {
groupId = String.valueOf(pContext
.getCurrentGroupId(httpServletRequest));
groupId = String.valueOf(pContext.getCurrentGroupId(httpServletRequest));
groupName = pContext.getCurrentGroupName(httpServletRequest);
}
sCredentials = new ServiceCredentials(userName, fullName, name,
lastName, email, scope, groupId, groupName, userAvatarURL,
token);
sCredentials = new ServiceCredentials(userName, fullName, name, lastName, email, scope, groupId, groupName,
userAvatarURL, token);
}
logger.debug("ServiceCredentials: " + sCredentials);
return sCredentials;
}
}