fixing the issue reported at

https://support.d4science.org/issues/20663#note-12
This commit is contained in:
Francesco Mangiacrapa 2021-02-10 15:04:15 +01:00
parent 9190d51064
commit 5366db1197
3 changed files with 16 additions and 8 deletions

View File

@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.6.2] - 2021-02-08
## [v1.6.2-SNAPSHOT] - 2021-02-08
**Bug Fixes**
[#20446] Catalogue Publishing Widget: field value unexpectedly added in case of optional field
[#20663] Fixing Time_Interval placeholder
## [v1.6.1] [r4.24.0] - 2020-06-18

View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-metadata-publisher-widget</artifactId>
<version>1.6.2</version>
<version>1.6.2-SNAPSHOT</version>
<name>gCube Ckan metadata publisher widget</name>
<description>

View File

@ -638,13 +638,20 @@ public class MetaDataFieldSkeleton extends Composite{
case Time_Interval:
manipulatedTemp = rangesList.get(0).getCurrentValue().replaceAll(DataTimeBox.MISSING_RANGE_VALUE_START, "").replaceAll(DataTimeBox.MISSING_RANGE_VALUE_END, UPPER_RANGE_NOT_SPECIFIED);
if(toReturn.equals(DataTimeBox.RANGE_SEPARATOR_START_END + UPPER_RANGE_NOT_SPECIFIED))
manipulatedTemp = "";
//fixed by Francesco, see #20663#note-12
if(!field.getMandatory()) {
if(manipulatedTemp.equals(DataTimeBox.RANGE_SEPARATOR_START_END + UPPER_RANGE_NOT_SPECIFIED))
manipulatedTemp = "";
}
// split to check if the extreme are equals
String[] temp = manipulatedTemp.split(DataTimeBox.RANGE_SEPARATOR_START_END);
if(temp[0].equals(temp[1]))
manipulatedTemp = temp[0];
//fixed by Francesco
if(!manipulatedTemp.isEmpty()) {
String[] temp = manipulatedTemp.split(DataTimeBox.RANGE_SEPARATOR_START_END);
if(temp[0].equals(temp[1]))
manipulatedTemp = temp[0];
}
toReturn.add(manipulatedTemp);
break;