Revisited the fromProductTitleToName according to #20828
This commit is contained in:
parent
0070ebc06d
commit
00324b4809
|
@ -7,4 +7,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
## [v1.0.0-SNAPSHOT] - 2021-02-17
|
## [v1.0.0-SNAPSHOT] - 2021-02-17
|
||||||
|
|
||||||
|
[#20828] Revisited title size and format
|
||||||
[#19378] First Release
|
[#19378] First Release
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,13 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* Some utility methods used within the library.
|
* Some utility methods used within the library.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* @author updated by Francesco Mangiacrapa at ISTI-CNR
|
||||||
*/
|
*/
|
||||||
public class CatalogueUtilMethods {
|
public class CatalogueUtilMethods {
|
||||||
|
|
||||||
|
public static final int MAX_SIZE_OF_CKAN_DATASET_NAME = 100;
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CatalogueUtilMethods.class);
|
private static final Logger logger = LoggerFactory.getLogger(CatalogueUtilMethods.class);
|
||||||
private final static String HTTPS = "https";
|
|
||||||
private final static String HTTP = "http";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps the scope name to the ckan organization name
|
* Maps the scope name to the ckan organization name
|
||||||
|
@ -75,7 +76,12 @@ public class CatalogueUtilMethods {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
String regexTitleNameTransform = "[^A-Za-z0-9_-]";
|
String regexTitleNameTransform = "[^A-Za-z0-9_-]";
|
||||||
return title.trim().replaceAll(regexTitleNameTransform, "_").replaceAll("_+", "_").toLowerCase();
|
title = title.trim().replaceAll(regexTitleNameTransform, "_").replaceAll("_+", "_").toLowerCase();
|
||||||
|
if(title.length()>MAX_SIZE_OF_CKAN_DATASET_NAME) {
|
||||||
|
return title.substring(0,MAX_SIZE_OF_CKAN_DATASET_NAME-1);
|
||||||
|
}
|
||||||
|
return title;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue