remove section default visibility

This commit is contained in:
Efstratios Giannopoulos 2024-05-02 17:52:10 +03:00
parent 8426d49157
commit 6928b436ee
15 changed files with 53 additions and 119 deletions

View File

@ -11,8 +11,6 @@ public class SectionEntity{
private String id;
@XmlAttribute(name="ordinal")
private int ordinal;
@XmlAttribute(name="defaultVisibility")
private boolean defaultVisibility;
@XmlAttribute(name="numbering")
private String numbering;
@XmlAttribute(name="title")
@ -30,7 +28,7 @@ public class SectionEntity{
private List<FieldSetEntity> fieldSets;
public String getId() {
return id;
return this.id;
}
public void setId(String id) {
@ -38,23 +36,15 @@ public class SectionEntity{
}
public int getOrdinal() {
return ordinal;
return this.ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public boolean isDefaultVisibility() {
return defaultVisibility;
}
public void setDefaultVisibility(boolean defaultVisibility) {
this.defaultVisibility = defaultVisibility;
}
public String getTitle() {
return title;
return this.title;
}
public void setTitle(String title) {
@ -62,7 +52,7 @@ public class SectionEntity{
}
public String getDescription() {
return description;
return this.description;
}
public void setDescription(String description) {
@ -70,7 +60,7 @@ public class SectionEntity{
}
public List<SectionEntity> getSections() {
return sections;
return this.sections;
}
public void setSections(List<SectionEntity> sections) {
@ -78,7 +68,7 @@ public class SectionEntity{
}
public List<FieldSetEntity> getFieldSets() {
return fieldSets;
return this.fieldSets;
}
public void setFieldSets(List<FieldSetEntity> fieldSetEntities) {
@ -86,7 +76,7 @@ public class SectionEntity{
}
public String getExtendedDescription() {
return extendedDescription;
return this.extendedDescription;
}
public void setExtendedDescription(String extendedDescription) {
@ -94,7 +84,7 @@ public class SectionEntity{
}
public String getNumbering() {
return numbering;
return this.numbering;
}
public void setNumbering(String numbering) {

View File

@ -10,8 +10,6 @@ public class DescriptionTemplateSectionImportExport {
private String id;
@XmlAttribute(name = "ordinal")
private int ordinal;
@XmlAttribute(name = "defaultVisibility")
private Boolean defaultVisibility;
@XmlElementWrapper(name = "fieldSets")
@XmlElement(name = "fieldSet")
private List<DescriptionTemplateFieldSetImportExport> fieldSets;
@ -28,7 +26,7 @@ public class DescriptionTemplateSectionImportExport {
private Boolean multiplicity;
public String getId() {
return id;
return this.id;
}
public void setId(String id) {
@ -36,23 +34,15 @@ public class DescriptionTemplateSectionImportExport {
}
public int getOrdinal() {
return ordinal;
return this.ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public Boolean getDefaultVisibility() {
return defaultVisibility;
}
public void setDefaultVisibility(Boolean defaultVisibility) {
this.defaultVisibility = defaultVisibility;
}
public List<DescriptionTemplateFieldSetImportExport> getFieldSets() {
return fieldSets;
return this.fieldSets;
}
public void setFieldSets(List<DescriptionTemplateFieldSetImportExport> fieldSets) {
@ -60,7 +50,7 @@ public class DescriptionTemplateSectionImportExport {
}
public String getNumbering() {
return numbering;
return this.numbering;
}
public void setNumbering(String numbering) {
@ -68,7 +58,7 @@ public class DescriptionTemplateSectionImportExport {
}
public String getDescription() {
return description;
return this.description;
}
public void setDescription(String description) {
@ -76,7 +66,7 @@ public class DescriptionTemplateSectionImportExport {
}
public String getTitle() {
return title;
return this.title;
}
public void setTitle(String title) {
@ -84,7 +74,7 @@ public class DescriptionTemplateSectionImportExport {
}
public List<DescriptionTemplateSectionImportExport> getSections() {
return sections;
return this.sections;
}
public void setSections(List<DescriptionTemplateSectionImportExport> sections) {
@ -92,7 +82,7 @@ public class DescriptionTemplateSectionImportExport {
}
public Boolean getMultiplicity() {
return multiplicity;
return this.multiplicity;
}
public void setMultiplicity(Boolean multiplicity) {

View File

@ -1,17 +1,14 @@
package org.opencdmp.model.builder.commonmodels.descriptiontemplate;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.opencdmp.authorization.AuthorizationFlags;
import org.opencdmp.commonmodels.models.descriptiotemplate.SectionModel;
import org.opencdmp.commons.types.descriptiontemplate.SectionEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
import org.opencdmp.model.builder.commonmodels.CommonModelBuilderItemResponse;
import org.opencdmp.model.builder.descriptiontemplatedefinition.FieldSetBuilder;
import org.opencdmp.model.builder.descriptiontemplatedefinition.SectionBuilder;
import org.opencdmp.model.descriptiontemplatedefinition.Section;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -24,7 +21,7 @@ import java.util.List;
import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class SectionCommonModelBuilder extends BaseCommonModelBuilder<SectionModel, SectionEntity> {
private final BuilderFactory builderFactory;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@ -52,7 +49,6 @@ public class SectionCommonModelBuilder extends BaseCommonModelBuilder<SectionMod
m.setId(d.getId());
m.setDescription(d.getDescription());
m.setOrdinal(d.getOrdinal());
m.setDefaultVisibility(d.isDefaultVisibility());
m.setNumbering(d.getNumbering());
m.setTitle(d.getTitle());
m.setExtendedDescription(d.getExtendedDescription());

View File

@ -1,15 +1,15 @@
package org.opencdmp.model.builder.descriptiontemplatedefinition;
import org.opencdmp.authorization.AuthorizationFlags;
import org.opencdmp.commons.types.descriptiontemplate.SectionEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.model.builder.BaseBuilder;
import org.opencdmp.model.descriptiontemplatedefinition.Section;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.DataLogEntry;
import gr.cite.tools.logging.LoggerService;
import org.opencdmp.authorization.AuthorizationFlags;
import org.opencdmp.commons.types.descriptiontemplate.SectionEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.model.builder.BaseBuilder;
import org.opencdmp.model.descriptiontemplatedefinition.Section;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -19,7 +19,7 @@ import org.springframework.stereotype.Component;
import java.util.*;
@Component("descriptiontemplatedefinitionsectionbuilder")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
private final BuilderFactory builderFactory;
@ -53,7 +53,6 @@ public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
if (fields.hasField(this.asIndexer(Section._id))) m.setId(d.getId());
if (fields.hasField(this.asIndexer(Section._description))) m.setDescription(d.getDescription());
if (fields.hasField(this.asIndexer(Section._ordinal))) m.setOrdinal(d.getOrdinal());
if (fields.hasField(this.asIndexer(Section._defaultVisibility))) m.setDefaultVisibility(d.isDefaultVisibility());
if (fields.hasField(this.asIndexer(Section._numbering))) m.setNumbering(d.getNumbering());
if (fields.hasField(this.asIndexer(Section._title))) m.setTitle(d.getTitle());
if (fields.hasField(this.asIndexer(Section._extendedDescription))) m.setExtendedDescription(d.getExtendedDescription());

View File

@ -11,9 +11,6 @@ public class Section {
public final static String _ordinal = "ordinal";
private Integer ordinal;
public final static String _defaultVisibility = "defaultVisibility";
private Boolean defaultVisibility;
public final static String _numbering = "numbering";
private String numbering; //TODO maybe remove
@ -33,7 +30,7 @@ public class Section {
private List<FieldSet> fieldSets;
public String getId() {
return id;
return this.id;
}
public void setId(String id) {
@ -41,23 +38,15 @@ public class Section {
}
public int getOrdinal() {
return ordinal;
return this.ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public Boolean getDefaultVisibility() {
return defaultVisibility;
}
public void setDefaultVisibility(Boolean defaultVisibility) {
this.defaultVisibility = defaultVisibility;
}
public String getNumbering() {
return numbering;
return this.numbering;
}
public void setNumbering(String numbering) {
@ -65,7 +54,7 @@ public class Section {
}
public String getTitle() {
return title;
return this.title;
}
public void setTitle(String title) {
@ -73,7 +62,7 @@ public class Section {
}
public String getDescription() {
return description;
return this.description;
}
public void setDescription(String description) {
@ -81,7 +70,7 @@ public class Section {
}
public String getExtendedDescription() {
return extendedDescription;
return this.extendedDescription;
}
public void setExtendedDescription(String extendedDescription) {
@ -89,7 +78,7 @@ public class Section {
}
public List<Section> getSections() {
return sections;
return this.sections;
}
public void setSections(List<Section> sections) {
@ -97,7 +86,7 @@ public class Section {
}
public List<FieldSet> getFieldSets() {
return fieldSets;
return this.fieldSets;
}
public void setFieldSets(List<FieldSet> fieldSets) {

View File

@ -19,10 +19,9 @@ public class DescriptionSectionToDatasetSectionMapper {
model.setOrdinal(section.getOrdinal());
model.setTitle(section.getTitle());
model.setSections(section.getSections().stream().map(x-> this.toPublicModel(x, page)).toList());
model.setDefaultVisibility(section.getDefaultVisibility());
model.setNumbering(section.getNumbering());
model.setPage("page_" + page);
model.setCompositeFields(section.getFieldSets().stream().map(descriptionFieldSetToDatasetFieldSetMapper::toPublicModel).toList());
model.setCompositeFields(section.getFieldSets().stream().map(this.descriptionFieldSetToDatasetFieldSetMapper::toPublicModel).toList());
return model;
}
}

View File

@ -1,8 +1,8 @@
package org.opencdmp.model.persist.descriptiontemplatedefinition;
import org.opencdmp.commons.validation.BaseValidator;
import gr.cite.tools.validation.ValidatorFactory;
import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.commons.validation.BaseValidator;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -16,36 +16,32 @@ import java.util.List;
public class SectionPersist {
private String id = null;
private String id;
public static final String _id = "id";
private Integer ordinal = null;
private Integer ordinal;
public static final String _ordinal = "ordinal";
private Boolean defaultVisibility = null;
public static final String _defaultVisibility = "defaultVisibility";
private String title = null;
private String title;
public static final String _title = "title";
private String description = null;
private String description;
public static final String _description = "description";
private List<SectionPersist> sections = null;
private List<SectionPersist> sections;
public static final String _sections = "sections";
private List<FieldSetPersist> fieldSets = null;
private List<FieldSetPersist> fieldSets;
public static final String _fieldSets = "fieldSets";
public String getId() {
return id;
return this.id;
}
public void setId(String id) {
@ -53,24 +49,15 @@ public class SectionPersist {
}
public int getOrdinal() {
return ordinal;
return this.ordinal;
}
public void setOrdinal(int ordinal) {
this.ordinal = ordinal;
}
public Boolean getDefaultVisibility() {
return defaultVisibility;
}
public void setDefaultVisibility(Boolean defaultVisibility) {
this.defaultVisibility = defaultVisibility;
}
public String getTitle() {
return title;
return this.title;
}
public void setTitle(String title) {
@ -78,7 +65,7 @@ public class SectionPersist {
}
public String getDescription() {
return description;
return this.description;
}
public void setDescription(String description) {
@ -86,7 +73,7 @@ public class SectionPersist {
}
public List<SectionPersist> getSections() {
return sections;
return this.sections;
}
public void setSections(List<SectionPersist> sections) {
@ -94,7 +81,7 @@ public class SectionPersist {
}
public List<FieldSetPersist> getFieldSets() {
return fieldSets;
return this.fieldSets;
}
public void setFieldSets(List<FieldSetPersist> fieldSets) {
@ -127,16 +114,13 @@ public class SectionPersist {
return Arrays.asList(
this.spec()
.must(() -> !this.isEmpty(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()
.must(() -> !this.isNull(item.getOrdinal()))
.failOn(SectionPersist._ordinal).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._ordinal}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isNull(item.getDefaultVisibility()))
.failOn(SectionPersist._defaultVisibility).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._defaultVisibility}, LocaleContextHolder.getLocale())),
.failOn(SectionPersist._ordinal).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._ordinal}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getTitle()))
.failOn(SectionPersist._title).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._title}, LocaleContextHolder.getLocale())),
.failOn(SectionPersist._title).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._title}, LocaleContextHolder.getLocale())),
this.navSpec()
.iff(() -> !this.isListNullOrEmpty(item.getSections()))
.on(SectionPersist._sections)
@ -149,7 +133,7 @@ public class SectionPersist {
.using((itm) -> this.validatorFactory.validator(FieldSetPersist.FieldSetPersistValidator.class)),
this.spec()
.must(() -> !this.isListNullOrEmpty(item.getFieldSets()) || !this.isListNullOrEmpty(item.getSections()))
.failOn(SectionPersist._fieldSets).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._fieldSets}, LocaleContextHolder.getLocale()))
.failOn(SectionPersist._fieldSets).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._fieldSets}, LocaleContextHolder.getLocale()))
);
}
}

View File

@ -308,7 +308,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
data.setId(persist.getId());
data.setDescription(persist.getDescription());
data.setOrdinal(persist.getOrdinal());
data.setDefaultVisibility(persist.getDefaultVisibility());
data.setTitle(persist.getTitle());
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {
@ -816,7 +815,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
sectionEntity.setFieldSets(fieldSetEntity);
sectionEntity.setSections(sectionsListEntity);
sectionEntity.setDefaultVisibility(importExport.getDefaultVisibility());
return sectionEntity;
}
@ -977,7 +975,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
}
xml.setFieldSets(fieldSetEntity);
xml.setDefaultVisibility(entity.isDefaultVisibility());
return xml;
}

View File

@ -48,7 +48,6 @@ export interface DescriptionTemplatePagePersist {
export interface DescriptionTemplateSectionPersist {
id: string;
ordinal: number;
defaultVisibility: boolean;
title: string;
description: string;

View File

@ -46,7 +46,6 @@ export interface DescriptionTemplatePage {
export interface DescriptionTemplateSection {
id?: string;
ordinal?: number;
defaultVisibility?: boolean;
title?: string;
description?: string;
sections?: DescriptionTemplateSection[];

View File

@ -89,7 +89,6 @@ export class FinalPreviewComponent implements OnInit {
return {
id: persist.id,
ordinal: persist.ordinal,
defaultVisibility: persist.defaultVisibility,
title: persist.title,
description: persist.description,
sections: persist.sections.map(x => this.buildDescriptionTemplateSection(x)),

View File

@ -360,7 +360,6 @@ export class DescriptionTemplatePageEditorModel implements DescriptionTemplatePa
export class DescriptionTemplateSectionEditorModel implements DescriptionTemplateSectionPersist {
id: string;
ordinal: number;
defaultVisibility: boolean = false; // TODO: check if used and remove
title: string;
description: string;
sections: DescriptionTemplateSectionEditorModel[] = [];
@ -376,7 +375,6 @@ export class DescriptionTemplateSectionEditorModel implements DescriptionTemplat
if (item) {
this.id = item.id;
this.ordinal = item.ordinal;
this.defaultVisibility = item.defaultVisibility;
this.title = item.title;
this.description = item.description;
if (item.sections) { item.sections.map(x => this.sections.push(new DescriptionTemplateSectionEditorModel(this.validationErrorModel).fromModel(x))); }
@ -401,7 +399,6 @@ export class DescriptionTemplateSectionEditorModel implements DescriptionTemplat
const formGroup= this.formBuilder.group({
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
ordinal: [{ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal').validators],
defaultVisibility: [{ value: this.defaultVisibility, disabled: disabled }, context.getValidation('defaultVisibility').validators],
title: [{ value: this.title, disabled: disabled }, context.getValidation('title').validators],
description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
sections: this.formBuilder.array(
@ -435,7 +432,6 @@ export class DescriptionTemplateSectionEditorModel implements DescriptionTemplat
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}id`)] });
baseValidationArray.push({ key: 'ordinal', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}ordinal`)] });
baseValidationArray.push({ key: 'defaultVisibility', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}defaultVisibility`)] });
baseValidationArray.push({ key: 'title', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}title`)] });
baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}description`)] });
baseValidationArray.push({ key: 'sections', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sections`)] });
@ -457,7 +453,7 @@ export class DescriptionTemplateSectionEditorModel implements DescriptionTemplat
validationErrorModel
});
['id', 'ordinal', 'defaultVisibility', 'page', 'title', 'description'].forEach(keyField => {
['id', 'ordinal', 'page', 'title', 'description'].forEach(keyField => {
const control = formGroup?.get(keyField);
control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators);

View File

@ -38,7 +38,6 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver {
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.id)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.ordinal)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.defaultVisibility)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.title)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.description)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.ordinal)].join('.'),

View File

@ -108,7 +108,6 @@ public class DescriptionTemplateXmlCleanInvalidReferenceTypesService {
data.setExtendedDescription(persist.getExtendedDescription());
data.setNumbering(persist.getNumbering());
data.setOrdinal(persist.getOrdinal());
data.setDefaultVisibility(persist.isDefaultVisibility());
data.setTitle(persist.getTitle());
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {

View File

@ -145,7 +145,6 @@ public class DescriptionTemplateXmlMigrationService {
data.setExtendedDescription(persist.getExtendedDescription());
data.setNumbering(persist.getNumbering());
data.setOrdinal(persist.getOrdinal());
data.setDefaultVisibility(persist.isDefaultVisibility());
data.setTitle(persist.getTitle());
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {