description template import changes
This commit is contained in:
parent
c522de12ec
commit
697218826b
|
@ -2,7 +2,6 @@ package org.opencdmp.commons.types.descriptiontemplate.importexport;
|
|||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
import org.opencdmp.commons.xmladapter.InstantXmlAdapter;
|
||||
|
@ -11,7 +10,7 @@ import java.time.Instant;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplateDefaultValueImportExport {
|
||||
@XmlAttribute(name="value")
|
||||
@XmlElement(name="value")
|
||||
private String textValue;
|
||||
@XmlElement(name = "dateValue")
|
||||
@XmlJavaTypeAdapter(InstantXmlAdapter.class)
|
||||
|
|
|
@ -10,10 +10,10 @@ import java.util.List;
|
|||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplateFieldImportExport {
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
@XmlElement(name = "id")
|
||||
private String id;
|
||||
|
||||
@XmlAttribute(name = "ordinal")
|
||||
@XmlElement(name = "ordinal")
|
||||
private int ordinal;
|
||||
|
||||
@XmlElementWrapper(name = "validations")
|
||||
|
@ -44,7 +44,7 @@ public class DescriptionTemplateFieldImportExport {
|
|||
@XmlElement(name = "semantic")
|
||||
private List<String> semantics;
|
||||
|
||||
@XmlAttribute(name="includeInExport")
|
||||
@XmlElement(name="includeInExport")
|
||||
private Boolean includeInExport;
|
||||
|
||||
public String getId() {
|
||||
|
@ -112,7 +112,7 @@ public class DescriptionTemplateFieldImportExport {
|
|||
}
|
||||
|
||||
public Boolean getIncludeInExport() {
|
||||
return includeInExport;
|
||||
return this.includeInExport;
|
||||
}
|
||||
|
||||
public void setIncludeInExport(Boolean includeInExport) {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.opencdmp.commons.types.descriptiontemplate.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -8,28 +11,28 @@ import java.util.List;
|
|||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplateFieldSetImportExport {
|
||||
|
||||
@XmlAttribute(name="id")
|
||||
@XmlElement(name="id")
|
||||
private String id;
|
||||
@XmlAttribute(name="ordinal")
|
||||
@XmlElement(name="ordinal")
|
||||
private int ordinal;
|
||||
|
||||
@XmlElementWrapper(name = "fields")
|
||||
@XmlElement(name = "field")
|
||||
private List<DescriptionTemplateFieldImportExport> fields;
|
||||
@XmlAttribute(name="title")
|
||||
@XmlElement(name="title")
|
||||
private String title;
|
||||
@XmlAttribute(name="description")
|
||||
@XmlElement(name="description")
|
||||
private String description;
|
||||
@XmlAttribute(name="extendedDescription")
|
||||
@XmlElement(name="extendedDescription")
|
||||
private String extendedDescription;
|
||||
@XmlAttribute(name="additionalInformation")
|
||||
@XmlElement(name="additionalInformation")
|
||||
private String additionalInformation;
|
||||
@XmlElement(name="multiplicity")
|
||||
private DescriptionTemplateMultiplicityImportExport multiplicity;
|
||||
|
||||
@XmlAttribute(name="hasMultiplicity")
|
||||
@XmlElement(name="hasMultiplicity")
|
||||
private boolean hasMultiplicity;
|
||||
@XmlAttribute(name="hasCommentField")
|
||||
@XmlElement(name="hasCommentField")
|
||||
private Boolean hasCommentField;
|
||||
|
||||
public String getId() {
|
||||
|
|
|
@ -13,13 +13,13 @@ public class DescriptionTemplateImportExport {
|
|||
|
||||
@XmlElement(name = "id")
|
||||
private UUID id;
|
||||
@XmlAttribute(name = "description")
|
||||
@XmlElement(name = "description")
|
||||
private String description;
|
||||
@XmlAttribute(name = "language")
|
||||
@XmlElement(name = "language")
|
||||
private String language;
|
||||
@XmlAttribute(name = "type")
|
||||
@XmlElement(name = "type")
|
||||
private UUID type;
|
||||
@XmlAttribute(name = "version")
|
||||
@XmlElement(name = "version")
|
||||
private Short version;
|
||||
@XmlElement(name = "groupId")
|
||||
private UUID groupId;
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.opencdmp.commons.types.descriptiontemplate.importexport;
|
|||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
|
@ -11,13 +12,13 @@ public class DescriptionTemplateMultiplicityImportExport {
|
|||
private int min;
|
||||
@XmlAttribute(name="max")
|
||||
private int max;
|
||||
@XmlAttribute(name="placeholder")
|
||||
@XmlElement(name="placeholder")
|
||||
private String placeholder;
|
||||
@XmlAttribute(name="tableView")
|
||||
@XmlElement(name="tableView")
|
||||
private boolean tableView;
|
||||
|
||||
public int getMin() {
|
||||
return min;
|
||||
return this.min;
|
||||
}
|
||||
|
||||
public void setMin(int min) {
|
||||
|
@ -25,7 +26,7 @@ public class DescriptionTemplateMultiplicityImportExport {
|
|||
}
|
||||
|
||||
public int getMax() {
|
||||
return max;
|
||||
return this.max;
|
||||
}
|
||||
|
||||
public void setMax(int max) {
|
||||
|
@ -33,7 +34,7 @@ public class DescriptionTemplateMultiplicityImportExport {
|
|||
}
|
||||
|
||||
public String getPlaceholder() {
|
||||
return placeholder;
|
||||
return this.placeholder;
|
||||
}
|
||||
|
||||
public void setPlaceholder(String placeholder) {
|
||||
|
@ -41,7 +42,7 @@ public class DescriptionTemplateMultiplicityImportExport {
|
|||
}
|
||||
|
||||
public boolean getTableView() {
|
||||
return tableView;
|
||||
return this.tableView;
|
||||
}
|
||||
|
||||
public void setTableView(boolean tableView) {
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
package org.opencdmp.commons.types.descriptiontemplate.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplatePageImportExport {
|
||||
@XmlAttribute(name = "id")
|
||||
@XmlElement(name = "id")
|
||||
private String id;
|
||||
@XmlAttribute(name = "ordinal")
|
||||
@XmlElement(name = "ordinal")
|
||||
private int ordinal;
|
||||
|
||||
@XmlAttribute(name = "title")
|
||||
@XmlElement(name = "title")
|
||||
private String title;
|
||||
@XmlElementWrapper(name = "sections")
|
||||
@XmlElement(name = "section")
|
||||
|
@ -20,7 +23,7 @@ public class DescriptionTemplatePageImportExport {
|
|||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
|
@ -28,14 +31,14 @@ public class DescriptionTemplatePageImportExport {
|
|||
}
|
||||
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
return this.ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
|
@ -43,7 +46,7 @@ public class DescriptionTemplatePageImportExport {
|
|||
}
|
||||
|
||||
public List<DescriptionTemplateSectionImportExport> getSections() {
|
||||
return sections;
|
||||
return this.sections;
|
||||
}
|
||||
|
||||
public void setSections(List<DescriptionTemplateSectionImportExport> sections) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.opencdmp.commons.types.descriptiontemplate.importexport;
|
|||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
import org.opencdmp.commons.xmladapter.InstantXmlAdapter;
|
||||
|
@ -12,9 +11,9 @@ import java.time.Instant;
|
|||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplateRuleImportExport {
|
||||
|
||||
@XmlAttribute(name="target")
|
||||
@XmlElement(name="target")
|
||||
private String target;
|
||||
@XmlAttribute(name="value")
|
||||
@XmlElement(name="value")
|
||||
private String textValue;
|
||||
|
||||
@XmlElement(name = "dateValue")
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
package org.opencdmp.commons.types.descriptiontemplate.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionTemplateSectionImportExport {
|
||||
@XmlAttribute(name = "id")
|
||||
@XmlElement(name = "id")
|
||||
private String id;
|
||||
@XmlAttribute(name = "ordinal")
|
||||
@XmlElement(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlElementWrapper(name = "fieldSets")
|
||||
@XmlElement(name = "fieldSet")
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package org.opencdmp.commons.types.descriptiontemplate.importexport.fielddata;
|
||||
|
||||
import org.opencdmp.commons.enums.FieldType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import org.opencdmp.commons.enums.FieldType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public abstract class BaseFieldDataImportExport {
|
||||
@XmlAttribute(name = "label")
|
||||
@XmlElement(name = "label")
|
||||
private String label;
|
||||
@XmlAttribute(name = "fieldType")
|
||||
@XmlElement(name = "fieldType")
|
||||
private FieldType fieldType;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
return this.label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
|
@ -21,7 +21,7 @@ public abstract class BaseFieldDataImportExport {
|
|||
}
|
||||
|
||||
public FieldType getFieldType() {
|
||||
return fieldType;
|
||||
return this.fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(FieldType fieldType) {
|
||||
|
|
|
@ -12,7 +12,7 @@ public class LabelAndMultiplicityDataImportExport extends BaseFieldDataImportExp
|
|||
private Boolean multipleSelect;
|
||||
|
||||
public Boolean getMultipleSelect() {
|
||||
return multipleSelect;
|
||||
return this.multipleSelect;
|
||||
}
|
||||
|
||||
public void setMultipleSelect(Boolean multipleSelect) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.opencdmp.commons.types.descriptiontemplate.importexport.fielddata;
|
|||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -13,11 +14,14 @@ public class ReferenceTypeDataImportExport extends BaseFieldDataImportExport {
|
|||
@XmlAttribute(name = "multipleSelect")
|
||||
private Boolean multipleSelect;
|
||||
|
||||
@XmlAttribute(name = "referenceTypeId")
|
||||
@XmlElement(name = "referenceTypeId")
|
||||
private UUID referenceTypeId;
|
||||
|
||||
@XmlElement(name = "referenceTypeCode")
|
||||
private String referenceTypeCode;
|
||||
|
||||
public Boolean getMultipleSelect() {
|
||||
return multipleSelect;
|
||||
return this.multipleSelect;
|
||||
}
|
||||
|
||||
public void setMultipleSelect(Boolean multipleSelect) {
|
||||
|
@ -25,10 +29,18 @@ public class ReferenceTypeDataImportExport extends BaseFieldDataImportExport {
|
|||
}
|
||||
|
||||
public UUID getReferenceTypeId() {
|
||||
return referenceTypeId;
|
||||
return this.referenceTypeId;
|
||||
}
|
||||
|
||||
public void setReferenceTypeId(UUID referenceTypeId) {
|
||||
this.referenceTypeId = referenceTypeId;
|
||||
}
|
||||
|
||||
public String getReferenceTypeCode() {
|
||||
return this.referenceTypeCode;
|
||||
}
|
||||
|
||||
public void setReferenceTypeCode(String referenceTypeCode) {
|
||||
this.referenceTypeCode = referenceTypeCode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ public class UploadDataImportExport extends BaseFieldDataImportExport {
|
|||
@XmlElement(name = "type")
|
||||
private List<UploadDataOption> types;
|
||||
|
||||
@XmlAttribute(name = "maxFileSizeInMB")
|
||||
@XmlElement(name = "maxFileSizeInMB")
|
||||
private Integer maxFileSizeInMB;
|
||||
|
||||
public List<UploadDataOption> getTypes() {
|
||||
return types;
|
||||
return this.types;
|
||||
}
|
||||
|
||||
public void setTypes(List<UploadDataOption> types) {
|
||||
|
@ -24,7 +24,7 @@ public class UploadDataImportExport extends BaseFieldDataImportExport {
|
|||
}
|
||||
|
||||
public Integer getMaxFileSizeInMB() {
|
||||
return maxFileSizeInMB;
|
||||
return this.maxFileSizeInMB;
|
||||
}
|
||||
|
||||
public void setMaxFileSizeInMB(Integer maxFileSizeInMB) {
|
||||
|
@ -39,7 +39,7 @@ public class UploadDataImportExport extends BaseFieldDataImportExport {
|
|||
private String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
return this.label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
|
@ -47,7 +47,7 @@ public class UploadDataImportExport extends BaseFieldDataImportExport {
|
|||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
|
|
|
@ -14,7 +14,7 @@ public class DefinitionEntity {
|
|||
private List<SectionEntity> sections;
|
||||
|
||||
public List<SectionEntity> getSections() {
|
||||
return sections;
|
||||
return this.sections;
|
||||
}
|
||||
public void setSections(List<SectionEntity> sections) {
|
||||
this.sections = sections;
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.opencdmp.commons.types.dmpblueprint.importexport;
|
|||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -12,9 +13,9 @@ public class BlueprintDescriptionTemplateImportExport {
|
|||
private UUID descriptionTemplateGroupId;
|
||||
@XmlElement(name = "label")
|
||||
private String label;
|
||||
@XmlElement(name = "minMultiplicity")
|
||||
@XmlAttribute(name = "minMultiplicity")
|
||||
private Integer minMultiplicity;
|
||||
@XmlElement(name = "maxMultiplicity")
|
||||
@XmlAttribute(name = "maxMultiplicity")
|
||||
private Integer maxMultiplicity;
|
||||
|
||||
public UUID getDescriptionTemplateGroupId() {
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.opencdmp.commons.types.dmpblueprint.importexport;
|
|||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType;
|
||||
|
||||
|
@ -23,9 +24,9 @@ public class BlueprintExtraFieldImportExport {
|
|||
private String description;
|
||||
@XmlElement(name="semantics")
|
||||
private List<String> semantics;
|
||||
@XmlElement(name = "ordinal")
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlElement(name = "required")
|
||||
@XmlAttribute(name = "required")
|
||||
private boolean required;
|
||||
|
||||
public UUID getId() {
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.opencdmp.commons.types.dmpblueprint.importexport;
|
|||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -24,9 +25,9 @@ public class BlueprintReferenceTypeFieldImportExport {
|
|||
private String description;
|
||||
@XmlElement(name="semantics")
|
||||
private List<String> semantics;
|
||||
@XmlElement(name = "ordinal")
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlElement(name = "required")
|
||||
@XmlAttribute(name = "required")
|
||||
private boolean required;
|
||||
|
||||
@XmlElement(name = "multipleSelect")
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package org.opencdmp.commons.types.dmpblueprint.importexport;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||
import jakarta.xml.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
@ -28,7 +25,7 @@ public class BlueprintSectionImportExport {
|
|||
@XmlElementWrapper(name = "referenceFields")
|
||||
@XmlElement(name = "referenceField")
|
||||
private List<BlueprintReferenceTypeFieldImportExport> referenceFields;
|
||||
@XmlElement(name = "hasTemplates")
|
||||
@XmlAttribute(name = "hasTemplates")
|
||||
private boolean hasTemplates;
|
||||
@XmlElementWrapper(name = "descriptionTemplates")
|
||||
@XmlElement(name = "descriptionTemplate")
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.opencdmp.commons.types.dmpblueprint.importexport;
|
|||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlElement;
|
||||
import org.opencdmp.commons.enums.DmpBlueprintSystemFieldType;
|
||||
|
||||
|
@ -23,9 +24,9 @@ public class BlueprintSystemFieldImportExport {
|
|||
private String description;
|
||||
@XmlElement(name="semantics")
|
||||
private List<String> semantics;
|
||||
@XmlElement(name = "ordinal")
|
||||
@XmlAttribute(name = "ordinal")
|
||||
private int ordinal;
|
||||
@XmlElement(name = "required")
|
||||
@XmlAttribute(name = "required")
|
||||
private boolean required;
|
||||
|
||||
public UUID getId() {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.opencdmp.data;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.opencdmp.commons.enums.DescriptionTemplateStatus;
|
||||
import org.opencdmp.commons.enums.DescriptionTemplateVersionStatus;
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
|
@ -8,8 +10,6 @@ import org.opencdmp.data.converters.enums.DescriptionTemplateVersionStatusConver
|
|||
import org.opencdmp.data.converters.enums.IsActiveConverter;
|
||||
import org.opencdmp.data.tenant.TenantScopedBaseEntity;
|
||||
import org.opencdmp.data.types.SQLXMLType;
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
@ -27,7 +27,7 @@ public class DescriptionTemplateEntity extends TenantScopedBaseEntity {
|
|||
public static final String _label = "label";
|
||||
public static final int _labelLength = 250;
|
||||
|
||||
@Type(value = SQLXMLType.class)
|
||||
@Type(SQLXMLType.class)
|
||||
@Column(name = "definition", nullable = false, columnDefinition = "xml")
|
||||
private String definition;
|
||||
public static final String _definition = "definition";
|
||||
|
@ -44,7 +44,7 @@ public class DescriptionTemplateEntity extends TenantScopedBaseEntity {
|
|||
|
||||
|
||||
@Column(name = "created_at", nullable = false)
|
||||
private Instant createdAt = null;
|
||||
private Instant createdAt;
|
||||
public static final String _createdAt = "createdAt";
|
||||
|
||||
@Column(name = "updated_at", nullable = false)
|
||||
|
@ -77,46 +77,46 @@ public class DescriptionTemplateEntity extends TenantScopedBaseEntity {
|
|||
public static final String _typeId = "typeId";
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
return this.description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
public void setId(UUID id) { this.id = id;}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
return this.label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
return this.definition;
|
||||
}
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public UUID getGroupId() { return groupId; }
|
||||
public UUID getGroupId() { return this.groupId; }
|
||||
public void setGroupId(UUID groupId) { this.groupId = groupId;}
|
||||
|
||||
public Short getVersion() { return version; }
|
||||
public Short getVersion() { return this.version; }
|
||||
public void setVersion(Short version) { this.version = version; }
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
return this.language;
|
||||
}
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public DescriptionTemplateStatus getStatus() {
|
||||
return status;
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(DescriptionTemplateStatus status) {
|
||||
|
@ -124,7 +124,7 @@ public class DescriptionTemplateEntity extends TenantScopedBaseEntity {
|
|||
}
|
||||
|
||||
public IsActive getIsActive() {
|
||||
return isActive;
|
||||
return this.isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(IsActive isActive) {
|
||||
|
@ -132,7 +132,7 @@ public class DescriptionTemplateEntity extends TenantScopedBaseEntity {
|
|||
}
|
||||
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
return this.createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
|
@ -140,7 +140,7 @@ public class DescriptionTemplateEntity extends TenantScopedBaseEntity {
|
|||
}
|
||||
|
||||
public Instant getUpdatedAt() {
|
||||
return updatedAt;
|
||||
return this.updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Instant updatedAt) {
|
||||
|
@ -148,7 +148,7 @@ public class DescriptionTemplateEntity extends TenantScopedBaseEntity {
|
|||
}
|
||||
|
||||
public UUID getTypeId() {
|
||||
return typeId;
|
||||
return this.typeId;
|
||||
}
|
||||
|
||||
public void setTypeId(UUID typeId) {
|
||||
|
@ -156,7 +156,7 @@ public class DescriptionTemplateEntity extends TenantScopedBaseEntity {
|
|||
}
|
||||
|
||||
public DescriptionTemplateVersionStatus getVersionStatus() {
|
||||
return versionStatus;
|
||||
return this.versionStatus;
|
||||
}
|
||||
|
||||
public void setVersionStatus(DescriptionTemplateVersionStatus versionStatus) {
|
||||
|
|
|
@ -28,11 +28,13 @@ import org.opencdmp.commons.scope.tenant.TenantScope;
|
|||
import org.opencdmp.commons.scope.user.UserScope;
|
||||
import org.opencdmp.commons.types.descriptiontemplate.*;
|
||||
import org.opencdmp.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||
import org.opencdmp.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEntity;
|
||||
import org.opencdmp.commons.types.descriptiontemplate.importexport.*;
|
||||
import org.opencdmp.commons.types.notification.*;
|
||||
import org.opencdmp.convention.ConventionService;
|
||||
import org.opencdmp.data.*;
|
||||
import org.opencdmp.data.DescriptionTemplateEntity;
|
||||
import org.opencdmp.data.TenantEntityManager;
|
||||
import org.opencdmp.data.UserDescriptionTemplateEntity;
|
||||
import org.opencdmp.data.UserEntity;
|
||||
import org.opencdmp.errorcode.ErrorThesaurusProperties;
|
||||
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||
|
@ -43,14 +45,13 @@ import org.opencdmp.model.deleter.UserDescriptionTemplateDeleter;
|
|||
import org.opencdmp.model.descriptiontemplate.*;
|
||||
import org.opencdmp.model.persist.DescriptionTemplatePersist;
|
||||
import org.opencdmp.model.persist.NewVersionDescriptionTemplatePersist;
|
||||
import org.opencdmp.model.persist.ReferencePersist;
|
||||
import org.opencdmp.model.persist.UserDescriptionTemplatePersist;
|
||||
import org.opencdmp.model.persist.descriptiontemplatedefinition.*;
|
||||
import org.opencdmp.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
|
||||
import org.opencdmp.model.reference.Reference;
|
||||
import org.opencdmp.model.referencetype.ReferenceType;
|
||||
import org.opencdmp.model.user.User;
|
||||
import org.opencdmp.query.*;
|
||||
import org.opencdmp.query.DescriptionTemplateQuery;
|
||||
import org.opencdmp.query.UserContactInfoQuery;
|
||||
import org.opencdmp.query.UserDescriptionTemplateQuery;
|
||||
import org.opencdmp.service.fielddatahelper.FieldDataHelperService;
|
||||
import org.opencdmp.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||
import org.opencdmp.service.responseutils.ResponseUtilsService;
|
||||
|
@ -292,7 +293,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
this.eventHandler.handle(event);
|
||||
}
|
||||
|
||||
private @NotNull DefinitionEntity buildDefinitionEntity(DefinitionPersist persist) throws InvalidApplicationException {
|
||||
private @NotNull DefinitionEntity buildDefinitionEntity(DefinitionPersist persist) {
|
||||
DefinitionEntity data = new DefinitionEntity();
|
||||
if (persist == null)
|
||||
return data;
|
||||
|
@ -307,7 +308,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return data;
|
||||
}
|
||||
|
||||
private @NotNull SectionEntity buildSectionEntity(SectionPersist persist) throws InvalidApplicationException {
|
||||
private @NotNull SectionEntity buildSectionEntity(SectionPersist persist) {
|
||||
SectionEntity data = new SectionEntity();
|
||||
if (persist == null)
|
||||
return data;
|
||||
|
@ -334,7 +335,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return data;
|
||||
}
|
||||
|
||||
private @NotNull FieldSetEntity buildFieldSetEntity(FieldSetPersist persist) throws InvalidApplicationException {
|
||||
private @NotNull FieldSetEntity buildFieldSetEntity(FieldSetPersist persist) {
|
||||
FieldSetEntity data = new FieldSetEntity();
|
||||
if (persist == null)
|
||||
return data;
|
||||
|
@ -363,7 +364,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return data;
|
||||
}
|
||||
|
||||
private @NotNull FieldEntity buildFieldEntity(FieldPersist persist) throws InvalidApplicationException {
|
||||
private @NotNull FieldEntity buildFieldEntity(FieldPersist persist) {
|
||||
FieldEntity data = new FieldEntity();
|
||||
if (persist == null)
|
||||
return data;
|
||||
|
@ -393,7 +394,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return this.fieldDataHelperServiceProvider.get(persist.getFieldType()).applyPersist(persist);
|
||||
}
|
||||
|
||||
private @NotNull RuleEntity buildRuleEntity(RulePersist persist, FieldEntity fieldEntity) throws InvalidApplicationException {
|
||||
private @NotNull RuleEntity buildRuleEntity(RulePersist persist, FieldEntity fieldEntity) {
|
||||
FieldType fieldType = fieldEntity != null && fieldEntity.getData() != null ? fieldEntity.getData().getFieldType() : FieldType.FREE_TEXT;
|
||||
RuleEntity data = new RuleEntity();
|
||||
if (persist == null) return data;
|
||||
|
@ -446,77 +447,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return data;
|
||||
}
|
||||
|
||||
private List<UUID> patchAndSaveReferences(List<ReferencePersist> models, FieldEntity fieldEntity) throws InvalidApplicationException {
|
||||
if (models == null) models = new ArrayList<>();
|
||||
|
||||
List<UUID> referenceIds = new ArrayList<>();
|
||||
|
||||
for (ReferencePersist model : models) {
|
||||
ReferenceEntity data;
|
||||
if (this.conventionService.isValidGuid(model.getId())){
|
||||
data = this.entityManager.find(ReferenceEntity.class, model.getId());
|
||||
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Reference.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
} else {
|
||||
ReferenceTypeDataEntity referenceTypeDataEntity = ((ReferenceTypeDataEntity)fieldEntity.getData());
|
||||
data = this.queryFactory.query(ReferenceQuery.class).disableTracking().sourceTypes(model.getSourceType()).typeIds(referenceTypeDataEntity.getReferenceTypeId()).sources(model.getSource()).isActive(IsActive.Active).references(model.getReference()).first();
|
||||
if (data == null){
|
||||
data = new ReferenceEntity();
|
||||
data.setId(UUID.randomUUID());
|
||||
data.setIsActive(IsActive.Active);
|
||||
data.setCreatedAt(Instant.now());
|
||||
data.setTypeId(referenceTypeDataEntity.getReferenceTypeId());
|
||||
|
||||
data.setDefinition(this.xmlHandlingService.toXmlSafe(this.buildReferenceDefinitionEntity(model.getDefinition())));
|
||||
data.setUpdatedAt(Instant.now());
|
||||
data.setReference(model.getReference());
|
||||
data.setAbbreviation(model.getAbbreviation());
|
||||
data.setSource(model.getSource());
|
||||
data.setSourceType(model.getSourceType());
|
||||
|
||||
try {
|
||||
ReferenceTypeEntity referenceType = this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(referenceTypeDataEntity.getReferenceTypeId()).firstAs(new BaseFieldSet().ensure(ReferenceType._id).ensure(ReferenceTypeEntity._tenantId));
|
||||
if (referenceType == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{referenceTypeDataEntity.getReferenceTypeId(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
if (data.getSourceType().equals(ReferenceSourceType.External) && !this.tenantScope.isDefaultTenant() && referenceType.getTenantId() == null){
|
||||
this.tenantScope.setTempTenant(this.entityManager, null, this.tenantScope.getDefaultTenantCode());
|
||||
}
|
||||
this.entityManager.persist(data);
|
||||
} finally {
|
||||
this.tenantScope.removeTempTenant(this.entityManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
referenceIds.add(data.getId());
|
||||
}
|
||||
this.entityManager.flush();
|
||||
|
||||
return referenceIds;
|
||||
}
|
||||
|
||||
private @NotNull org.opencdmp.commons.types.reference.DefinitionEntity buildReferenceDefinitionEntity(org.opencdmp.model.persist.referencedefinition.DefinitionPersist persist){
|
||||
org.opencdmp.commons.types.reference.DefinitionEntity data = new org.opencdmp.commons.types.reference.DefinitionEntity();
|
||||
if (persist == null) return data;
|
||||
if (!this.conventionService.isListNullOrEmpty(persist.getFields())){
|
||||
data.setFields(new ArrayList<>());
|
||||
for (org.opencdmp.model.persist.referencedefinition.FieldPersist fieldPersist: persist.getFields()) {
|
||||
data.getFields().add(this.buildRefernceFieldEntity(fieldPersist));
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private @NotNull org.opencdmp.commons.types.reference.FieldEntity buildRefernceFieldEntity(org.opencdmp.model.persist.referencedefinition.FieldPersist persist){
|
||||
org.opencdmp.commons.types.reference.FieldEntity data = new org.opencdmp.commons.types.reference.FieldEntity();
|
||||
if (persist == null) return data;
|
||||
|
||||
data.setCode(persist.getCode());
|
||||
data.setDataType(persist.getDataType());
|
||||
data.setCode(persist.getCode());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private @NotNull MultiplicityEntity buildMultiplicityEntity(MultiplicityPersist persist) {
|
||||
MultiplicityEntity data = new MultiplicityEntity();
|
||||
if (persist == null)
|
||||
|
@ -533,7 +463,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
return data;
|
||||
}
|
||||
|
||||
private @NotNull PageEntity buildPageEntity(PagePersist persist) throws InvalidApplicationException {
|
||||
private @NotNull PageEntity buildPageEntity(PagePersist persist) {
|
||||
PageEntity data = new PageEntity();
|
||||
if (persist == null)
|
||||
return data;
|
||||
|
@ -907,7 +837,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
//region Export
|
||||
|
||||
@Override
|
||||
public DescriptionTemplateImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
|
||||
public DescriptionTemplateImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException {
|
||||
logger.debug(new MapLogEntry("exportXml").And("id", id));
|
||||
|
||||
if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportDescriptionTemplate);
|
||||
|
|
|
@ -1,17 +1,26 @@
|
|||
package org.opencdmp.service.fielddatahelper;
|
||||
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
import gr.cite.tools.data.query.QueryFactory;
|
||||
import gr.cite.tools.exception.MyNotFoundException;
|
||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.validation.Validator;
|
||||
import gr.cite.tools.validation.ValidatorFactory;
|
||||
import org.opencdmp.authorization.AuthorizationFlags;
|
||||
import org.opencdmp.commonmodels.models.descriptiotemplate.fielddata.ReferenceTypeDataModel;
|
||||
import org.opencdmp.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEntity;
|
||||
import org.opencdmp.commons.types.descriptiontemplate.importexport.fielddata.ReferenceTypeDataImportExport;
|
||||
import org.opencdmp.convention.ConventionService;
|
||||
import org.opencdmp.data.ReferenceTypeEntity;
|
||||
import org.opencdmp.model.builder.commonmodels.descriptiontemplate.fielddata.ReferenceTypeDataCommonModelBuilder;
|
||||
import org.opencdmp.model.builder.descriptiontemplate.fielddata.ReferenceTypeDataBuilder;
|
||||
import org.opencdmp.model.descriptiontemplate.fielddata.ReferenceTypeData;
|
||||
import org.opencdmp.model.persist.descriptiontemplatedefinition.fielddata.ReferenceTypeDataPersist;
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.validation.Validator;
|
||||
import gr.cite.tools.validation.ValidatorFactory;
|
||||
import org.opencdmp.model.referencetype.ReferenceType;
|
||||
import org.opencdmp.query.ReferenceTypeQuery;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
@ -19,12 +28,18 @@ import java.util.List;
|
|||
|
||||
@Component
|
||||
public class ReferenceTypeFieldDataHelperService extends BaseFieldDataHelperService<ReferenceTypeData, ReferenceTypeDataPersist, ReferenceTypeDataEntity, ReferenceTypeDataImportExport, ReferenceTypeDataModel> {
|
||||
|
||||
|
||||
private final BuilderFactory builderFactory;
|
||||
private final QueryFactory queryFactory;
|
||||
private final ConventionService conventionService;
|
||||
private final MessageSource messageSource;
|
||||
|
||||
private final ValidatorFactory validatorFactory;
|
||||
public ReferenceTypeFieldDataHelperService(BuilderFactory builderFactory, ValidatorFactory validatorFactory) {
|
||||
public ReferenceTypeFieldDataHelperService(BuilderFactory builderFactory, QueryFactory queryFactory, ConventionService conventionService, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||
this.builderFactory = builderFactory;
|
||||
this.queryFactory = queryFactory;
|
||||
this.conventionService = conventionService;
|
||||
this.messageSource = messageSource;
|
||||
this.validatorFactory = validatorFactory;
|
||||
}
|
||||
|
||||
|
@ -100,14 +115,23 @@ public class ReferenceTypeFieldDataHelperService extends BaseFieldDataHelperServ
|
|||
|
||||
@Override
|
||||
protected ReferenceTypeDataPersist importExportMapDataToPersistInternal(ReferenceTypeDataImportExport data, ReferenceTypeDataPersist persist){
|
||||
ReferenceTypeEntity referenceTypeEntity = data.getReferenceTypeId() != null ? this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(data.getReferenceTypeId()).disableTracking().firstAs(new BaseFieldSet().ensure(ReferenceType._id)) : null;
|
||||
if (referenceTypeEntity == null){
|
||||
if (!this.conventionService.isNullOrEmpty(data.getReferenceTypeCode())) referenceTypeEntity = this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().codes(data.getReferenceTypeCode()).disableTracking().firstAs(new BaseFieldSet().ensure(ReferenceType._id));
|
||||
if (referenceTypeEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getReferenceTypeId(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
}
|
||||
persist.setMultipleSelect(data.getMultipleSelect());
|
||||
persist.setReferenceTypeId(data.getReferenceTypeId());
|
||||
persist.setReferenceTypeId(referenceTypeEntity.getId());
|
||||
return persist;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReferenceTypeDataImportExport dataToImportExportXmlInternal(ReferenceTypeDataEntity data, ReferenceTypeDataImportExport xml) {
|
||||
ReferenceTypeEntity referenceTypeEntity = this.queryFactory.query(ReferenceTypeQuery.class).disableTracking().ids(data.getReferenceTypeId()).disableTracking().firstAs(new BaseFieldSet().ensure(ReferenceType._code));
|
||||
if (referenceTypeEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getReferenceTypeId(), ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
xml.setMultipleSelect(data.getMultipleSelect());
|
||||
xml.setReferenceTypeCode(referenceTypeEntity.getCode());
|
||||
xml.setReferenceTypeId(data.getReferenceTypeId());
|
||||
return xml;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue