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:
parent
e1e322c6c6
commit
96a00cbb66
12
.classpath
12
.classpath
|
@ -6,14 +6,22 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?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="/target/m2e-wtp/web-resources"/>
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<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/java"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<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">
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||||
<property name="context-root" value="databases-manager-portlet"/>
|
<property name="context-root" value="databases-manager-portlet"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class UIDGenerator {
|
||||||
* @param len
|
* @param len
|
||||||
* the desired number of characters
|
* the desired number of characters
|
||||||
* @param radix
|
* @param radix
|
||||||
* the number of allowable values for each character (must be <=
|
* the number of allowable values for each character (must be <=
|
||||||
* 62)
|
* 62)
|
||||||
* @return random uuid
|
* @return random uuid
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,10 +2,9 @@ package org.gcube.portlets.user.databasesmanager.server.util;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi email: <a
|
* @author Giancarlo Panichi
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ServiceCredentials implements Serializable {
|
public class ServiceCredentials implements Serializable {
|
||||||
|
@ -33,9 +32,8 @@ public class ServiceCredentials implements Serializable {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceCredentials(String userName, String fullName, String name,
|
public ServiceCredentials(String userName, String fullName, String name, String lastName, String email,
|
||||||
String lastName, String email, String scope, String groupId,
|
String scope, String groupId, String groupName, String userAvatarURL, String token) {
|
||||||
String groupName, String userAvatarURL, String token) {
|
|
||||||
super();
|
super();
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
|
@ -131,11 +129,9 @@ public class ServiceCredentials implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ServiceCredentials [userName=" + userName + ", fullName="
|
return "ServiceCredentials [userName=" + userName + ", fullName=" + fullName + ", name=" + name + ", lastName="
|
||||||
+ fullName + ", name=" + name + ", lastName=" + lastName
|
+ lastName + ", email=" + email + ", scope=" + scope + ", groupId=" + groupId + ", groupName="
|
||||||
+ ", email=" + email + ", scope=" + scope + ", groupId="
|
+ groupName + ", userAvatarURL=" + userAvatarURL + ", token=" + token + "]";
|
||||||
+ groupId + ", groupName=" + groupName + ", userAvatarURL="
|
|
||||||
+ userAvatarURL + ", token=" + token + "]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
|
|
||||||
|
|
||||||
public class SessionUtil {
|
public class SessionUtil {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(SessionUtil.class);
|
private static final Logger logger = Logger.getLogger(SessionUtil.class);
|
||||||
|
@ -20,23 +19,25 @@ public class SessionUtil {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param httpServletRequest
|
* @param httpServletRequest
|
||||||
* @return
|
* http servlet request
|
||||||
* @throws TDGWTServiceException
|
* @return ServiceCredentials
|
||||||
|
* @throws ServiceException ServiceException
|
||||||
*/
|
*/
|
||||||
public static ServiceCredentials getServiceCredentials(
|
public static ServiceCredentials getServiceCredentials(HttpServletRequest httpServletRequest)
|
||||||
HttpServletRequest httpServletRequest) throws org.gcube.portlets.user.databasesmanager.shared.exception.ServiceException {
|
throws ServiceException {
|
||||||
return getServiceCredentials(httpServletRequest, null);
|
return getServiceCredentials(httpServletRequest, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param httpServletRequest
|
* @param httpServletRequest
|
||||||
|
* http servlet request
|
||||||
* @param scopeGroupId
|
* @param scopeGroupId
|
||||||
* @return
|
* scope
|
||||||
* @throws TDGWTServiceException
|
* @return ServiceCredentials
|
||||||
|
* @throws ServiceException ServiceException
|
||||||
*/
|
*/
|
||||||
public static ServiceCredentials getServiceCredentials(
|
public static ServiceCredentials getServiceCredentials(HttpServletRequest httpServletRequest, String scopeGroupId)
|
||||||
HttpServletRequest httpServletRequest, String scopeGroupId)
|
|
||||||
throws ServiceException {
|
throws ServiceException {
|
||||||
|
|
||||||
ServiceCredentials sCredentials = null;
|
ServiceCredentials sCredentials = null;
|
||||||
|
@ -94,8 +95,7 @@ public class SessionUtil {
|
||||||
GCubeUser gCubeUser = pContext.getCurrentUser(httpServletRequest);
|
GCubeUser gCubeUser = pContext.getCurrentUser(httpServletRequest);
|
||||||
|
|
||||||
if (gCubeUser == null) {
|
if (gCubeUser == null) {
|
||||||
String error = "Error retrieving gCubeUser in scope " + scope
|
String error = "Error retrieving gCubeUser in scope " + scope + ": " + gCubeUser;
|
||||||
+ ": " + gCubeUser;
|
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
throw new ServiceException(error);
|
throw new ServiceException(error);
|
||||||
}
|
}
|
||||||
|
@ -103,8 +103,7 @@ public class SessionUtil {
|
||||||
userName = gCubeUser.getUsername();
|
userName = gCubeUser.getUsername();
|
||||||
|
|
||||||
if (userName == null || userName.isEmpty()) {
|
if (userName == null || userName.isEmpty()) {
|
||||||
String error = "Error retrieving username in scope " + scope
|
String error = "Error retrieving username in scope " + scope + ": " + userName;
|
||||||
+ ": " + userName;
|
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
throw new ServiceException(error);
|
throw new ServiceException(error);
|
||||||
}
|
}
|
||||||
|
@ -112,8 +111,7 @@ public class SessionUtil {
|
||||||
token = pContext.getCurrentUserToken(scope, userName);
|
token = pContext.getCurrentUserToken(scope, userName);
|
||||||
|
|
||||||
if (token == null || token.isEmpty()) {
|
if (token == null || token.isEmpty()) {
|
||||||
String error = "Error retrieving token for " + userName
|
String error = "Error retrieving token for " + userName + " in " + scope + ": " + token;
|
||||||
+ " in " + scope + ": " + token;
|
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
throw new ServiceException(error);
|
throw new ServiceException(error);
|
||||||
}
|
}
|
||||||
|
@ -157,22 +155,19 @@ public class SessionUtil {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
groupId = String.valueOf(pContext
|
groupId = String.valueOf(pContext.getCurrentGroupId(httpServletRequest));
|
||||||
.getCurrentGroupId(httpServletRequest));
|
|
||||||
|
|
||||||
groupName = pContext.getCurrentGroupName(httpServletRequest);
|
groupName = pContext.getCurrentGroupName(httpServletRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sCredentials = new ServiceCredentials(userName, fullName, name,
|
sCredentials = new ServiceCredentials(userName, fullName, name, lastName, email, scope, groupId, groupName,
|
||||||
lastName, email, scope, groupId, groupName, userAvatarURL,
|
userAvatarURL, token);
|
||||||
token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("ServiceCredentials: " + sCredentials);
|
logger.debug("ServiceCredentials: " + sCredentials);
|
||||||
|
|
||||||
return sCredentials;
|
return sCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue