fixed association thread

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@139936 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-12-12 16:56:49 +00:00
parent 7ea5014870
commit 031896c371
1 changed files with 33 additions and 25 deletions

View File

@ -68,6 +68,9 @@ public class AssociationToGroupAndNotifyThread extends Thread {
logger.info("Association thread started to put the dataset with id = "+ datasetId + " into group with title " + groupTitle + " for user " + username);
if(groupTitle != null){
try{
// create the group
CkanGroup group = catalogue.createGroup(groupTitle, groupTitle, "");
@ -99,8 +102,13 @@ public class AssociationToGroupAndNotifyThread extends Thread {
}
}
}catch(Exception e){
logger.warn("Something went wrong when tried to add the group " + groupTitle, e);
}
}
logger.info("Other groups to which the product should be associate are " + groups);
if(groups != null)
for (GroupBean groupBean : groups) {
boolean putIntoGroup = catalogue.assignDatasetToGroup(groupBean.getGroupTitle(), datasetId, catalogue.getApiKeyFromUsername(username));
logger.info("Was product put into group" + groupBean.getGroupTitle() + "? " + putIntoGroup);