dossier and npe cleanup
This commit is contained in:
parent
c1cf5f05cb
commit
6bc4640b9b
@ -1,5 +1,5 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier;
|
||||
|
||||
public enum DossierStatus {
|
||||
ACTIVE, ARCHIVED, DELETED
|
||||
ACTIVE, DELETED, ARCHIVED;
|
||||
}
|
||||
|
||||
@ -41,7 +41,8 @@ public class DossierEntity {
|
||||
@Column(length = 4000)
|
||||
private String description;
|
||||
|
||||
@Column
|
||||
@Column(name = "dossier_status")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private DossierStatus status;
|
||||
|
||||
@Column
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.utils;
|
||||
|
||||
import com.amazonaws.services.s3.transfer.Download;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.DownloadFileType;
|
||||
@ -25,6 +24,9 @@ public class JSONDownloadFileTypeConverter implements AttributeConverter<Set<Dow
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Set<DownloadFileType> convertToEntityAttribute(String data) {
|
||||
if (data == null) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
TypeReference<HashSet<DownloadFileType>> typeRef = new TypeReference<>() {
|
||||
};
|
||||
return objectMapper.readValue(data, typeRef);
|
||||
|
||||
@ -23,6 +23,9 @@ public class JSONIntegerSetConverter implements AttributeConverter<Set<Integer>,
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Set<Integer> convertToEntityAttribute(String data) {
|
||||
if (data == null) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
TypeReference<HashSet<Integer>> typeRef = new TypeReference<>() {
|
||||
};
|
||||
return objectMapper.readValue(data, typeRef);
|
||||
|
||||
@ -23,6 +23,9 @@ public class JSONMapConverter implements AttributeConverter<Map<String, Object>,
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Map<String, Object> convertToEntityAttribute(String data) {
|
||||
if (data == null) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
TypeReference<HashMap<String, Object>> typeRef = new TypeReference<>() {
|
||||
};
|
||||
return objectMapper.readValue(data, typeRef);
|
||||
|
||||
@ -23,6 +23,9 @@ public class JSONStringSetConverter implements AttributeConverter<Set<String>, S
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Set<String> convertToEntityAttribute(String data) {
|
||||
if (data == null) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
TypeReference<HashSet<String>> typeRef = new TypeReference<>() {
|
||||
};
|
||||
return objectMapper.readValue(data, typeRef);
|
||||
|
||||
@ -24,6 +24,9 @@ databaseChangeLog:
|
||||
- column:
|
||||
name: download_file_types
|
||||
type: TEXT
|
||||
- column:
|
||||
name: dossier_status
|
||||
type: VARCHAR(30)
|
||||
tableName: dossier
|
||||
- changeSet:
|
||||
id: add-dossier-template-download-file-types-members-approvers
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
databaseChangeLog:
|
||||
- changeSet:
|
||||
id: remove-dossier-status-numeric-column
|
||||
author: timo
|
||||
changes:
|
||||
- removeColumn:
|
||||
columns:
|
||||
- column:
|
||||
name: status
|
||||
tableName: dossier
|
||||
@ -15,3 +15,5 @@ databaseChangeLog:
|
||||
file: db/changelog/7-json-column-mapping.changelog.yaml
|
||||
- include:
|
||||
file: db/changelog/sql/7.1-set-json-fields.sql
|
||||
- include:
|
||||
file: db/changelog/8-remove-old-dossier-status-column.changelog.yaml
|
||||
|
||||
@ -25,3 +25,7 @@ update download_status set download_file_types =
|
||||
(select '['||STRING_AGG( '"'|| download_file_types || '"', ', ')||']'
|
||||
from download_status_entity_download_file_types dem where dem.download_status_entity_storage_id = download_status.storage_id
|
||||
group by dem.download_status_entity_storage_id);
|
||||
|
||||
update dossier set dossier_status = 'ACTIVE' where status = 0 or status is null;
|
||||
update dossier set dossier_status = 'DELETED' where status = 1;
|
||||
update dossier set dossier_status = 'ARCHIVED' where status = 2;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user