description validation changes
This commit is contained in:
parent
c57d5793f2
commit
e7a500e3ec
|
@ -134,10 +134,10 @@ public class FieldPersist {
|
|||
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.iff(()-> FieldType.isReferenceType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && required)
|
||||
.must(() -> !this.isListNullOrEmpty(item.getTextListValue()))
|
||||
.must(() -> !this.isListNullOrEmpty(item.getReferences()) || !this.isNull(item.getReference()))
|
||||
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.iff(()-> !this.isEmpty(item.getTextValue()) && fieldType.equals(FieldType.CHECK_BOX) || fieldType.equals(FieldType.BOOLEAN_DECISION) )
|
||||
.iff(()-> !this.isEmpty(item.getTextValue()) && (fieldType.equals(FieldType.CHECK_BOX) || fieldType.equals(FieldType.BOOLEAN_DECISION)) )
|
||||
.must(() -> this.isBoolean(item.getTextValue()))
|
||||
.failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
|
|
|
@ -50,6 +50,8 @@ public class PropertyDefinitionFieldSetPersist {
|
|||
protected List<Specification> specifications(PropertyDefinitionFieldSetPersist item) {
|
||||
Integer min = fieldSetEntity != null && fieldSetEntity.getMultiplicity() != null ? fieldSetEntity.getMultiplicity().getMin() : null;
|
||||
Integer max = fieldSetEntity != null && fieldSetEntity.getMultiplicity() != null ? fieldSetEntity.getMultiplicity().getMax() : null;
|
||||
if(min == 0 && max == 0) max = null;
|
||||
Integer finalMax = max;
|
||||
|
||||
return Arrays.asList(
|
||||
this.navSpec()
|
||||
|
@ -59,12 +61,12 @@ public class PropertyDefinitionFieldSetPersist {
|
|||
.using((itm) -> this.validatorFactory.validator(PropertyDefinitionFieldSetItemPersist.PersistValidator.class).withFieldSetEntity(this.fieldSetEntity).setStatus(this.status)),
|
||||
this.spec()
|
||||
.iff(() -> DescriptionStatus.Finalized.equals(this.status) && min != null)
|
||||
.must(() -> !this.isNull(item.getItems()) && min >= item.getItems().size())
|
||||
.must(() -> !this.isListNullOrEmpty(item.getItems()) && min <= item.getItems().size())
|
||||
.failOn(PropertyDefinitionFieldSetPersist._items).failWith(messageSource.getMessage("Validation.LargerThenEqual", new Object[]{PropertyDefinitionFieldSetPersist._items, min}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.iff(() -> DescriptionStatus.Finalized.equals(this.status) && max != null)
|
||||
.must(() -> !this.isNull(item.getItems()) && max <= item.getItems().size())
|
||||
.failOn(PropertyDefinitionFieldSetPersist._items).failWith(messageSource.getMessage("Validation.LessThenEqual", new Object[]{PropertyDefinitionFieldSetPersist._items, max}, LocaleContextHolder.getLocale()))
|
||||
.iff(() -> DescriptionStatus.Finalized.equals(this.status) && finalMax != null)
|
||||
.must(() -> !this.isListNullOrEmpty(item.getItems()) && finalMax >= item.getItems().size())
|
||||
.failOn(PropertyDefinitionFieldSetPersist._items).failWith(messageSource.getMessage("Validation.LessThenEqual", new Object[]{PropertyDefinitionFieldSetPersist._items, finalMax}, LocaleContextHolder.getLocale()))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Subscription } from "rxjs";
|
|||
template: `
|
||||
<div class="editor-wrapper" [class]="wrapperClasses">
|
||||
<angular-editor class="full-width editor" [ngClass]="editable ? '': 'disabled'" [id]="id"
|
||||
[config]="editorConfig" [formControl]="form"
|
||||
[config]="editorConfig" [formControl]="form" [required]="form.value ? false: required"
|
||||
placeholder="{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}"
|
||||
(paste)="pasteWithoutFormatting($event)"></angular-editor>
|
||||
<mat-icon *ngIf="form.value && editable" (click)="parentFormGroup.get(controlName).patchValue('')" class="clear">close</mat-icon>
|
||||
|
|
Loading…
Reference in New Issue