ignore tags longer than 100 chars

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@158989 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-12-01 12:32:51 +00:00
parent c620324cef
commit 4e45429796
2 changed files with 12 additions and 5 deletions

View File

@ -3,6 +3,9 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<dependent-module archiveName="grsf-common-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/grsf-common-library/grsf-common-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="grsf-publisher-ws"/>
<property name="java-output-path" value="/grsf-publisher-ws/target/classes"/>
</wb-module>

View File

@ -49,6 +49,7 @@ import eu.trentorise.opendata.jackan.model.CkanLicense;
public class CommonServiceUtils {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(CommonServiceUtils.class);
private static final int TAG_MAX_SIZE = 100;
/**
* Retrieve the list of licenses for stocks and fisheries
@ -183,13 +184,15 @@ public class CommonServiceUtils {
elementsToConsider = Math.min(elementsToConsider, Constants.TIME_SERIES_TAKE_LAST_VALUES);
for (int i = (asList.size() - elementsToConsider); i < asList.size(); i++) {
String finalTag = asList.get(i).toString().trim().replaceAll(Constants.REGEX_TAGS, "");
tags.add(finalTag);
if(finalTag.length() <= TAG_MAX_SIZE)
tags.add(finalTag);
}
}else{
// else add all the available elements
for (int i = 0; i < elementsToConsider; i++) {
String finalTag = asList.get(i).toString().trim().replaceAll(Constants.REGEX_TAGS, "");
tags.add(finalTag);
if(finalTag.length() <= TAG_MAX_SIZE)
tags.add(finalTag);
}
}
}
@ -197,7 +200,8 @@ public class CommonServiceUtils {
logger.debug("The object annotated with @Tag is a simple one. Adding ... ");
String finalTag = f.toString().trim().replaceAll(Constants.REGEX_TAGS, "");
logger.debug(finalTag);
tags.add(finalTag);
if(finalTag.length() <= TAG_MAX_SIZE)
tags.add(finalTag);
}
}
@ -433,7 +437,7 @@ public class CommonServiceUtils {
CommonServiceUtils.validateAggregatedRecord(record);
}
}
// set the domain
record.setDomain(productType.getOrigName());
@ -490,7 +494,7 @@ public class CommonServiceUtils {
return systemTypeValue;
}
public static String getRecordOrganization(String itemIdOrName, String apiKey, String context) throws Exception{
DataCatalogue catalog = HelperMethods.getDataCatalogueRunningInstance(context);
CkanDataset dataset = catalog.getDataset(itemIdOrName, apiKey);