From 5d9a075d4d2f5d0e1f4003be5e9d92ce6cd7f678 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 23 Jan 2024 10:32:07 +0100 Subject: [PATCH] fixes in data-model for data-import --- doc/hs-office-data-structure.md | 2 +- .../coopassets/HsOfficeCoopAssetsTransactionEntity.java | 6 ++++-- .../coopshares/HsOfficeCoopSharesTransactionEntity.java | 2 +- .../resources/db/changelog/240-hs-office-bankaccount.sql | 2 +- .../resources/db/changelog/320-hs-office-coopassets.sql | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/hs-office-data-structure.md b/doc/hs-office-data-structure.md index 56467c5d..960e572b 100644 --- a/doc/hs-office-data-structure.md +++ b/doc/hs-office-data-structure.md @@ -66,7 +66,7 @@ classDiagram +Numeric partnerNumber: 12345 +Role partnerRole } - partner-MeierGmbH o-- role-MeierGmbH + partner-MeierGmbH *-- role-MeierGmbH class person-MeierGmbH { +personType: LEGAL diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntity.java index ffc60bd1..7b374e3b 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntity.java @@ -1,3 +1,4 @@ + package net.hostsharing.hsadminng.hs.office.coopassets; import lombok.*; @@ -14,6 +15,7 @@ import java.text.DecimalFormat; import java.time.LocalDate; import java.util.UUID; +import static java.util.Optional.ofNullable; import static net.hostsharing.hsadminng.stringify.Stringify.stringify; @Entity @@ -27,7 +29,7 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify; public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, HasUuid { private static Stringify stringify = stringify(HsOfficeCoopAssetsTransactionEntity.class) - .withProp(e -> e.getMembership().getMemberNumber()) + .withProp(e -> ofNullable(e.getMembership()).map(HsOfficeMembershipEntity::getMemberNumber).orElse(null)) .withProp(HsOfficeCoopAssetsTransactionEntity::getValueDate) .withProp(HsOfficeCoopAssetsTransactionEntity::getTransactionType) .withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue) @@ -55,7 +57,7 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, HasUu private BigDecimal assetValue; @Column(name = "reference") - private String reference; + private String reference; // TODO: what is this for? @Column(name = "comment") private String comment; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntity.java index a9fd4bde..c2fbf208 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntity.java @@ -51,7 +51,7 @@ public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUu private int shareCount; @Column(name = "reference") - private String reference; + private String reference; // TODO: what is this for? @Column(name = "comment") private String comment; diff --git a/src/main/resources/db/changelog/240-hs-office-bankaccount.sql b/src/main/resources/db/changelog/240-hs-office-bankaccount.sql index bf3ed342..427b0199 100644 --- a/src/main/resources/db/changelog/240-hs-office-bankaccount.sql +++ b/src/main/resources/db/changelog/240-hs-office-bankaccount.sql @@ -6,7 +6,7 @@ create table hs_office_bankaccount ( uuid uuid unique references RbacObject (uuid) initially deferred, - holder varchar(27) not null, + holder varchar(64) not null, iban varchar(34) not null, bic varchar(11) not null ); diff --git a/src/main/resources/db/changelog/320-hs-office-coopassets.sql b/src/main/resources/db/changelog/320-hs-office-coopassets.sql index db76d95b..9a712f3a 100644 --- a/src/main/resources/db/changelog/320-hs-office-coopassets.sql +++ b/src/main/resources/db/changelog/320-hs-office-coopassets.sql @@ -10,7 +10,8 @@ CREATE TYPE HsOfficeCoopAssetsTransactionType AS ENUM ('ADJUSTMENT', 'TRANSFER', 'ADOPTION', 'CLEARING', - 'LOSS'); + 'LOSS', + 'LIMITATION'); CREATE CAST (character varying as HsOfficeCoopAssetsTransactionType) WITH INOUT AS IMPLICIT;