gcoreendpoint now implements serializable. Associaiton thread starts only if there are organizations to manage

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@141848 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-01-26 18:29:51 +00:00
parent b3e282c684
commit 872d3852cb
2 changed files with 11 additions and 7 deletions

View File

@ -6,6 +6,7 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.io.Serializable;
import java.util.List;
import org.gcube.common.resources.gcore.GCoreEndpoint;
@ -22,8 +23,9 @@ import com.liferay.portal.kernel.log.LogFactoryUtil;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 10, 2016
*/
public class GcoreEndpointReader {
public class GcoreEndpointReader implements Serializable{
private static final long serialVersionUID = 7631710353375893823L;
private static final String ckanResource = "org.gcube.data.access.ckanconnector.CkanConnector";
private static final String serviceName = "CkanConnector";
private static final String serviceClass = "DataAccess";
@ -40,6 +42,7 @@ public class GcoreEndpointReader {
*/
public GcoreEndpointReader(String scope) throws Exception {
String currentScope = ScopeProvider.instance.get();
try{
logger.info("set scope "+scope);
@ -79,7 +82,7 @@ public class GcoreEndpointReader {
throw new Exception(error);
}finally{
logger.info("scope provider reset");
ScopeProvider.instance.reset();
ScopeProvider.instance.set(currentScope);
}
}

View File

@ -99,11 +99,12 @@ public class UserUtil {
}
// schedule the thread for the groups other than the vre to be checked in the local ckan instance
new AddUserToOrganizationThread(
instance,
userManager.getUserByEmail(userEMail).getUsername(),
mapRoleByGroupExtrasVre).
start();
if(mapRoleByGroupExtrasVre.size() > 0)
new AddUserToOrganizationThread(
instance,
userManager.getUserByEmail(userEMail).getUsername(),
mapRoleByGroupExtrasVre).
start();
logger.debug("Returning Map to the ckan connector : " + mapRoleByGroupSingleVre);
return mapRoleByGroupSingleVre;
}catch (UserManagementSystemException | UserRetrievalFault | GroupRetrievalFault e) {