group name now looks like group-name and no longer group_name
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@133005 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
10db5b07d2
commit
357d242cd6
|
@ -15,7 +15,7 @@ public class UtilMethods {
|
|||
private static final Logger logger = LoggerFactory.getLogger(UtilMethods.class);
|
||||
private final static String HTTPS = "https";
|
||||
private final static String HTTP = "http";
|
||||
|
||||
|
||||
/**
|
||||
* Ckan username has _ instead of . (that is, costantino.perciante -> costantino_perciante)
|
||||
* @param owner
|
||||
|
@ -50,8 +50,15 @@ public class UtilMethods {
|
|||
if(groupName == null)
|
||||
return null;
|
||||
|
||||
String regexGroupNameTransform = "[^A-Za-z0-9_]";
|
||||
return groupName.trim().replaceAll(regexGroupNameTransform, "_").replaceAll("_+", "_").toLowerCase();
|
||||
String regexGroupNameTransform = "[^A-Za-z0-9-]";
|
||||
String modified = groupName.trim().replaceAll(regexGroupNameTransform, "-").replaceAll("-+", "-").toLowerCase();
|
||||
|
||||
if(modified.startsWith("-"))
|
||||
modified = modified.substring(1);
|
||||
if(modified.endsWith("-"))
|
||||
modified = modified.substring(0, modified.length() -1);
|
||||
|
||||
return modified;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue