fixing Feature #18700

migrate-to-catalogue-util-library_#19764
Francesco Mangiacrapa 2 years ago
parent a8e0216873
commit 32dcb13556
  1. 29
      src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/metadata/MetaDataFieldSkeleton.java

@ -422,14 +422,14 @@ public class MetaDataFieldSkeleton extends Composite{
*/
public String isFieldValueValid(){
try {
//Feature #18700
String value = getFieldCurrentValue().get(0);
if(value.isEmpty())
return checkValidator(value, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
}catch (Exception e) {
//continue
}
// try {
// //Feature #18700
// String value = getFieldCurrentValue().get(0);
// if(field.getMandatory() && value.isEmpty())
// return checkValidator(value, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
// }catch (Exception e) {
// //continue
// }
switch(field.getType()){
@ -444,10 +444,11 @@ public class MetaDataFieldSkeleton extends Composite{
if(field.getMandatory()){
if(!textAreaValue.trim().isEmpty())
if(!textAreaValue.trim().isEmpty()) {
if(field.getValidator() == null || field.getValidator().isEmpty())
return null; // no further check
else return checkValidator(textAreaValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
}
else return MANDATORY_ATTRIBUTE_MISSING;
}else{
@ -831,7 +832,15 @@ public class MetaDataFieldSkeleton extends Composite{
if(asTag != null && asTag.isCreate()){
List<String> values = getFieldCurrentValue();
for (String value : values) {
generatedTags.add(TaggingGroupingValue.getComposedValueTag(field.getFieldName(), value, asTag.getSeparator(), asTag.getTaggingValue()));
//Feature #18700
if(value.isEmpty()) {
//if the value is empty I'm adding the tag on in case of onFieldName
if(asTag.getTaggingValue().equals(TaggingGroupingValue.onFieldName))
generatedTags.add(TaggingGroupingValue.getComposedValueTag(field.getFieldName(), value, asTag.getSeparator(), asTag.getTaggingValue()));
}else
generatedTags.add(TaggingGroupingValue.getComposedValueTag(field.getFieldName(), value, asTag.getSeparator(), asTag.getTaggingValue()));
}
return generatedTags;
}

Loading…
Cancel
Save