fixing Feature #18700

This commit is contained in:
Francesco Mangiacrapa 2020-06-18 12:59:59 +02:00
parent a8e0216873
commit 32dcb13556
1 changed files with 19 additions and 10 deletions

View File

@ -422,14 +422,14 @@ public class MetaDataFieldSkeleton extends Composite{
*/ */
public String isFieldValueValid(){ public String isFieldValueValid(){
try { // try {
//Feature #18700 // //Feature #18700
String value = getFieldCurrentValue().get(0); // String value = getFieldCurrentValue().get(0);
if(value.isEmpty()) // if(field.getMandatory() && value.isEmpty())
return checkValidator(value, field.getValidator()) ? null : MALFORMED_ATTRIBUTE; // return checkValidator(value, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
}catch (Exception e) { // }catch (Exception e) {
//continue // //continue
} // }
switch(field.getType()){ switch(field.getType()){
@ -444,10 +444,11 @@ public class MetaDataFieldSkeleton extends Composite{
if(field.getMandatory()){ if(field.getMandatory()){
if(!textAreaValue.trim().isEmpty()) if(!textAreaValue.trim().isEmpty()) {
if(field.getValidator() == null || field.getValidator().isEmpty()) if(field.getValidator() == null || field.getValidator().isEmpty())
return null; // no further check return null; // no further check
else return checkValidator(textAreaValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE; else return checkValidator(textAreaValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
}
else return MANDATORY_ATTRIBUTE_MISSING; else return MANDATORY_ATTRIBUTE_MISSING;
}else{ }else{
@ -831,7 +832,15 @@ public class MetaDataFieldSkeleton extends Composite{
if(asTag != null && asTag.isCreate()){ if(asTag != null && asTag.isCreate()){
List<String> values = getFieldCurrentValue(); List<String> values = getFieldCurrentValue();
for (String value : values) { 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; return generatedTags;
} }