fieldset comment change implementation model
This commit is contained in:
parent
287f284d2d
commit
7e283e5aab
|
@ -57,12 +57,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.opencdmp</groupId>
|
<groupId>org.opencdmp</groupId>
|
||||||
<artifactId>repositorydepositbase</artifactId>
|
<artifactId>repositorydepositbase</artifactId>
|
||||||
<version>2.0.16</version>
|
<version>1.0.0-dev</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.opencdmp</groupId>
|
<groupId>org.opencdmp</groupId>
|
||||||
<artifactId>common-models</artifactId>
|
<artifactId>common-models</artifactId>
|
||||||
<version>0.0.19</version>
|
<version>1.0.0-dev</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>gr.cite</groupId>
|
<groupId>gr.cite</groupId>
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.opencdmp</groupId>
|
<groupId>org.opencdmp</groupId>
|
||||||
<artifactId>file-transformer-base</artifactId>
|
<artifactId>file-transformer-base</artifactId>
|
||||||
<version>0.0.24</version>
|
<version>1.0.0-dev</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>gr.cite</groupId>
|
<groupId>gr.cite</groupId>
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.util.List;
|
||||||
public class PropertyDefinitionFieldSetEntity {
|
public class PropertyDefinitionFieldSetEntity {
|
||||||
private List<PropertyDefinitionFieldSetItemEntity> items;
|
private List<PropertyDefinitionFieldSetItemEntity> items;
|
||||||
|
|
||||||
|
private String comment;
|
||||||
|
|
||||||
public List<PropertyDefinitionFieldSetItemEntity> getItems() {
|
public List<PropertyDefinitionFieldSetItemEntity> getItems() {
|
||||||
return this.items;
|
return this.items;
|
||||||
}
|
}
|
||||||
|
@ -12,4 +14,12 @@ public class PropertyDefinitionFieldSetEntity {
|
||||||
public void setItems(List<PropertyDefinitionFieldSetItemEntity> items) {
|
public void setItems(List<PropertyDefinitionFieldSetItemEntity> items) {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,9 @@ public class DescriptionPropertyDefinitionFieldSetImportExport {
|
||||||
@XmlElement(name = "item")
|
@XmlElement(name = "item")
|
||||||
private List<DescriptionPropertyDefinitionFieldSetItemImportExport> items;
|
private List<DescriptionPropertyDefinitionFieldSetItemImportExport> items;
|
||||||
|
|
||||||
|
@XmlElement(name = "comment")
|
||||||
|
private String comment;
|
||||||
|
|
||||||
public List<DescriptionPropertyDefinitionFieldSetItemImportExport> getItems() {
|
public List<DescriptionPropertyDefinitionFieldSetItemImportExport> getItems() {
|
||||||
return this.items;
|
return this.items;
|
||||||
}
|
}
|
||||||
|
@ -31,4 +34,12 @@ public class DescriptionPropertyDefinitionFieldSetImportExport {
|
||||||
public void setFieldSetId(String fieldSetId) {
|
public void setFieldSetId(String fieldSetId) {
|
||||||
this.fieldSetId = fieldSetId;
|
this.fieldSetId = fieldSetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@ public class DescriptionPropertyDefinitionFieldSetItemImportExport {
|
||||||
@XmlElementWrapper(name = "fields")
|
@XmlElementWrapper(name = "fields")
|
||||||
@XmlElement(name = "field")
|
@XmlElement(name = "field")
|
||||||
private List<DescriptionFieldImportExport> fields;
|
private List<DescriptionFieldImportExport> fields;
|
||||||
@XmlElement(name = "comment")
|
|
||||||
private String comment;
|
|
||||||
@XmlElement(name = "ordinal")
|
@XmlElement(name = "ordinal")
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
|
|
||||||
|
@ -27,14 +25,6 @@ public class DescriptionPropertyDefinitionFieldSetItemImportExport {
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return this.comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrdinal() {
|
public int getOrdinal() {
|
||||||
return this.ordinal;
|
return this.ordinal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class PropertyDefinitionFieldSetCommonModelBuilder extends BaseCommonMode
|
||||||
List<CommonModelBuilderItemResponse<PropertyDefinitionFieldSetModel, PropertyDefinitionFieldSetEntity>> models = new ArrayList<>();
|
List<CommonModelBuilderItemResponse<PropertyDefinitionFieldSetModel, PropertyDefinitionFieldSetEntity>> models = new ArrayList<>();
|
||||||
for (PropertyDefinitionFieldSetEntity d : data) {
|
for (PropertyDefinitionFieldSetEntity d : data) {
|
||||||
PropertyDefinitionFieldSetModel m = new PropertyDefinitionFieldSetModel();
|
PropertyDefinitionFieldSetModel m = new PropertyDefinitionFieldSetModel();
|
||||||
|
m.setComment(d.getComment());
|
||||||
if (d.getItems() != null) m.setItems(this.builderFactory.builder(PropertyDefinitionFieldSetItemModelCommonModelBuilder.class).useSharedStorage(useSharedStorage).withFieldSetEntity(this.fieldSetEntity).authorize(this.authorize).build(d.getItems()));
|
if (d.getItems() != null) m.setItems(this.builderFactory.builder(PropertyDefinitionFieldSetItemModelCommonModelBuilder.class).useSharedStorage(useSharedStorage).withFieldSetEntity(this.fieldSetEntity).authorize(this.authorize).build(d.getItems()));
|
||||||
models.add(new CommonModelBuilderItemResponse<>(m, d));
|
models.add(new CommonModelBuilderItemResponse<>(m, d));
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class PropertyDefinitionFieldSetItemModelCommonModelBuilder extends BaseC
|
||||||
for (PropertyDefinitionFieldSetItemEntity d : data) {
|
for (PropertyDefinitionFieldSetItemEntity d : data) {
|
||||||
PropertyDefinitionFieldSetItemModel m = new PropertyDefinitionFieldSetItemModel();
|
PropertyDefinitionFieldSetItemModel m = new PropertyDefinitionFieldSetItemModel();
|
||||||
|
|
||||||
m.setComment(d.getComment());
|
|
||||||
m.setOrdinal(d.getOrdinal());
|
m.setOrdinal(d.getOrdinal());
|
||||||
if (d.getFields() != null && !d.getFields().isEmpty()) {
|
if (d.getFields() != null && !d.getFields().isEmpty()) {
|
||||||
m.setFields(new HashMap<>());
|
m.setFields(new HashMap<>());
|
||||||
|
|
|
@ -58,6 +58,7 @@ public class PropertyDefinitionFieldSetBuilder extends BaseBuilder<PropertyDefin
|
||||||
for (PropertyDefinitionFieldSetEntity d : data) {
|
for (PropertyDefinitionFieldSetEntity d : data) {
|
||||||
PropertyDefinitionFieldSet m = new PropertyDefinitionFieldSet();
|
PropertyDefinitionFieldSet m = new PropertyDefinitionFieldSet();
|
||||||
if (!itemsFields.isEmpty() && d.getItems() != null) m.setItems(this.builderFactory.builder(PropertyDefinitionFieldSetItemBuilder.class).withFieldSetEntity(this.fieldSetEntity).authorize(this.authorize).build(itemsFields, d.getItems()));
|
if (!itemsFields.isEmpty() && d.getItems() != null) m.setItems(this.builderFactory.builder(PropertyDefinitionFieldSetItemBuilder.class).withFieldSetEntity(this.fieldSetEntity).authorize(this.authorize).build(itemsFields, d.getItems()));
|
||||||
|
if (fields.hasField(this.asIndexer(PropertyDefinitionFieldSet._comment))) m.setComment(d.getComment());
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
|
|
@ -7,6 +7,9 @@ public class PropertyDefinitionFieldSet {
|
||||||
public final static String _items = "items";
|
public final static String _items = "items";
|
||||||
private List<PropertyDefinitionFieldSetItem> items;
|
private List<PropertyDefinitionFieldSetItem> items;
|
||||||
|
|
||||||
|
public final static String _comment = "comment";
|
||||||
|
private String comment;
|
||||||
|
|
||||||
public List<PropertyDefinitionFieldSetItem> getItems() {
|
public List<PropertyDefinitionFieldSetItem> getItems() {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
@ -14,4 +17,12 @@ public class PropertyDefinitionFieldSet {
|
||||||
public void setItems(List<PropertyDefinitionFieldSetItem> items) {
|
public void setItems(List<PropertyDefinitionFieldSetItem> items) {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,6 @@ public class PropertyDefinitionFieldSetItemPersist {
|
||||||
public final static String _fields = "fields";
|
public final static String _fields = "fields";
|
||||||
private Map<String, FieldPersist> fields;
|
private Map<String, FieldPersist> fields;
|
||||||
|
|
||||||
public final static String _comment = "comment";
|
|
||||||
private String comment;
|
|
||||||
|
|
||||||
public final static String _ordinal = "ordinal";
|
public final static String _ordinal = "ordinal";
|
||||||
private Integer ordinal = null;
|
private Integer ordinal = null;
|
||||||
|
|
||||||
|
@ -39,14 +36,6 @@ public class PropertyDefinitionFieldSetItemPersist {
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOrdinal() {
|
public Integer getOrdinal() {
|
||||||
return ordinal;
|
return ordinal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@ public class PropertyDefinitionFieldSetPersist {
|
||||||
public final static String _items = "items";
|
public final static String _items = "items";
|
||||||
private List<PropertyDefinitionFieldSetItemPersist> items;
|
private List<PropertyDefinitionFieldSetItemPersist> items;
|
||||||
|
|
||||||
|
public final static String _comment = "comment";
|
||||||
|
private String comment;
|
||||||
|
|
||||||
public List<PropertyDefinitionFieldSetItemPersist> getItems() {
|
public List<PropertyDefinitionFieldSetItemPersist> getItems() {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +34,14 @@ public class PropertyDefinitionFieldSetPersist {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
@Component(PersistValidator.ValidatorName)
|
@Component(PersistValidator.ValidatorName)
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public static class PersistValidator extends BaseValidator<PropertyDefinitionFieldSetPersist> {
|
public static class PersistValidator extends BaseValidator<PropertyDefinitionFieldSetPersist> {
|
||||||
|
|
|
@ -543,6 +543,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
private @NotNull PropertyDefinitionFieldSetEntity buildPropertyDefinitionFieldSetEntity(PropertyDefinitionFieldSetPersist persist, FieldSetEntity fieldSetEntity, Map<String, List<UUID>> fieldToReferenceMap, VisibilityService visibilityService) throws InvalidApplicationException {
|
private @NotNull PropertyDefinitionFieldSetEntity buildPropertyDefinitionFieldSetEntity(PropertyDefinitionFieldSetPersist persist, FieldSetEntity fieldSetEntity, Map<String, List<UUID>> fieldToReferenceMap, VisibilityService visibilityService) throws InvalidApplicationException {
|
||||||
PropertyDefinitionFieldSetEntity data = new PropertyDefinitionFieldSetEntity();
|
PropertyDefinitionFieldSetEntity data = new PropertyDefinitionFieldSetEntity();
|
||||||
if (persist == null) return data;
|
if (persist == null) return data;
|
||||||
|
data.setComment(persist.getComment());
|
||||||
if (!this.conventionService.isListNullOrEmpty(persist.getItems())){
|
if (!this.conventionService.isListNullOrEmpty(persist.getItems())){
|
||||||
data.setItems(new ArrayList<>());
|
data.setItems(new ArrayList<>());
|
||||||
for (PropertyDefinitionFieldSetItemPersist itemsPersist: persist.getItems()) {
|
for (PropertyDefinitionFieldSetItemPersist itemsPersist: persist.getItems()) {
|
||||||
|
@ -557,7 +558,6 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
if (persist == null) return data;
|
if (persist == null) return data;
|
||||||
if (persist.getFields() != null && !persist.getFields().isEmpty()){
|
if (persist.getFields() != null && !persist.getFields().isEmpty()){
|
||||||
data.setOrdinal(persist.getOrdinal());
|
data.setOrdinal(persist.getOrdinal());
|
||||||
data.setComment(persist.getComment());
|
|
||||||
data.setFields(new HashMap<>());
|
data.setFields(new HashMap<>());
|
||||||
for (String key: persist.getFields().keySet()) {
|
for (String key: persist.getFields().keySet()) {
|
||||||
org.opencdmp.commons.types.descriptiontemplate.FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null;
|
org.opencdmp.commons.types.descriptiontemplate.FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null;
|
||||||
|
@ -1069,6 +1069,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
private @NotNull PropertyDefinitionFieldSetPersist buildPropertyDefinitionFieldSetPersist(PropertyDefinitionFieldSetEntity data, FieldSetEntity fieldSetEntity, List<ReferenceEntity> references){
|
private @NotNull PropertyDefinitionFieldSetPersist buildPropertyDefinitionFieldSetPersist(PropertyDefinitionFieldSetEntity data, FieldSetEntity fieldSetEntity, List<ReferenceEntity> references){
|
||||||
PropertyDefinitionFieldSetPersist persist = new PropertyDefinitionFieldSetPersist();
|
PropertyDefinitionFieldSetPersist persist = new PropertyDefinitionFieldSetPersist();
|
||||||
if (data == null) return persist;
|
if (data == null) return persist;
|
||||||
|
persist.setComment(data.getComment());
|
||||||
if (!this.conventionService.isListNullOrEmpty(data.getItems())){
|
if (!this.conventionService.isListNullOrEmpty(data.getItems())){
|
||||||
persist.setItems(new ArrayList<>());
|
persist.setItems(new ArrayList<>());
|
||||||
for (PropertyDefinitionFieldSetItemEntity itemsPersist: data.getItems()) {
|
for (PropertyDefinitionFieldSetItemEntity itemsPersist: data.getItems()) {
|
||||||
|
@ -1083,7 +1084,6 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
if (data == null) return persist;
|
if (data == null) return persist;
|
||||||
if (data.getFields() != null && !data.getFields().isEmpty()){
|
if (data.getFields() != null && !data.getFields().isEmpty()){
|
||||||
persist.setOrdinal(data.getOrdinal());
|
persist.setOrdinal(data.getOrdinal());
|
||||||
persist.setComment(data.getComment());
|
|
||||||
persist.setFields(new HashMap<>());
|
persist.setFields(new HashMap<>());
|
||||||
for (String key: data.getFields().keySet()) {
|
for (String key: data.getFields().keySet()) {
|
||||||
org.opencdmp.commons.types.descriptiontemplate.FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null;
|
org.opencdmp.commons.types.descriptiontemplate.FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null;
|
||||||
|
@ -1314,6 +1314,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
xml.setFieldSetId(fieldSetId);
|
xml.setFieldSetId(fieldSetId);
|
||||||
if (entity == null) return xml;
|
if (entity == null) return xml;
|
||||||
|
|
||||||
|
xml.setComment(entity.getComment());
|
||||||
if (entity.getItems() != null && !entity.getItems().isEmpty()) {
|
if (entity.getItems() != null && !entity.getItems().isEmpty()) {
|
||||||
List<DescriptionPropertyDefinitionFieldSetItemImportExport> exports = new LinkedList<>();
|
List<DescriptionPropertyDefinitionFieldSetItemImportExport> exports = new LinkedList<>();
|
||||||
for (PropertyDefinitionFieldSetItemEntity propertyDefinitionFieldSetItemEntity : entity.getItems()) {
|
for (PropertyDefinitionFieldSetItemEntity propertyDefinitionFieldSetItemEntity : entity.getItems()) {
|
||||||
|
@ -1329,7 +1330,6 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
DescriptionPropertyDefinitionFieldSetItemImportExport xml = new DescriptionPropertyDefinitionFieldSetItemImportExport();
|
DescriptionPropertyDefinitionFieldSetItemImportExport xml = new DescriptionPropertyDefinitionFieldSetItemImportExport();
|
||||||
if (entity == null) return xml;
|
if (entity == null) return xml;
|
||||||
|
|
||||||
xml.setComment(entity.getComment());
|
|
||||||
xml.setOrdinal(entity.getOrdinal());
|
xml.setOrdinal(entity.getOrdinal());
|
||||||
if (entity.getFields() != null && !entity.getFields().isEmpty()) {
|
if (entity.getFields() != null && !entity.getFields().isEmpty()) {
|
||||||
List<DescriptionFieldImportExport> exports = new LinkedList<>();
|
List<DescriptionFieldImportExport> exports = new LinkedList<>();
|
||||||
|
@ -1463,7 +1463,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
PropertyDefinitionFieldSetPersist persist = new PropertyDefinitionFieldSetPersist();
|
PropertyDefinitionFieldSetPersist persist = new PropertyDefinitionFieldSetPersist();
|
||||||
|
persist.setComment(importXml.getComment());
|
||||||
if (!this.conventionService.isListNullOrEmpty(importXml.getItems())){
|
if (!this.conventionService.isListNullOrEmpty(importXml.getItems())){
|
||||||
List<PropertyDefinitionFieldSetItemPersist> items = new ArrayList<>();
|
List<PropertyDefinitionFieldSetItemPersist> items = new ArrayList<>();
|
||||||
for (DescriptionPropertyDefinitionFieldSetItemImportExport fieldSetItem: importXml.getItems()) {
|
for (DescriptionPropertyDefinitionFieldSetItemImportExport fieldSetItem: importXml.getItems()) {
|
||||||
|
@ -1481,8 +1481,6 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
PropertyDefinitionFieldSetItemPersist persist = new PropertyDefinitionFieldSetItemPersist();
|
PropertyDefinitionFieldSetItemPersist persist = new PropertyDefinitionFieldSetItemPersist();
|
||||||
|
|
||||||
persist.setComment(importXml.getComment());
|
|
||||||
persist.setOrdinal(importXml.getOrdinal());
|
persist.setOrdinal(importXml.getOrdinal());
|
||||||
|
|
||||||
Map<String, FieldPersist> fields = new HashMap<>();
|
Map<String, FieldPersist> fields = new HashMap<>();
|
||||||
|
@ -1675,7 +1673,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
PropertyDefinitionFieldSetPersist persist = new PropertyDefinitionFieldSetPersist();
|
PropertyDefinitionFieldSetPersist persist = new PropertyDefinitionFieldSetPersist();
|
||||||
|
persist.setComment(commonModel.getComment());
|
||||||
if (!this.conventionService.isListNullOrEmpty(commonModel.getItems())){
|
if (!this.conventionService.isListNullOrEmpty(commonModel.getItems())){
|
||||||
List<PropertyDefinitionFieldSetItemPersist> items = new ArrayList<>();
|
List<PropertyDefinitionFieldSetItemPersist> items = new ArrayList<>();
|
||||||
for (PropertyDefinitionFieldSetItemModel fieldSetItem: commonModel.getItems()) {
|
for (PropertyDefinitionFieldSetItemModel fieldSetItem: commonModel.getItems()) {
|
||||||
|
@ -1695,7 +1693,6 @@ public class DescriptionServiceImpl implements DescriptionService {
|
||||||
|
|
||||||
PropertyDefinitionFieldSetItemPersist persist = new PropertyDefinitionFieldSetItemPersist();
|
PropertyDefinitionFieldSetItemPersist persist = new PropertyDefinitionFieldSetItemPersist();
|
||||||
|
|
||||||
persist.setComment(commonModel.getComment());
|
|
||||||
persist.setOrdinal(commonModel.getOrdinal());
|
persist.setOrdinal(commonModel.getOrdinal());
|
||||||
|
|
||||||
Map<String, FieldPersist> fields = new HashMap<>();
|
Map<String, FieldPersist> fields = new HashMap<>();
|
||||||
|
|
|
@ -29,11 +29,11 @@ export interface DescriptionPropertyDefinition {
|
||||||
|
|
||||||
export interface DescriptionPropertyDefinitionFieldSet {
|
export interface DescriptionPropertyDefinitionFieldSet {
|
||||||
items?: DescriptionPropertyDefinitionFieldSetItem[];
|
items?: DescriptionPropertyDefinitionFieldSetItem[];
|
||||||
|
comment?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionPropertyDefinitionFieldSetItem {
|
export interface DescriptionPropertyDefinitionFieldSetItem {
|
||||||
fields?: Map<string, DescriptionField>;
|
fields?: Map<string, DescriptionField>;
|
||||||
comment?: string;
|
|
||||||
ordinal?: number;
|
ordinal?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,11 +88,11 @@ export interface DescriptionPropertyDefinitionPersist {
|
||||||
|
|
||||||
export interface DescriptionPropertyDefinitionFieldSetPersist {
|
export interface DescriptionPropertyDefinitionFieldSetPersist {
|
||||||
items?: DescriptionPropertyDefinitionFieldSetItemPersist[];
|
items?: DescriptionPropertyDefinitionFieldSetItemPersist[];
|
||||||
|
comment?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DescriptionPropertyDefinitionFieldSetItemPersist {
|
export interface DescriptionPropertyDefinitionFieldSetItemPersist {
|
||||||
fields?: Map<string, DescriptionFieldPersist>;
|
fields?: Map<string, DescriptionFieldPersist>;
|
||||||
comment?: string;
|
|
||||||
ordinal?: number;
|
ordinal?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,7 @@ export class DescriptionPropertyDefinitionEditorModel implements DescriptionProp
|
||||||
|
|
||||||
export class DescriptionPropertyDefinitionFieldSetEditorModel implements DescriptionPropertyDefinitionFieldSetPersist {
|
export class DescriptionPropertyDefinitionFieldSetEditorModel implements DescriptionPropertyDefinitionFieldSetPersist {
|
||||||
items?: DescriptionPropertyDefinitionFieldSetItemEditorModel[] = [];
|
items?: DescriptionPropertyDefinitionFieldSetItemEditorModel[] = [];
|
||||||
|
comment?: string;
|
||||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||||
|
|
||||||
fieldSetDefinition: DescriptionTemplateFieldSet;
|
fieldSetDefinition: DescriptionTemplateFieldSet;
|
||||||
|
@ -279,6 +280,7 @@ export class DescriptionPropertyDefinitionFieldSetEditorModel implements Descrip
|
||||||
public fromModel(item: DescriptionPropertyDefinitionFieldSet, descriptionReferences: DescriptionReference[], definitionFieldSet: DescriptionTemplateFieldSet): DescriptionPropertyDefinitionFieldSetEditorModel {
|
public fromModel(item: DescriptionPropertyDefinitionFieldSet, descriptionReferences: DescriptionReference[], definitionFieldSet: DescriptionTemplateFieldSet): DescriptionPropertyDefinitionFieldSetEditorModel {
|
||||||
this.fieldSetDefinition = definitionFieldSet;
|
this.fieldSetDefinition = definitionFieldSet;
|
||||||
if (item) {
|
if (item) {
|
||||||
|
this.comment = item.comment;
|
||||||
if (item.items) { item.items.sort(x=> x.ordinal).map(x => this.items.push(new DescriptionPropertyDefinitionFieldSetItemEditorModel(this.validationErrorModel).fromModel(x, descriptionReferences, definitionFieldSet))); }
|
if (item.items) { item.items.sort(x=> x.ordinal).map(x => this.items.push(new DescriptionPropertyDefinitionFieldSetItemEditorModel(this.validationErrorModel).fromModel(x, descriptionReferences, definitionFieldSet))); }
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
@ -307,7 +309,8 @@ export class DescriptionPropertyDefinitionFieldSetEditorModel implements Descrip
|
||||||
visibilityRulesService: params.visibilityRulesService
|
visibilityRulesService: params.visibilityRulesService
|
||||||
})
|
})
|
||||||
), context.getValidation('items').validators
|
), context.getValidation('items').validators
|
||||||
)
|
),
|
||||||
|
comment: [{ value: this.comment, disabled: disabled }, context.getValidation('comment').validators],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,6 +339,7 @@ export class DescriptionPropertyDefinitionFieldSetEditorModel implements Descrip
|
||||||
}
|
}
|
||||||
|
|
||||||
baseValidationArray.push({ key: 'items', validators: validators });
|
baseValidationArray.push({ key: 'items', validators: validators });
|
||||||
|
baseValidationArray.push({ key: 'comment', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}comment`)] });
|
||||||
baseContext.validation = baseValidationArray;
|
baseContext.validation = baseValidationArray;
|
||||||
return baseContext;
|
return baseContext;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +367,6 @@ export class DescriptionPropertyDefinitionFieldSetEditorModel implements Descrip
|
||||||
|
|
||||||
export class DescriptionPropertyDefinitionFieldSetItemEditorModel implements DescriptionPropertyDefinitionFieldSetItemPersist {
|
export class DescriptionPropertyDefinitionFieldSetItemEditorModel implements DescriptionPropertyDefinitionFieldSetItemPersist {
|
||||||
fields: Map<string, DescriptionFieldEditorModel> = new Map<string, DescriptionFieldEditorModel>;
|
fields: Map<string, DescriptionFieldEditorModel> = new Map<string, DescriptionFieldEditorModel>;
|
||||||
comment?: string;
|
|
||||||
ordinal?: number;
|
ordinal?: number;
|
||||||
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
|
||||||
|
|
||||||
|
@ -373,7 +376,6 @@ export class DescriptionPropertyDefinitionFieldSetItemEditorModel implements Des
|
||||||
|
|
||||||
public fromModel(item: DescriptionPropertyDefinitionFieldSetItem, descriptionReferences: DescriptionReference[], definitionFieldSet: DescriptionTemplateFieldSet): DescriptionPropertyDefinitionFieldSetItemEditorModel {
|
public fromModel(item: DescriptionPropertyDefinitionFieldSetItem, descriptionReferences: DescriptionReference[], definitionFieldSet: DescriptionTemplateFieldSet): DescriptionPropertyDefinitionFieldSetItemEditorModel {
|
||||||
if (item) {
|
if (item) {
|
||||||
this.comment = item.comment;
|
|
||||||
this.ordinal = item.ordinal;
|
this.ordinal = item.ordinal;
|
||||||
if (item.fields) {
|
if (item.fields) {
|
||||||
//TODO: don't like it. Find a common way to parse it either its Map or json.
|
//TODO: don't like it. Find a common way to parse it either its Map or json.
|
||||||
|
@ -405,7 +407,6 @@ export class DescriptionPropertyDefinitionFieldSetItemEditorModel implements Des
|
||||||
}
|
}
|
||||||
|
|
||||||
const formGroup = this.formBuilder.group({});
|
const formGroup = this.formBuilder.group({});
|
||||||
formGroup.addControl('comment', new FormControl({ value: this.comment, disabled: disabled }, context.getValidation('comment').validators));
|
|
||||||
formGroup.addControl('ordinal', new FormControl({ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal').validators));
|
formGroup.addControl('ordinal', new FormControl({ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal').validators));
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,7 +431,6 @@ export class DescriptionPropertyDefinitionFieldSetItemEditorModel implements Des
|
||||||
const baseContext: ValidationContext = new ValidationContext();
|
const baseContext: ValidationContext = new ValidationContext();
|
||||||
const baseValidationArray: Validation[] = new Array<Validation>();
|
const baseValidationArray: Validation[] = new Array<Validation>();
|
||||||
baseValidationArray.push({ key: 'fields', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}fields`)] });
|
baseValidationArray.push({ key: 'fields', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}fields`)] });
|
||||||
baseValidationArray.push({ key: 'comment', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}comment`)] });
|
|
||||||
baseValidationArray.push({ key: 'ordinal', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}ordinal`)] });
|
baseValidationArray.push({ key: 'ordinal', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}ordinal`)] });
|
||||||
|
|
||||||
baseContext.validation = baseValidationArray;
|
baseContext.validation = baseValidationArray;
|
||||||
|
@ -465,7 +465,7 @@ export class DescriptionPropertyDefinitionFieldSetItemEditorModel implements Des
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
['comment', 'ordinal'].forEach(keyField => {
|
['ordinal'].forEach(keyField => {
|
||||||
const control = formGroup?.get(keyField);
|
const control = formGroup?.get(keyField);
|
||||||
control?.clearValidators();
|
control?.clearValidators();
|
||||||
control?.addValidators(context.getValidation(keyField).validators);
|
control?.addValidators(context.getValidation(keyField).validators);
|
||||||
|
|
|
@ -93,10 +93,9 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- comment only on top level fieldset -->
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div *ngIf="fieldSet.hasCommentField && propertiesFormGroup?.get('items')?.at(0)?.get('comment')" class="col-12">
|
<div *ngIf="fieldSet.hasCommentField && propertiesFormGroup?.get('comment')" class="col-12">
|
||||||
<rich-text-editor-component [form]="propertiesFormGroup?.get('items')?.at(0)?.get('comment')" [id]="'editor1'" [placeholder]="'DESCRIPTION-EDITOR.FIELDS.COMMENT-PLACEHOLDER' | translate" [wrapperClasses]="'mb-2'" [editable]="!propertiesFormGroup?.get('items')?.at(0)?.get('comment').disabled" [required]="isRequired"></rich-text-editor-component>
|
<rich-text-editor-component [form]="propertiesFormGroup?.get('comment')" [id]="'editor1'" [placeholder]="'DESCRIPTION-EDITOR.FIELDS.COMMENT-PLACEHOLDER' | translate" [wrapperClasses]="'mb-2'" [editable]="!propertiesFormGroup?.get('comment').disabled" [required]="isRequired"></rich-text-editor-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -65,7 +65,7 @@ export class DescriptionEditorEntityResolver extends BaseEditorResolver {
|
||||||
[nameof<Description>(x => x.planDescriptionTemplate), nameof<PlanDescriptionTemplate>(x => x.sectionId)].join('.'),
|
[nameof<Description>(x => x.planDescriptionTemplate), nameof<PlanDescriptionTemplate>(x => x.sectionId)].join('.'),
|
||||||
[nameof<Description>(x => x.planDescriptionTemplate), nameof<PlanDescriptionTemplate>(x => x.isActive)].join('.'),
|
[nameof<Description>(x => x.planDescriptionTemplate), nameof<PlanDescriptionTemplate>(x => x.isActive)].join('.'),
|
||||||
|
|
||||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.comment)].join('.'),
|
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.comment)].join('.'),
|
||||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.ordinal)].join('.'),
|
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.ordinal)].join('.'),
|
||||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.textValue)].join('.'),
|
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.textValue)].join('.'),
|
||||||
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.textListValue)].join('.'),
|
[nameof<Description>(x => x.properties), nameof<DescriptionPropertyDefinition>(x => x.fieldSets), nameof<DescriptionPropertyDefinitionFieldSet>(x => x.items), nameof<DescriptionPropertyDefinitionFieldSetItem>(x => x.fields), nameof<DescriptionField>(x => x.textListValue)].join('.'),
|
||||||
|
|
Loading…
Reference in New Issue