Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
f8e6cb6462
|
@ -228,7 +228,7 @@ public class DescriptionPersist {
|
||||||
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
|
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
|
||||||
.on(DescriptionPersist._properties)
|
.on(DescriptionPersist._properties)
|
||||||
.over(item.getProperties())
|
.over(item.getProperties())
|
||||||
.using(() -> this.validatorFactory.validator(PropertyDefinitionPersist.PropertyDefinitionPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition))
|
.using(() -> this.validatorFactory.validator(PropertyDefinitionPersist.PropertyDefinitionPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition).withRules(definition))
|
||||||
// this.navSpec()
|
// this.navSpec()
|
||||||
// .iff(() -> !this.isNull(item.getTags()))
|
// .iff(() -> !this.isNull(item.getTags()))
|
||||||
// .on(DescriptionPersist._tags)
|
// .on(DescriptionPersist._tags)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import eu.eudat.commons.enums.DescriptionStatus;
|
||||||
import eu.eudat.commons.enums.FieldType;
|
import eu.eudat.commons.enums.FieldType;
|
||||||
import eu.eudat.commons.enums.FieldValidationType;
|
import eu.eudat.commons.enums.FieldValidationType;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
|
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.RuleEntity;
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.model.persist.ReferencePersist;
|
import eu.eudat.model.persist.ReferencePersist;
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
@ -95,6 +96,8 @@ public class FieldPersist {
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
private FieldEntity fieldEntity;
|
private FieldEntity fieldEntity;
|
||||||
private DescriptionStatus status;
|
private DescriptionStatus status;
|
||||||
|
private List<List<RuleEntity>> rules;
|
||||||
|
private Boolean fieldSetIsRuleTarget;
|
||||||
|
|
||||||
protected PersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, MessageSource messageSource) {
|
protected PersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, MessageSource messageSource) {
|
||||||
super(conventionService, errors);
|
super(conventionService, errors);
|
||||||
|
@ -111,33 +114,34 @@ public class FieldPersist {
|
||||||
protected List<Specification> specifications(FieldPersist item) {
|
protected List<Specification> specifications(FieldPersist item) {
|
||||||
FieldType fieldType = this.fieldEntity != null && this.fieldEntity.getData() != null ? this.fieldEntity.getData().getFieldType() : FieldType.FREE_TEXT;
|
FieldType fieldType = this.fieldEntity != null && this.fieldEntity.getData() != null ? this.fieldEntity.getData().getFieldType() : FieldType.FREE_TEXT;
|
||||||
boolean required = this.fieldEntity != null && this.fieldEntity.getValidations() != null ? this.fieldEntity.getValidations().contains(FieldValidationType.Required) : false;
|
boolean required = this.fieldEntity != null && this.fieldEntity.getValidations() != null ? this.fieldEntity.getValidations().contains(FieldValidationType.Required) : false;
|
||||||
|
boolean isRuleTarget = this.checkIfFieldIsRuleTarget();
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(()-> FieldType.isTextType(fieldType) && !fieldType.equals(FieldType.CHECK_BOX) && DescriptionStatus.Finalized.equals(this.status) && required)
|
.iff(()-> FieldType.isTextType(fieldType) && !fieldType.equals(FieldType.CHECK_BOX) && DescriptionStatus.Finalized.equals(this.status) && this.isListNullOrEmpty(fieldEntity.getVisibilityRules()) && !isRuleTarget && !fieldSetIsRuleTarget && required)
|
||||||
.must(() -> !this.isEmpty(item.getTextValue()))
|
.must(() -> !this.isEmpty(item.getTextValue()))
|
||||||
.failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())),
|
.failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(()-> FieldType.isDateType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && required)
|
.iff(()-> FieldType.isDateType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && this.isListNullOrEmpty(fieldEntity.getVisibilityRules()) && !isRuleTarget && !fieldSetIsRuleTarget && required)
|
||||||
.must(() -> !this.isNull(item.getDateValue()))
|
.must(() -> !this.isNull(item.getDateValue()))
|
||||||
.failOn(FieldPersist._dateValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._dateValue}, LocaleContextHolder.getLocale())),
|
.failOn(FieldPersist._dateValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._dateValue}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(()-> FieldType.isExternalIdentifierType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && required)
|
.iff(()-> FieldType.isExternalIdentifierType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && this.isListNullOrEmpty(fieldEntity.getVisibilityRules()) && !isRuleTarget && !fieldSetIsRuleTarget && required)
|
||||||
.must(() -> !this.isNull(item.getExternalIdentifier()))
|
.must(() -> !this.isNull(item.getExternalIdentifier()))
|
||||||
.failOn(FieldPersist._externalIdentifier).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._externalIdentifier}, LocaleContextHolder.getLocale())),
|
.failOn(FieldPersist._externalIdentifier).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._externalIdentifier}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(()-> FieldType.isTextListType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && required && !fieldType.equals(FieldType.TAGS))
|
.iff(()-> FieldType.isTextListType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && this.isListNullOrEmpty(fieldEntity.getVisibilityRules()) && !isRuleTarget && !fieldSetIsRuleTarget && required && !fieldType.equals(FieldType.TAGS))
|
||||||
.must(() -> !this.isListNullOrEmpty(item.getTextListValue()) || !this.isEmpty(item.getTextValue()))
|
.must(() -> !this.isListNullOrEmpty(item.getTextListValue()) || !this.isEmpty(item.getTextValue()))
|
||||||
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
|
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(()-> fieldType.equals(FieldType.TAGS) && DescriptionStatus.Finalized.equals(this.status) && required)
|
.iff(()-> fieldType.equals(FieldType.TAGS) && DescriptionStatus.Finalized.equals(this.status) && this.isListNullOrEmpty(fieldEntity.getVisibilityRules()) && !isRuleTarget && !fieldSetIsRuleTarget && required)
|
||||||
.must(() -> !this.isListNullOrEmpty(item.getTextListValue()))
|
.must(() -> !this.isListNullOrEmpty(item.getTextListValue()))
|
||||||
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
|
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(()-> FieldType.isReferenceType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && required)
|
.iff(()-> FieldType.isReferenceType(fieldType) && DescriptionStatus.Finalized.equals(this.status) && this.isListNullOrEmpty(fieldEntity.getVisibilityRules()) && !isRuleTarget && !fieldSetIsRuleTarget && required)
|
||||||
.must(() -> !this.isListNullOrEmpty(item.getReferences()) || !this.isNull(item.getReference()))
|
.must(() -> !this.isListNullOrEmpty(item.getReferences()) || !this.isNull(item.getReference()))
|
||||||
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
|
.failOn(FieldPersist._textListValue).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._textListValue}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
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)) && this.isListNullOrEmpty(fieldEntity.getVisibilityRules()) && !isRuleTarget && !fieldSetIsRuleTarget)
|
||||||
.must(() -> this.isBoolean(item.getTextValue()))
|
.must(() -> this.isBoolean(item.getTextValue()))
|
||||||
.failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())),
|
.failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())),
|
||||||
this.spec()
|
this.spec()
|
||||||
|
@ -167,10 +171,31 @@ public class FieldPersist {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PersistValidator withRules(List<List<RuleEntity>> rules) {
|
||||||
|
this.rules = rules;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public PersistValidator setStatus(DescriptionStatus status) {
|
public PersistValidator setStatus(DescriptionStatus status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PersistValidator ifFieldSetIsRuleTarget(Boolean fieldSetIsRuleTarget){
|
||||||
|
this.fieldSetIsRuleTarget = fieldSetIsRuleTarget;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
private boolean checkIfFieldIsRuleTarget(){
|
||||||
|
if (this.isListNullOrEmpty(rules)) return false;
|
||||||
|
for (List<RuleEntity> rulesBySection: rules) {
|
||||||
|
if (!this.isListNullOrEmpty(rulesBySection)){
|
||||||
|
for (RuleEntity rule :rulesBySection) {
|
||||||
|
if (rule.getTarget().equals(this.fieldEntity.getId())) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.model.persist.descriptionproperties;
|
||||||
import eu.eudat.commons.enums.DescriptionStatus;
|
import eu.eudat.commons.enums.DescriptionStatus;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
|
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity;
|
import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.RuleEntity;
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
@ -60,6 +61,7 @@ public class PropertyDefinitionFieldSetItemPersist {
|
||||||
|
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
private FieldSetEntity fieldSetEntity;
|
private FieldSetEntity fieldSetEntity;
|
||||||
|
private List<List<RuleEntity>> rules;
|
||||||
private DescriptionStatus status;
|
private DescriptionStatus status;
|
||||||
protected PersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, MessageSource messageSource) {
|
protected PersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, MessageSource messageSource) {
|
||||||
super(conventionService, errors);
|
super(conventionService, errors);
|
||||||
|
@ -86,7 +88,7 @@ public class PropertyDefinitionFieldSetItemPersist {
|
||||||
.using((itm) ->
|
.using((itm) ->
|
||||||
{
|
{
|
||||||
FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById((String)itm.getKey()).stream().findFirst().orElse(null) : null;
|
FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById((String)itm.getKey()).stream().findFirst().orElse(null) : null;
|
||||||
return this.validatorFactory.validator(FieldPersist.PersistValidator.class).withFieldEntity(fieldEntity).setStatus(this.status);
|
return this.validatorFactory.validator(FieldPersist.PersistValidator.class).withFieldEntity(fieldEntity).withRules(rules).ifFieldSetIsRuleTarget(this.checkIfFieldSetIsRuleTarget()).setStatus(this.status);
|
||||||
})
|
})
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -97,10 +99,27 @@ public class PropertyDefinitionFieldSetItemPersist {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PersistValidator withRules(List<List<RuleEntity>> rules) {
|
||||||
|
this.rules = rules;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public PersistValidator setStatus(DescriptionStatus status) {
|
public PersistValidator setStatus(DescriptionStatus status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Boolean checkIfFieldSetIsRuleTarget(){
|
||||||
|
if (this.isListNullOrEmpty(rules)) return false;
|
||||||
|
for (List<RuleEntity> rulesBySection: rules) {
|
||||||
|
if (!this.isListNullOrEmpty(rulesBySection)){
|
||||||
|
for (RuleEntity rule :rulesBySection) {
|
||||||
|
if (rule.getTarget().equals(this.fieldSetEntity.getId())) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.model.persist.descriptionproperties;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DescriptionStatus;
|
import eu.eudat.commons.enums.DescriptionStatus;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity;
|
import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.RuleEntity;
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
@ -35,6 +36,7 @@ public class PropertyDefinitionFieldSetPersist {
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
private FieldSetEntity fieldSetEntity;
|
private FieldSetEntity fieldSetEntity;
|
||||||
private DescriptionStatus status;
|
private DescriptionStatus status;
|
||||||
|
private List<List<RuleEntity>> rules;
|
||||||
protected PersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, MessageSource messageSource, MessageSource messageSource1) {
|
protected PersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, ValidatorFactory validatorFactory, MessageSource messageSource, MessageSource messageSource1) {
|
||||||
super(conventionService, errors);
|
super(conventionService, errors);
|
||||||
this.validatorFactory = validatorFactory;
|
this.validatorFactory = validatorFactory;
|
||||||
|
@ -50,7 +52,7 @@ public class PropertyDefinitionFieldSetPersist {
|
||||||
protected List<Specification> specifications(PropertyDefinitionFieldSetPersist item) {
|
protected List<Specification> specifications(PropertyDefinitionFieldSetPersist item) {
|
||||||
Integer min = fieldSetEntity != null && fieldSetEntity.getMultiplicity() != null ? fieldSetEntity.getMultiplicity().getMin() : null;
|
Integer min = fieldSetEntity != null && fieldSetEntity.getMultiplicity() != null ? fieldSetEntity.getMultiplicity().getMin() : null;
|
||||||
Integer max = fieldSetEntity != null && fieldSetEntity.getMultiplicity() != null ? fieldSetEntity.getMultiplicity().getMax() : null;
|
Integer max = fieldSetEntity != null && fieldSetEntity.getMultiplicity() != null ? fieldSetEntity.getMultiplicity().getMax() : null;
|
||||||
if(min == 0 && max == 0) max = null;
|
if(min != null && min == 0 && max != null && max == 0) max = null;
|
||||||
Integer finalMax = max;
|
Integer finalMax = max;
|
||||||
|
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
|
@ -58,7 +60,7 @@ public class PropertyDefinitionFieldSetPersist {
|
||||||
.iff(() -> !this.isNull(item.getItems()))
|
.iff(() -> !this.isNull(item.getItems()))
|
||||||
.on(PropertyDefinitionFieldSetPersist._items)
|
.on(PropertyDefinitionFieldSetPersist._items)
|
||||||
.over(item.getItems())
|
.over(item.getItems())
|
||||||
.using((itm) -> this.validatorFactory.validator(PropertyDefinitionFieldSetItemPersist.PersistValidator.class).withFieldSetEntity(this.fieldSetEntity).setStatus(this.status)),
|
.using((itm) -> this.validatorFactory.validator(PropertyDefinitionFieldSetItemPersist.PersistValidator.class).withFieldSetEntity(this.fieldSetEntity).withRules(this.rules).setStatus(this.status)),
|
||||||
this.spec()
|
this.spec()
|
||||||
.iff(() -> DescriptionStatus.Finalized.equals(this.status) && min != null)
|
.iff(() -> DescriptionStatus.Finalized.equals(this.status) && min != null)
|
||||||
.must(() -> !this.isListNullOrEmpty(item.getItems()) && min <= item.getItems().size())
|
.must(() -> !this.isListNullOrEmpty(item.getItems()) && min <= item.getItems().size())
|
||||||
|
@ -75,6 +77,11 @@ public class PropertyDefinitionFieldSetPersist {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PersistValidator withRules(List<List<RuleEntity>> rules) {
|
||||||
|
this.rules = rules;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public PropertyDefinitionFieldSetPersist.PersistValidator setStatus(DescriptionStatus status) {
|
public PropertyDefinitionFieldSetPersist.PersistValidator setStatus(DescriptionStatus status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import eu.eudat.commons.enums.FieldValidationType;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity;
|
import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
|
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
|
||||||
import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity;
|
import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.RuleEntity;
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
@ -47,6 +48,8 @@ public class PropertyDefinitionPersist {
|
||||||
private DescriptionStatus status;
|
private DescriptionStatus status;
|
||||||
private DefinitionEntity definition;
|
private DefinitionEntity definition;
|
||||||
|
|
||||||
|
private List<List<RuleEntity>> rules;
|
||||||
|
|
||||||
protected PropertyDefinitionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
protected PropertyDefinitionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
super(conventionService, errors);
|
super(conventionService, errors);
|
||||||
this.messageSource = messageSource;
|
this.messageSource = messageSource;
|
||||||
|
@ -78,7 +81,7 @@ public class PropertyDefinitionPersist {
|
||||||
.mapKey((k) -> ((String)k))
|
.mapKey((k) -> ((String)k))
|
||||||
.using((itm) -> {
|
.using((itm) -> {
|
||||||
FieldSetEntity fieldSetEntity = definition != null ? definition.getFieldSetById((String)itm.getKey()).stream().findFirst().orElse(null) : null;
|
FieldSetEntity fieldSetEntity = definition != null ? definition.getFieldSetById((String)itm.getKey()).stream().findFirst().orElse(null) : null;
|
||||||
return this.validatorFactory.validator(PropertyDefinitionFieldSetPersist.PersistValidator.class).withFieldSetEntity(fieldSetEntity).setStatus(this.status);
|
return this.validatorFactory.validator(PropertyDefinitionFieldSetPersist.PersistValidator.class).withFieldSetEntity(fieldSetEntity).withRules(rules).setStatus(this.status);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -94,6 +97,12 @@ public class PropertyDefinitionPersist {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PropertyDefinitionPersistValidator withRules(DefinitionEntity definition) {
|
||||||
|
List<FieldEntity> fields = definition.getAllField();
|
||||||
|
this.rules = fields.stream().filter(x -> x.getVisibilityRules() != null).map(FieldEntity::getVisibilityRules).collect(Collectors.toList());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private List<FieldSetEntity> getMissingFieldSetEntity(PropertyDefinitionPersist item){
|
private List<FieldSetEntity> getMissingFieldSetEntity(PropertyDefinitionPersist item){
|
||||||
List<FieldSetEntity> missingMultipleFieldSets = new ArrayList<>();
|
List<FieldSetEntity> missingMultipleFieldSets = new ArrayList<>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue