rename dmp to plan

This commit is contained in:
Efstratios Giannopoulos 2024-07-05 16:45:42 +03:00
parent a3c7fc13a8
commit cfdadacd50
11 changed files with 107 additions and 111 deletions

View File

@ -7,7 +7,7 @@ import org.opencdmp.commons.validation.BaseValidator;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.data.PlanBlueprintEntity; import org.opencdmp.data.PlanBlueprintEntity;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.model.persist.dmpblueprintdefinition.DefinitionPersist; import org.opencdmp.model.persist.planblueprintdefinition.DefinitionPersist;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;

View File

@ -1,14 +1,14 @@
package org.opencdmp.model.persist; package org.opencdmp.model.persist;
import org.opencdmp.commons.enums.PlanBlueprintStatus;
import org.opencdmp.commons.validation.BaseValidator;
import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.ValidatorFactory;
import gr.cite.tools.validation.specification.Specification; import gr.cite.tools.validation.specification.Specification;
import jakarta.validation.constraints.Size;
import org.opencdmp.commons.enums.PlanBlueprintStatus;
import org.opencdmp.commons.validation.BaseValidator;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.data.PlanBlueprintEntity; import org.opencdmp.data.PlanBlueprintEntity;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.model.persist.dmpblueprintdefinition.DefinitionPersist; import org.opencdmp.model.persist.planblueprintdefinition.DefinitionPersist;
import jakarta.validation.constraints.Size;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
@ -26,11 +26,11 @@ public class PlanBlueprintPersist {
public static final String _id = "id"; public static final String _id = "id";
@Size(max = PlanBlueprintEntity._labelLength, message = "{validation.largerthanmax}") @Size(max = PlanBlueprintEntity._labelLength, message = "{validation.largerthanmax}")
private String label = null; private String label;
public static final String _label = "label"; public static final String _label = "label";
private DefinitionPersist definition = null; private DefinitionPersist definition;
public static final String _definition = "definition"; public static final String _definition = "definition";
@ -43,7 +43,7 @@ public class PlanBlueprintPersist {
public static final String _hash = "hash"; public static final String _hash = "hash";
public UUID getId() { public UUID getId() {
return id; return this.id;
} }
public void setId(UUID id) { public void setId(UUID id) {
@ -51,7 +51,7 @@ public class PlanBlueprintPersist {
} }
public String getLabel() { public String getLabel() {
return label; return this.label;
} }
public void setLabel(String label) { public void setLabel(String label) {
@ -59,7 +59,7 @@ public class PlanBlueprintPersist {
} }
public DefinitionPersist getDefinition() { public DefinitionPersist getDefinition() {
return definition; return this.definition;
} }
public void setDefinition(DefinitionPersist definition) { public void setDefinition(DefinitionPersist definition) {
@ -67,7 +67,7 @@ public class PlanBlueprintPersist {
} }
public PlanBlueprintStatus getStatus() { public PlanBlueprintStatus getStatus() {
return status; return this.status;
} }
public void setStatus(PlanBlueprintStatus status) { public void setStatus(PlanBlueprintStatus status) {
@ -75,7 +75,7 @@ public class PlanBlueprintPersist {
} }
public String getHash() { public String getHash() {
return hash; return this.hash;
} }
public void setHash(String hash) { public void setHash(String hash) {
@ -109,26 +109,26 @@ public class PlanBlueprintPersist {
this.spec() this.spec()
.iff(() -> this.isValidGuid(item.getId())) .iff(() -> this.isValidGuid(item.getId()))
.must(() -> this.isValidHash(item.getHash())) .must(() -> this.isValidHash(item.getHash()))
.failOn(PlanBlueprintPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._hash}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintPersist._hash).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._hash}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(() -> !this.isValidGuid(item.getId())) .iff(() -> !this.isValidGuid(item.getId()))
.must(() -> !this.isValidHash(item.getHash())) .must(() -> !this.isValidHash(item.getHash()))
.failOn(PlanBlueprintPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintPersist._hash).failWith(this.messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isEmpty(item.getLabel())) .must(() -> !this.isEmpty(item.getLabel()))
.failOn(PlanBlueprintPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._label}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._label}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(() -> !this.isEmpty(item.getLabel())) .iff(() -> !this.isEmpty(item.getLabel()))
.must(() -> this.lessEqualLength(item.getLabel(), PlanBlueprintEntity._labelLength)) .must(() -> this.lessEqualLength(item.getLabel(), PlanBlueprintEntity._labelLength))
.failOn(PlanBlueprintPersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{PlanBlueprintPersist._label}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{PlanBlueprintPersist._label}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getStatus())) .must(() -> !this.isNull(item.getStatus()))
.failOn(PlanBlueprintPersist._status).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._status}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintPersist._status).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._status}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(() -> item.getStatus() == PlanBlueprintStatus.Finalized) .iff(() -> item.getStatus() == PlanBlueprintStatus.Finalized)
.must(() -> !this.isNull(item.getDefinition())) .must(() -> !this.isNull(item.getDefinition()))
.failOn(PlanBlueprintPersist._definition).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._definition}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintPersist._definition).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{PlanBlueprintPersist._definition}, LocaleContextHolder.getLocale())),
this.refSpec() this.refSpec()
.iff(() -> !this.isNull(item.getDefinition())) .iff(() -> !this.isNull(item.getDefinition()))
.on(PlanBlueprintPersist._definition) .on(PlanBlueprintPersist._definition)

View File

@ -1,8 +1,8 @@
package org.opencdmp.model.persist.dmpblueprintdefinition; package org.opencdmp.model.persist.planblueprintdefinition;
import org.opencdmp.commons.validation.BaseValidator;
import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.ValidatorFactory;
import gr.cite.tools.validation.specification.Specification; import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.commons.validation.BaseValidator;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -16,12 +16,12 @@ import java.util.List;
public class DefinitionPersist { public class DefinitionPersist {
private List<SectionPersist> sections = null; private List<SectionPersist> sections;
public static final String _sections = "sections"; public static final String _sections = "sections";
public List<SectionPersist> getSections() { public List<SectionPersist> getSections() {
return sections; return this.sections;
} }
public void setSections(List<SectionPersist> sections) { public void setSections(List<SectionPersist> sections) {
@ -57,7 +57,7 @@ public class DefinitionPersist {
return Arrays.asList( return Arrays.asList(
this.spec() this.spec()
.must(() -> !this.isListNullOrEmpty(item.getSections())) .must(() -> !this.isListNullOrEmpty(item.getSections()))
.failOn(DefinitionPersist._sections).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._sections}, LocaleContextHolder.getLocale())), .failOn(DefinitionPersist._sections).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._sections}, LocaleContextHolder.getLocale())),
this.navSpec() this.navSpec()
.iff(() -> !this.isListNullOrEmpty(item.getSections())) .iff(() -> !this.isListNullOrEmpty(item.getSections()))
.on(DefinitionPersist._sections) .on(DefinitionPersist._sections)

View File

@ -1,7 +1,7 @@
package org.opencdmp.model.persist.dmpblueprintdefinition; package org.opencdmp.model.persist.planblueprintdefinition;
import org.opencdmp.commons.validation.BaseValidator;
import gr.cite.tools.validation.specification.Specification; import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.commons.validation.BaseValidator;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -16,24 +16,24 @@ import java.util.UUID;
public class DescriptionTemplatePersist { public class DescriptionTemplatePersist {
private UUID descriptionTemplateGroupId = null; private UUID descriptionTemplateGroupId;
public static final String _descriptionTemplateGroupId = "descriptionTemplateGroupId"; public static final String _descriptionTemplateGroupId = "descriptionTemplateGroupId";
private String label = null; private String label;
public static final String _label = "label"; public static final String _label = "label";
private Integer minMultiplicity = null; private Integer minMultiplicity;
public static final String _minMultiplicity = "minMultiplicity"; public static final String _minMultiplicity = "minMultiplicity";
private Integer maxMultiplicity = null; private Integer maxMultiplicity;
public static final String _maxMultiplicity = "maxMultiplicity"; public static final String _maxMultiplicity = "maxMultiplicity";
public UUID getDescriptionTemplateGroupId() { public UUID getDescriptionTemplateGroupId() {
return descriptionTemplateGroupId; return this.descriptionTemplateGroupId;
} }
public void setDescriptionTemplateGroupId(UUID descriptionTemplateGroupId) { public void setDescriptionTemplateGroupId(UUID descriptionTemplateGroupId) {
@ -41,7 +41,7 @@ public class DescriptionTemplatePersist {
} }
public String getLabel() { public String getLabel() {
return label; return this.label;
} }
public void setLabel(String label) { public void setLabel(String label) {
@ -49,7 +49,7 @@ public class DescriptionTemplatePersist {
} }
public Integer getMinMultiplicity() { public Integer getMinMultiplicity() {
return minMultiplicity; return this.minMultiplicity;
} }
public void setMinMultiplicity(Integer minMultiplicity) { public void setMinMultiplicity(Integer minMultiplicity) {
@ -57,7 +57,7 @@ public class DescriptionTemplatePersist {
} }
public Integer getMaxMultiplicity() { public Integer getMaxMultiplicity() {
return maxMultiplicity; return this.maxMultiplicity;
} }
public void setMaxMultiplicity(Integer maxMultiplicity) { public void setMaxMultiplicity(Integer maxMultiplicity) {
@ -87,15 +87,15 @@ public class DescriptionTemplatePersist {
return Arrays.asList( return Arrays.asList(
this.spec() this.spec()
.must(() -> this.isValidGuid(item.getDescriptionTemplateGroupId())) .must(() -> this.isValidGuid(item.getDescriptionTemplateGroupId()))
.failOn(DescriptionTemplatePersist._descriptionTemplateGroupId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._descriptionTemplateGroupId}, LocaleContextHolder.getLocale())), .failOn(DescriptionTemplatePersist._descriptionTemplateGroupId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplatePersist._descriptionTemplateGroupId}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(() -> !this.isNull(item.getMinMultiplicity())) .iff(() -> !this.isNull(item.getMinMultiplicity()))
.must(() -> item.getMinMultiplicity() >= 0) .must(() -> item.getMinMultiplicity() >= 0)
.failOn(DescriptionTemplatePersist._minMultiplicity).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{DescriptionTemplatePersist._minMultiplicity}, LocaleContextHolder.getLocale())), .failOn(DescriptionTemplatePersist._minMultiplicity).failWith(this.messageSource.getMessage("Validation_UnexpectedValue", new Object[]{DescriptionTemplatePersist._minMultiplicity}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.iff(() -> !this.isNull(item.getMaxMultiplicity())) .iff(() -> !this.isNull(item.getMaxMultiplicity()))
.must(() -> item.getMaxMultiplicity() > 0) .must(() -> item.getMaxMultiplicity() > 0)
.failOn(DescriptionTemplatePersist._maxMultiplicity).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{DescriptionTemplatePersist._maxMultiplicity}, LocaleContextHolder.getLocale())) .failOn(DescriptionTemplatePersist._maxMultiplicity).failWith(this.messageSource.getMessage("Validation_UnexpectedValue", new Object[]{DescriptionTemplatePersist._maxMultiplicity}, LocaleContextHolder.getLocale()))
); );
} }
} }

View File

@ -1,7 +1,7 @@
package org.opencdmp.model.persist.dmpblueprintdefinition; package org.opencdmp.model.persist.planblueprintdefinition;
import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType;
import gr.cite.tools.validation.specification.Specification; import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -20,7 +20,7 @@ public class ExtraFieldPersist extends FieldPersist {
public static final String _dataType = "dataType"; public static final String _dataType = "dataType";
public PlanBlueprintExtraFieldDataType getDataType() { public PlanBlueprintExtraFieldDataType getDataType() {
return dataType; return this.dataType;
} }
public void setDataType(PlanBlueprintExtraFieldDataType dataType) { public void setDataType(PlanBlueprintExtraFieldDataType dataType) {
@ -44,14 +44,14 @@ public class ExtraFieldPersist extends FieldPersist {
@Override @Override
protected List<Specification> specifications(ExtraFieldPersist item) { protected List<Specification> specifications(ExtraFieldPersist item) {
List<Specification> specifications = getBaseSpecifications(item); List<Specification> specifications = this.getBaseSpecifications(item);
specifications.addAll(Arrays.asList( specifications.addAll(Arrays.asList(
this.spec() this.spec()
.must(() -> !this.isEmpty(item.getLabel())) .must(() -> !this.isEmpty(item.getLabel()))
.failOn(FieldPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._label}, LocaleContextHolder.getLocale())), .failOn(FieldPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._label}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getDataType())) .must(() -> !this.isNull(item.getDataType()))
.failOn(ExtraFieldPersist._dataType).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExtraFieldPersist._dataType}, LocaleContextHolder.getLocale())) .failOn(ExtraFieldPersist._dataType).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{ExtraFieldPersist._dataType}, LocaleContextHolder.getLocale()))
)); ));
return specifications; return specifications;
} }

View File

@ -1,10 +1,10 @@
package org.opencdmp.model.persist.dmpblueprintdefinition; package org.opencdmp.model.persist.planblueprintdefinition;
import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.commons.enums.PlanBlueprintFieldCategory; import org.opencdmp.commons.enums.PlanBlueprintFieldCategory;
import org.opencdmp.commons.validation.BaseValidator; import org.opencdmp.commons.validation.BaseValidator;
import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
@ -27,7 +27,7 @@ import java.util.UUID;
}) })
public abstract class FieldPersist { public abstract class FieldPersist {
private UUID id = null; private UUID id;
public static final String _id = "id"; public static final String _id = "id";
@ -35,29 +35,29 @@ public abstract class FieldPersist {
public static final String _category = "category"; public static final String _category = "category";
private String label = null; private String label;
public static final String _label = "label"; public static final String _label = "label";
private String placeholder = null; private String placeholder;
public static final String _placeholder = "placeholder"; public static final String _placeholder = "placeholder";
private String description; private String description;
private List<String> semantics = null; private List<String> semantics;
public final static String _semantics = "semantics"; public final static String _semantics = "semantics";
private Integer ordinal = null; private Integer ordinal;
public static final String _ordinal = "ordinal"; public static final String _ordinal = "ordinal";
private Boolean required = null; private Boolean required;
public static final String _required = "required"; public static final String _required = "required";
public UUID getId() { public UUID getId() {
return id; return this.id;
} }
public void setId(UUID id) { public void setId(UUID id) {
@ -65,7 +65,7 @@ public abstract class FieldPersist {
} }
public PlanBlueprintFieldCategory getCategory() { public PlanBlueprintFieldCategory getCategory() {
return category; return this.category;
} }
public void setCategory(PlanBlueprintFieldCategory category) { public void setCategory(PlanBlueprintFieldCategory category) {
@ -73,7 +73,7 @@ public abstract class FieldPersist {
} }
public String getLabel() { public String getLabel() {
return label; return this.label;
} }
public void setLabel(String label) { public void setLabel(String label) {
@ -81,7 +81,7 @@ public abstract class FieldPersist {
} }
public String getPlaceholder() { public String getPlaceholder() {
return placeholder; return this.placeholder;
} }
public void setPlaceholder(String placeholder) { public void setPlaceholder(String placeholder) {
@ -89,7 +89,7 @@ public abstract class FieldPersist {
} }
public List<String> getSemantics() { public List<String> getSemantics() {
return semantics; return this.semantics;
} }
public void setSemantics(List<String> semantics) { public void setSemantics(List<String> semantics) {
@ -97,7 +97,7 @@ public abstract class FieldPersist {
} }
public String getDescription() { public String getDescription() {
return description; return this.description;
} }
public void setDescription(String description) { public void setDescription(String description) {
@ -105,7 +105,7 @@ public abstract class FieldPersist {
} }
public Integer getOrdinal() { public Integer getOrdinal() {
return ordinal; return this.ordinal;
} }
public void setOrdinal(Integer ordinal) { public void setOrdinal(Integer ordinal) {
@ -113,7 +113,7 @@ public abstract class FieldPersist {
} }
public Boolean getRequired() { public Boolean getRequired() {
return required; return this.required;
} }
public void setRequired(Boolean required) { public void setRequired(Boolean required) {
@ -134,16 +134,16 @@ public abstract class FieldPersist {
specifications.addAll( Arrays.asList( specifications.addAll( Arrays.asList(
this.spec() this.spec()
.must(() -> this.isValidGuid(item.getId())) .must(() -> this.isValidGuid(item.getId()))
.failOn(FieldPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._id}, LocaleContextHolder.getLocale())), .failOn(FieldPersist._id).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._id}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getCategory())) .must(() -> !this.isNull(item.getCategory()))
.failOn(FieldPersist._category).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._category}, LocaleContextHolder.getLocale())), .failOn(FieldPersist._category).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._category}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getOrdinal())) .must(() -> !this.isNull(item.getOrdinal()))
.failOn(FieldPersist._ordinal).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._ordinal}, LocaleContextHolder.getLocale())), .failOn(FieldPersist._ordinal).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._ordinal}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getRequired())) .must(() -> !this.isNull(item.getRequired()))
.failOn(FieldPersist._required).failWith(messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._required}, LocaleContextHolder.getLocale())) .failOn(FieldPersist._required).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{FieldPersist._required}, LocaleContextHolder.getLocale()))
)); ));
return specifications; return specifications;
} }

View File

@ -1,8 +1,8 @@
package org.opencdmp.model.persist.dmpblueprintdefinition; package org.opencdmp.model.persist.planblueprintdefinition;
import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import gr.cite.tools.validation.specification.Specification;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
@ -25,7 +25,7 @@ public class ReferenceTypeFieldPersist extends FieldPersist {
public UUID getReferenceTypeId() { public UUID getReferenceTypeId() {
return referenceTypeId; return this.referenceTypeId;
} }
public void setReferenceTypeId(UUID referenceTypeId) { public void setReferenceTypeId(UUID referenceTypeId) {
@ -33,7 +33,7 @@ public class ReferenceTypeFieldPersist extends FieldPersist {
} }
public Boolean getMultipleSelect() { public Boolean getMultipleSelect() {
return multipleSelect; return this.multipleSelect;
} }
public void setMultipleSelect(Boolean multipleSelect) { public void setMultipleSelect(Boolean multipleSelect) {
@ -57,14 +57,14 @@ public class ReferenceTypeFieldPersist extends FieldPersist {
@Override @Override
protected List<Specification> specifications(ReferenceTypeFieldPersist item) { protected List<Specification> specifications(ReferenceTypeFieldPersist item) {
List<Specification> specifications = getBaseSpecifications(item); List<Specification> specifications = this.getBaseSpecifications(item);
specifications.addAll(Arrays.asList( specifications.addAll(Arrays.asList(
this.spec() this.spec()
.must(() -> !this.isNull(item.getReferenceTypeId())) .must(() -> !this.isNull(item.getReferenceTypeId()))
.failOn(ReferenceTypeFieldPersist._referenceTypeId).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeFieldPersist._referenceTypeId}, LocaleContextHolder.getLocale())), .failOn(ReferenceTypeFieldPersist._referenceTypeId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeFieldPersist._referenceTypeId}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getMultipleSelect())) .must(() -> !this.isNull(item.getMultipleSelect()))
.failOn(ReferenceTypeFieldPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeFieldPersist._multipleSelect}, LocaleContextHolder.getLocale()))) .failOn(ReferenceTypeFieldPersist._multipleSelect).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{ReferenceTypeFieldPersist._multipleSelect}, LocaleContextHolder.getLocale())))
); );
return specifications; return specifications;

View File

@ -1,9 +1,9 @@
package org.opencdmp.model.persist.dmpblueprintdefinition; package org.opencdmp.model.persist.planblueprintdefinition;
import org.opencdmp.commons.validation.BaseValidator;
import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.validation.ValidatorFactory; import gr.cite.tools.validation.ValidatorFactory;
import gr.cite.tools.validation.specification.Specification; import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.commons.validation.BaseValidator;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -19,38 +19,38 @@ import java.util.stream.Collectors;
public class SectionPersist { public class SectionPersist {
private UUID id = null; private UUID id;
public static final String _id = "id"; public static final String _id = "id";
private String description; private String description;
private String label = null; private String label;
public static final String _label = "label"; public static final String _label = "label";
private Integer ordinal = null; private Integer ordinal;
public static final String _ordinal = "ordinal"; public static final String _ordinal = "ordinal";
private Boolean hasTemplates = null; private Boolean hasTemplates;
public static final String _hasTemplates = "hasTemplates"; public static final String _hasTemplates = "hasTemplates";
private List<FieldPersist> fields = null; private List<FieldPersist> fields;
public static final String _fields = "fields"; public static final String _fields = "fields";
private List<DescriptionTemplatePersist> descriptionTemplates = null; private List<DescriptionTemplatePersist> descriptionTemplates;
public static final String _descriptionTemplates = "descriptionTemplates"; public static final String _descriptionTemplates = "descriptionTemplates";
private List<UUID> prefillingSourcesIds= null; private List<UUID> prefillingSourcesIds;
public static final String _prefillingSourcesIds = "prefillingSourcesIds"; public static final String _prefillingSourcesIds = "prefillingSourcesIds";
public UUID getId() { public UUID getId() {
return id; return this.id;
} }
public void setId(UUID id) { public void setId(UUID id) {
@ -58,7 +58,7 @@ public class SectionPersist {
} }
public String getLabel() { public String getLabel() {
return label; return this.label;
} }
public void setLabel(String label) { public void setLabel(String label) {
@ -66,7 +66,7 @@ public class SectionPersist {
} }
public String getDescription() { public String getDescription() {
return description; return this.description;
} }
public void setDescription(String description) { public void setDescription(String description) {
@ -74,7 +74,7 @@ public class SectionPersist {
} }
public Integer getOrdinal() { public Integer getOrdinal() {
return ordinal; return this.ordinal;
} }
public void setOrdinal(Integer ordinal) { public void setOrdinal(Integer ordinal) {
@ -82,7 +82,7 @@ public class SectionPersist {
} }
public Boolean getHasTemplates() { public Boolean getHasTemplates() {
return hasTemplates; return this.hasTemplates;
} }
public void setHasTemplates(Boolean hasTemplates) { public void setHasTemplates(Boolean hasTemplates) {
@ -90,7 +90,7 @@ public class SectionPersist {
} }
public List<FieldPersist> getFields() { public List<FieldPersist> getFields() {
return fields; return this.fields;
} }
public void setFields(List<FieldPersist> fields) { public void setFields(List<FieldPersist> fields) {
@ -98,7 +98,7 @@ public class SectionPersist {
} }
public List<DescriptionTemplatePersist> getDescriptionTemplates() { public List<DescriptionTemplatePersist> getDescriptionTemplates() {
return descriptionTemplates; return this.descriptionTemplates;
} }
public void setDescriptionTemplates(List<DescriptionTemplatePersist> descriptionTemplates) { public void setDescriptionTemplates(List<DescriptionTemplatePersist> descriptionTemplates) {
@ -106,7 +106,7 @@ public class SectionPersist {
} }
public List<UUID> getPrefillingSourcesIds() { public List<UUID> getPrefillingSourcesIds() {
return prefillingSourcesIds; return this.prefillingSourcesIds;
} }
public void setPrefillingSourcesIds(List<UUID> prefillingSourcesIds) { public void setPrefillingSourcesIds(List<UUID> prefillingSourcesIds) {
@ -139,16 +139,16 @@ public class SectionPersist {
return Arrays.asList( return Arrays.asList(
this.spec() this.spec()
.must(() -> this.isValidGuid(item.getId())) .must(() -> this.isValidGuid(item.getId()))
.failOn(SectionPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._id}, LocaleContextHolder.getLocale())), .failOn(SectionPersist._id).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._id}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isEmpty(item.getLabel())) .must(() -> !this.isEmpty(item.getLabel()))
.failOn(SectionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._label}, LocaleContextHolder.getLocale())), .failOn(SectionPersist._label).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._label}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getOrdinal())) .must(() -> !this.isNull(item.getOrdinal()))
.failOn(SectionPersist._ordinal).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._ordinal}, LocaleContextHolder.getLocale())), .failOn(SectionPersist._ordinal).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._ordinal}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isNull(item.getHasTemplates())) .must(() -> !this.isNull(item.getHasTemplates()))
.failOn(SectionPersist._hasTemplates).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._hasTemplates}, LocaleContextHolder.getLocale())), .failOn(SectionPersist._hasTemplates).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._hasTemplates}, LocaleContextHolder.getLocale())),
this.navSpec() this.navSpec()
.iff(() -> !this.isListNullOrEmpty(item.getFields())) .iff(() -> !this.isListNullOrEmpty(item.getFields()))
.on(SectionPersist._fields) .on(SectionPersist._fields)
@ -175,7 +175,7 @@ public class SectionPersist {
this.spec() this.spec()
.iff(() -> !this.isListNullOrEmpty(item.getDescriptionTemplates())) .iff(() -> !this.isListNullOrEmpty(item.getDescriptionTemplates()))
.must(() -> item.getDescriptionTemplates().stream().map(DescriptionTemplatePersist::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()).size() == item.getDescriptionTemplates().size()) .must(() -> item.getDescriptionTemplates().stream().map(DescriptionTemplatePersist::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()).size() == item.getDescriptionTemplates().size())
.failOn(SectionPersist._descriptionTemplates).failWith(messageSource.getMessage("Validation_Unique", new Object[]{SectionPersist._descriptionTemplates}, LocaleContextHolder.getLocale())) .failOn(SectionPersist._descriptionTemplates).failWith(this.messageSource.getMessage("Validation_Unique", new Object[]{SectionPersist._descriptionTemplates}, LocaleContextHolder.getLocale()))
); );
} }

View File

@ -1,7 +1,7 @@
package org.opencdmp.model.persist.dmpblueprintdefinition; package org.opencdmp.model.persist.planblueprintdefinition;
import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType;
import gr.cite.tools.validation.specification.Specification; import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType;
import org.opencdmp.convention.ConventionService; import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties; import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -19,7 +19,7 @@ public class SystemFieldPersist extends FieldPersist {
public static final String _systemFieldType = "systemFieldType"; public static final String _systemFieldType = "systemFieldType";
public PlanBlueprintSystemFieldType getSystemFieldType() { public PlanBlueprintSystemFieldType getSystemFieldType() {
return systemFieldType; return this.systemFieldType;
} }
public void setSystemFieldType(PlanBlueprintSystemFieldType systemFieldType) { public void setSystemFieldType(PlanBlueprintSystemFieldType systemFieldType) {
@ -43,11 +43,11 @@ public class SystemFieldPersist extends FieldPersist {
@Override @Override
protected List<Specification> specifications(SystemFieldPersist item) { protected List<Specification> specifications(SystemFieldPersist item) {
List<Specification> specifications = getBaseSpecifications(item); List<Specification> specifications = this.getBaseSpecifications(item);
specifications.add( specifications.add(
this.spec() this.spec()
.must(() -> !this.isNull(item.getSystemFieldType())) .must(() -> !this.isNull(item.getSystemFieldType()))
.failOn(SystemFieldPersist._systemFieldType).failWith(messageSource.getMessage("Validation_Required", new Object[]{SystemFieldPersist._systemFieldType}, LocaleContextHolder.getLocale())) .failOn(SystemFieldPersist._systemFieldType).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{SystemFieldPersist._systemFieldType}, LocaleContextHolder.getLocale()))
); );
return specifications; return specifications;
} }

View File

@ -33,13 +33,13 @@ import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.model.builder.planblueprint.PlanBlueprintBuilder; import org.opencdmp.model.builder.planblueprint.PlanBlueprintBuilder;
import org.opencdmp.model.deleter.PlanBlueprintDeleter; import org.opencdmp.model.deleter.PlanBlueprintDeleter;
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate; import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
import org.opencdmp.model.planblueprint.Definition;
import org.opencdmp.model.planblueprint.PlanBlueprint;
import org.opencdmp.model.planblueprint.Field;
import org.opencdmp.model.planblueprint.Section;
import org.opencdmp.model.persist.PlanBlueprintPersist;
import org.opencdmp.model.persist.NewVersionPlanBlueprintPersist; import org.opencdmp.model.persist.NewVersionPlanBlueprintPersist;
import org.opencdmp.model.persist.dmpblueprintdefinition.*; import org.opencdmp.model.persist.PlanBlueprintPersist;
import org.opencdmp.model.persist.planblueprintdefinition.*;
import org.opencdmp.model.planblueprint.Definition;
import org.opencdmp.model.planblueprint.Field;
import org.opencdmp.model.planblueprint.PlanBlueprint;
import org.opencdmp.model.planblueprint.Section;
import org.opencdmp.model.prefillingsource.PrefillingSource; import org.opencdmp.model.prefillingsource.PrefillingSource;
import org.opencdmp.model.referencetype.ReferenceType; import org.opencdmp.model.referencetype.ReferenceType;
import org.opencdmp.query.DescriptionTemplateQuery; import org.opencdmp.query.DescriptionTemplateQuery;

View File

@ -146,15 +146,11 @@ public class PlanController {
} }
@PostMapping("query") @PostMapping("query")
@OperationWithTenantHeader(summary = "Query all plans", description = SwaggerHelpers.Plan.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Plan.endpoint_query_request_body, content = @Content( @OperationWithTenantHeader(summary = "Query all plans", description = SwaggerHelpers.Plan.endpoint_query, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(description = SwaggerHelpers.Plan.endpoint_query_request_body, content = @Content(examples = @ExampleObject(
examples = { name = "Pagination and projection",
@ExampleObject( description = "Simple paginated request using a property projection list and pagination info",
name = "Pagination and projection", value = SwaggerHelpers.Plan.endpoint_query_request_body_example
description = "Simple paginated request using a property projection list and pagination info", ))), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content(
value = SwaggerHelpers.Plan.endpoint_query_request_body_example
)
}
)), responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content(
array = @ArraySchema( array = @ArraySchema(
schema = @Schema( schema = @Schema(
implementation = Plan.class implementation = Plan.class