minor fix to regex for group and product titles mapping
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@131993 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
80c29474f3
commit
1d46a200e6
|
@ -36,7 +36,7 @@ public class UtilMethods {
|
|||
return null;
|
||||
|
||||
String regexTitleNameTransform = "[^A-Za-z0-9_-]";
|
||||
return title.trim().replaceAll(regexTitleNameTransform, "_").replace("_+", "_").toLowerCase();
|
||||
return title.trim().replaceAll(regexTitleNameTransform, "_").replaceAll("_+", "_").toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,7 @@ public class UtilMethods {
|
|||
return null;
|
||||
|
||||
String regexGroupNameTransform = "[^A-Za-z0-9_]";
|
||||
return groupName.trim().replaceAll(regexGroupNameTransform, "_").replace("_+", "_").toLowerCase();
|
||||
return groupName.trim().replaceAll(regexGroupNameTransform, "_").replaceAll("_+", "_").toLowerCase();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ import org.gcube.datacatalogue.ckanutillibrary.models.CKanUserWrapper;
|
|||
import org.gcube.datacatalogue.ckanutillibrary.models.CkanDatasetRelationship;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.models.DatasetRelationships;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.models.RolesCkanGroupOrOrg;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.utils.UtilMethods;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import eu.trentorise.opendata.jackan.CheckedCkanClient;
|
||||
import eu.trentorise.opendata.jackan.model.CkanGroup;
|
||||
import eu.trentorise.opendata.jackan.model.CkanOrganization;
|
||||
import eu.trentorise.opendata.jackan.model.CkanUser;
|
||||
|
||||
|
@ -283,20 +283,22 @@ public class TestDataCatalogueLib {
|
|||
//@Test
|
||||
public void createGroup() throws Exception{
|
||||
|
||||
DataCatalogueImpl instance = factory.getUtilsPerScope(scope);
|
||||
String title = "SoBigData.eu: Method Metadata NextNext";
|
||||
CkanGroup group = instance.createGroup(title, title, "A description for this group");
|
||||
|
||||
if(group != null){
|
||||
|
||||
boolean associated = instance.checkRoleIntoGroup("user_editor_devvre", title, RolesCkanGroupOrOrg.ADMIN);
|
||||
|
||||
if(associated){
|
||||
|
||||
boolean assigned = instance.assignDatasetToGroup(title, "dataset_random_editor", instance.getApiKeyFromUsername("user_editor_devvre"));
|
||||
logger.debug("Assigned is " + assigned);
|
||||
}
|
||||
}
|
||||
//DataCatalogueImpl instance = factory.getUtilsPerScope(scope);
|
||||
String title = " SoBigData.eu: Method Metadata NextNext ";
|
||||
String result = UtilMethods.fromGroupTitleToName(title);
|
||||
logger.debug(result);
|
||||
// CkanGroup group = instance.createGroup(title, title, "A description for this group");
|
||||
//
|
||||
// if(group != null){
|
||||
//
|
||||
// boolean associated = instance.checkRoleIntoGroup("user_editor_devvre", title, RolesCkanGroupOrOrg.ADMIN);
|
||||
//
|
||||
// if(associated){
|
||||
//
|
||||
// boolean assigned = instance.assignDatasetToGroup(title, "dataset_random_editor", instance.getApiKeyFromUsername("user_editor_devvre"));
|
||||
// logger.debug("Assigned is " + assigned);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue