diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java index 32d9038f..ecce6e74 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java @@ -7,7 +7,8 @@ import lombok.NoArgsConstructor; import lombok.Setter; import net.hostsharing.hsadminng.errors.DisplayAs; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartner; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity; @@ -96,7 +97,7 @@ public class HsOfficeDebitorEntity implements BaseEntity, ) """) @NotFound(action = NotFoundAction.IGNORE) // TODO.impl: map a simplified raw-PartnerEntity, just for the partner-number - private HsOfficePartnerRbacEntity partner; + private HsOfficePartnerRealEntity partner; @Column(name = "debitornumbersuffix", length = 2) @Pattern(regexp = TWO_DECIMAL_DIGITS) @@ -145,7 +146,7 @@ public class HsOfficeDebitorEntity implements BaseEntity, public String getTaggedDebitorNumber() { return ofNullable(partner) .filter(partner -> debitorNumberSuffix != null) - .map(HsOfficePartnerRbacEntity::getPartnerNumber) + .map(HsOfficePartner::getPartnerNumber) .map(partnerNumber -> DEBITOR_NUMBER_TAG + partnerNumber + debitorNumberSuffix) .orElse(null); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java index 0d1b9110..61ce652b 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java @@ -7,7 +7,7 @@ import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMember import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipResource; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealRepository; import net.hostsharing.hsadminng.mapper.StrictMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; @@ -33,7 +33,7 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi { private StrictMapper mapper; @Autowired - private HsOfficePartnerRbacRepository partnerRepo; + private HsOfficePartnerRealRepository partnerRepo; @Autowired private HsOfficeMembershipRepository membershipRepo; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntity.java index 08c7ae93..2d9c8248 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntity.java @@ -8,9 +8,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import net.hostsharing.hsadminng.errors.DisplayAs; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity; import net.hostsharing.hsadminng.persistence.BaseEntity; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity; import net.hostsharing.hsadminng.rbac.generator.RbacSpec; import net.hostsharing.hsadminng.rbac.generator.RbacSpec.SQL; import net.hostsharing.hsadminng.rbac.role.WithRoleId; @@ -85,7 +85,7 @@ public class HsOfficeMembershipEntity implements BaseEntity> implements Stringifyable, BaseEntity { + + public static final String PARTNER_NUMBER_TAG = "P-"; + + protected static Stringify stringify = stringify(HsOfficePartner.class, "partner") + .withIdProp(HsOfficePartner::toShortString) + .withProp(p -> ofNullable(p.getPartnerRel()) + .map(HsOfficeRelation::getHolder) + .map(HsOfficePerson::toShortString) + .orElse(null)) + .withProp(p -> ofNullable(p.getPartnerRel()) + .map(HsOfficeRelation::getContact) + .map(HsOfficeContact::toShortString) + .orElse(null)) + .quotedValues(false); + + @Id + @GeneratedValue + private UUID uuid; + + @Version + private int version; + + @Column(name = "partnernumber", columnDefinition = "numeric(5) not null") + private Integer partnerNumber; + + @ManyToOne(cascade = { PERSIST, MERGE, REFRESH, DETACH }, optional = false, fetch = FetchType.LAZY) + @JoinColumn(name = "partnerreluuid", nullable = false) + private HsOfficeRelationRealEntity partnerRel; + + @ManyToOne(cascade = { PERSIST, MERGE, REFRESH, DETACH }, optional = true, fetch = FetchType.LAZY) + @JoinColumn(name = "detailsuuid") + @NotFound(action = NotFoundAction.IGNORE) + private HsOfficePartnerDetailsEntity details; + + @Override + public T load() { + BaseEntity.super.load(); + partnerRel.load(); + if (details != null) { + details.load(); + } + //noinspection unchecked + return (T) this; + } + + public String getTaggedPartnerNumber() { + return PARTNER_NUMBER_TAG + partnerNumber; + } + + @Override + public String toString() { + return stringify.apply(this); + } + + @Override + public String toShortString() { + return getTaggedPartnerNumber(); + } +} diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRbacEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRbacEntity.java index 35f9c4c6..eddab1c7 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRbacEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRbacEntity.java @@ -1,27 +1,16 @@ package net.hostsharing.hsadminng.hs.office.partner; -import lombok.AllArgsConstructor; -import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import lombok.experimental.SuperBuilder; import net.hostsharing.hsadminng.errors.DisplayAs; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContact; -import net.hostsharing.hsadminng.hs.office.person.HsOfficePerson; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity; -import net.hostsharing.hsadminng.persistence.BaseEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation; import net.hostsharing.hsadminng.rbac.generator.RbacSpec; import net.hostsharing.hsadminng.rbac.generator.RbacSpec.SQL; -import net.hostsharing.hsadminng.repr.Stringify; -import net.hostsharing.hsadminng.repr.Stringifyable; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import jakarta.persistence.*; import java.io.IOException; -import java.util.UUID; import static jakarta.persistence.CascadeType.*; import static net.hostsharing.hsadminng.rbac.generator.RbacSpec.Column.dependsOnColumn; @@ -32,75 +21,15 @@ import static net.hostsharing.hsadminng.rbac.generator.RbacSpec.Permission.SELEC import static net.hostsharing.hsadminng.rbac.generator.RbacSpec.Role.*; import static net.hostsharing.hsadminng.rbac.generator.RbacSpec.SQL.directlyFetchedByDependsOnColumn; import static net.hostsharing.hsadminng.rbac.generator.RbacSpec.rbacViewFor; -import static java.util.Optional.ofNullable; -import static net.hostsharing.hsadminng.repr.Stringify.stringify; @Entity @Table(schema = "hs_office", name = "partner_rv") @Getter @Setter -@Builder +@SuperBuilder(toBuilder = true) @NoArgsConstructor -@AllArgsConstructor -@DisplayAs("Partner") -public class HsOfficePartnerRbacEntity implements Stringifyable, BaseEntity { - - public static final String PARTNER_NUMBER_TAG = "P-"; - - private static Stringify stringify = stringify(HsOfficePartnerRbacEntity.class, "partner") - .withIdProp(HsOfficePartnerRbacEntity::toShortString) - .withProp(p -> ofNullable(p.getPartnerRel()) - .map(HsOfficeRelation::getHolder) - .map(HsOfficePerson::toShortString) - .orElse(null)) - .withProp(p -> ofNullable(p.getPartnerRel()) - .map(HsOfficeRelation::getContact) - .map(HsOfficeContact::toShortString) - .orElse(null)) - .quotedValues(false); - - @Id - @GeneratedValue - private UUID uuid; - - @Version - private int version; - - @Column(name = "partnernumber", columnDefinition = "numeric(5) not null") - private Integer partnerNumber; - - @ManyToOne(cascade = { PERSIST, MERGE, REFRESH, DETACH }, optional = false, fetch = FetchType.LAZY) - @JoinColumn(name = "partnerreluuid", nullable = false) - private HsOfficeRelationRealEntity partnerRel; - - @ManyToOne(cascade = { PERSIST, MERGE, REFRESH, DETACH }, optional = true, fetch = FetchType.LAZY) - @JoinColumn(name = "detailsuuid") - @NotFound(action = NotFoundAction.IGNORE) - private HsOfficePartnerDetailsEntity details; - - @Override - public HsOfficePartnerRbacEntity load() { - BaseEntity.super.load(); - partnerRel.load(); - if (details != null) { - details.load(); - } - return this; - } - - public String getTaggedPartnerNumber() { - return PARTNER_NUMBER_TAG + partnerNumber; - } - - @Override - public String toString() { - return stringify.apply(this); - } - - @Override - public String toShortString() { - return getTaggedPartnerNumber(); - } +@DisplayAs("RbacPartner") +public class HsOfficePartnerRbacEntity extends HsOfficePartner { public static RbacSpec rbac() { return rbacViewFor("partner", HsOfficePartnerRbacEntity.class) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRbacRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRbacRepository.java index f745c1da..759fd133 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRbacRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRbacRepository.java @@ -10,10 +10,10 @@ import java.util.UUID; public interface HsOfficePartnerRbacRepository extends Repository { - @Timed("app.office.partners.repo.findByUuid") + @Timed("app.office.partners.repo.findByUuid.rbac") Optional findByUuid(UUID id); - @Timed("app.office.partners.repo.findAll") + @Timed("app.office.partners.repo.findAll.rbac") List findAll(); // TODO.refa: move to a repo in test sources @Query(value = """ @@ -30,18 +30,18 @@ public interface HsOfficePartnerRbacRepository extends Repository findPartnerByOptionalNameLike(String name); - @Timed("app.office.partners.repo.findPartnerByPartnerNumber") + @Timed("app.office.partners.repo.findPartnerByPartnerNumber.rbac") Optional findPartnerByPartnerNumber(Integer partnerNumber); - @Timed("app.office.partners.repo.save") + @Timed("app.office.partners.repo.save.rbac") HsOfficePartnerRbacEntity save(final HsOfficePartnerRbacEntity entity); - @Timed("app.office.partners.repo.count") + @Timed("app.office.partners.repo.count.rbac") long count(); - @Timed("app.office.partners.repo.deleteByUuid") + @Timed("app.office.partners.repo.deleteByUuid.rbac") int deleteByUuid(UUID uuid); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRealEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRealEntity.java new file mode 100644 index 00000000..ddaf346b --- /dev/null +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRealEntity.java @@ -0,0 +1,21 @@ +package net.hostsharing.hsadminng.hs.office.partner; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.experimental.SuperBuilder; +import net.hostsharing.hsadminng.errors.DisplayAs; + +import jakarta.persistence.Entity; +import jakarta.persistence.Table; + + +@Entity +@Table(schema = "hs_office", name = "partner") +@Getter +@Setter +@SuperBuilder(toBuilder = true) +@NoArgsConstructor +@DisplayAs("RealPartner") +public class HsOfficePartnerRealEntity extends HsOfficePartner { +} diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRealRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRealRepository.java new file mode 100644 index 00000000..a971cbf2 --- /dev/null +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRealRepository.java @@ -0,0 +1,41 @@ +package net.hostsharing.hsadminng.hs.office.partner; + +import io.micrometer.core.annotation.Timed; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.Repository; + +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +public interface HsOfficePartnerRealRepository extends Repository { + + @Timed("app.office.partners.repo.findByUuid.real") + Optional findByUuid(UUID id); + + @Timed("app.office.partners.repo.findAll.real") + List findAll(); // TODO.refa: move to a repo in test sources + + @Query(value = """ + select partner.uuid, partner.detailsuuid, partner.partnernumber, partner.partnerreluuid, partner.version + from hs_office.partner partner + join hs_office.relation partnerRel on partnerRel.uuid = partner.partnerreluuid + join hs_office.contact contact on contact.uuid = partnerRel.contactuuid + join hs_office.person partnerPerson on partnerPerson.uuid = partnerRel.holderuuid + left join hs_office.partner_details_rv partnerDetails on partnerDetails.uuid = partner.detailsuuid + where :name is null + or (partnerDetails.uuid is not null and partnerDetails.birthname like (cast(:name as text) || '%') escape '') + or contact.caption like (cast(:name as text) || '%') escape '' + or partnerPerson.tradename like (cast(:name as text) || '%') escape '' + or partnerPerson.givenname like (cast(:name as text) || '%') escape '' + or partnerPerson.familyname like (cast(:name as text) || '%') escape '' + """, nativeQuery = true) + @Timed("app.office.partners.repo.findPartnerByOptionalNameLike.real") + List findPartnerByOptionalNameLike(String name); + + @Timed("app.office.partners.repo.findPartnerByPartnerNumber.real") + Optional findPartnerByPartnerNumber(Integer partnerNumber); + + @Timed("app.office.partners.repo.save.real") + HsOfficePartnerRealEntity save(final HsOfficePartnerRealEntity entity); +} diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java index 35547e1d..f4095e5b 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java @@ -10,7 +10,7 @@ import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorEntity; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipStatus; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerDetailsEntity; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation; @@ -84,7 +84,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport { static Map contacts = new WriteOnceMap<>(); static Map persons = new WriteOnceMap<>(); - static Map partners = new WriteOnceMap<>(); + static Map partners = new WriteOnceMap<>(); static Map debitors = new WriteOnceMap<>(); static Map memberships = new WriteOnceMap<>(); @@ -743,7 +743,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport { null // is set during contacts import depending on assigned roles ); - final var partner = HsOfficePartnerRbacEntity.builder() + final var partner = HsOfficePartnerRealEntity.builder() .partnerNumber(rec.getInteger("member_id")) .details(HsOfficePartnerDetailsEntity.builder().build()) .partnerRel(partnerRel) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java index 1e2cfa63..45b2e30d 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java @@ -4,7 +4,7 @@ import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipRepository; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealEntity; import net.hostsharing.hsadminng.mapper.StrictMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; import net.hostsharing.hsadminng.rbac.test.JsonBuilder; @@ -67,7 +67,7 @@ class HsOfficeCoopAssetsTransactionControllerRestTest { private static final String ORIGIN_MEMBER_NUMBER = "M-1111100"; public final HsOfficeMembershipEntity ORIGIN_TARGET_MEMBER_ENTITY = HsOfficeMembershipEntity.builder() .uuid(ORIGIN_MEMBERSHIP_UUID) - .partner(HsOfficePartnerRbacEntity.builder() + .partner(HsOfficePartnerRealEntity.builder() .partnerNumber(partnerNumberOf(ORIGIN_MEMBER_NUMBER)) .build()) .memberNumberSuffix(suffixOf(ORIGIN_MEMBER_NUMBER)) @@ -77,7 +77,7 @@ class HsOfficeCoopAssetsTransactionControllerRestTest { private static final String AVAILABLE_TARGET_MEMBER_NUMBER = "M-1234500"; public final HsOfficeMembershipEntity AVAILABLE_MEMBER_ENTITY = HsOfficeMembershipEntity.builder() .uuid(AVAILABLE_TARGET_MEMBERSHIP_UUID) - .partner(HsOfficePartnerRbacEntity.builder() + .partner(HsOfficePartnerRealEntity.builder() .partnerNumber(partnerNumberOf(AVAILABLE_TARGET_MEMBER_NUMBER)) .build()) .memberNumberSuffix(suffixOf(AVAILABLE_TARGET_MEMBER_NUMBER)) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityUnitTest.java index 023fcc6b..468e7006 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityUnitTest.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.hs.office.debitor; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; @@ -30,7 +30,7 @@ class HsOfficeDebitorEntityUnitTest { .debitorNumberSuffix("67") .debitorRel(givenDebitorRel) .defaultPrefix("som") - .partner(HsOfficePartnerRbacEntity.builder() + .partner(HsOfficePartnerRealEntity.builder() .partnerNumber(12345) .build()) .build(); @@ -45,7 +45,7 @@ class HsOfficeDebitorEntityUnitTest { final var given = HsOfficeDebitorEntity.builder() .debitorRel(givenDebitorRel) .debitorNumberSuffix("67") - .partner(HsOfficePartnerRbacEntity.builder() + .partner(HsOfficePartnerRealEntity.builder() .partnerNumber(12345) .build()) .build(); @@ -60,7 +60,7 @@ class HsOfficeDebitorEntityUnitTest { final var given = HsOfficeDebitorEntity.builder() .debitorRel(givenDebitorRel) .debitorNumberSuffix("67") - .partner(HsOfficePartnerRbacEntity.builder() + .partner(HsOfficePartnerRealEntity.builder() .partnerNumber(12345) .build()) .build(); @@ -88,7 +88,7 @@ class HsOfficeDebitorEntityUnitTest { final var given = HsOfficeDebitorEntity.builder() .debitorRel(givenDebitorRel) .debitorNumberSuffix("67") - .partner(HsOfficePartnerRbacEntity.builder().build()) + .partner(HsOfficePartnerRealEntity.builder().build()) .build(); final var result = given.getTaggedDebitorNumber(); @@ -101,7 +101,7 @@ class HsOfficeDebitorEntityUnitTest { final var given = HsOfficeDebitorEntity.builder() .debitorRel(givenDebitorRel) .debitorNumberSuffix(null) - .partner(HsOfficePartnerRbacEntity.builder() + .partner(HsOfficePartnerRealEntity.builder() .partnerNumber(12345) .build()) .build(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java index c3537f74..7989cf74 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java @@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.debitor; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountRepository; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; @@ -48,7 +48,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean HsOfficeDebitorRepository debitorRepo; @Autowired - HsOfficePartnerRbacRepository partnerRepo; + HsOfficePartnerRealRepository partnerRepo; @Autowired HsOfficeContactRealRepository contactRealRepo; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/TestHsOfficeDebitor.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/TestHsOfficeDebitor.java index cd6233dc..a0dcb83d 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/TestHsOfficeDebitor.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/TestHsOfficeDebitor.java @@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import static net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealTestEntity.TEST_REAL_CONTACT; -import static net.hostsharing.hsadminng.hs.office.partner.TestHsOfficePartner.TEST_PARTNER; +import static net.hostsharing.hsadminng.hs.office.partner.HsOfficeTestRealPartner.TEST_PARTNER; @UtilityClass public class TestHsOfficeDebitor { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerAcceptanceTest.java index ed7a8925..a2306ba8 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerAcceptanceTest.java @@ -5,7 +5,7 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealRepository; import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import net.hostsharing.hsadminng.config.DisableSecurityConfig; @@ -54,7 +54,7 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle HsOfficeMembershipRepository membershipRepo; @Autowired - HsOfficePartnerRbacRepository partnerRepo; + HsOfficePartnerRealRepository partnerRepo; @Autowired JpaAttempt jpaAttempt; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerRestTest.java index 54ffbd85..eda9a0c8 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipControllerRestTest.java @@ -4,6 +4,7 @@ import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionRepository; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealEntity; import net.hostsharing.hsadminng.mapper.StrictMapper; import net.hostsharing.hsadminng.persistence.EntityManagerWrapper; import net.hostsharing.hsadminng.config.DisableSecurityConfig; @@ -39,7 +40,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @ActiveProfiles("test") public class HsOfficeMembershipControllerRestTest { - private static final HsOfficePartnerRbacEntity PARTNER_12345 = HsOfficePartnerRbacEntity.builder() + private static final HsOfficePartnerRealEntity PARTNER_12345 = HsOfficePartnerRealEntity.builder() .partnerNumber(12345) .build(); public static final HsOfficeMembershipEntity MEMBERSHIP_1234501 = HsOfficeMembershipEntity.builder() diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java index e5ffccfe..f631e24a 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityPatcherUnitTest.java @@ -17,7 +17,7 @@ import java.time.LocalDate; import java.util.UUID; import java.util.stream.Stream; -import static net.hostsharing.hsadminng.hs.office.partner.TestHsOfficePartner.TEST_PARTNER; +import static net.hostsharing.hsadminng.hs.office.partner.HsOfficeTestRealPartner.TEST_PARTNER; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityUnitTest.java index 49219290..975ca8d0 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipEntityUnitTest.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.hs.office.membership; import io.hypersistence.utils.hibernate.type.range.Range; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealEntity; import net.hostsharing.hsadminng.rbac.generator.RbacViewMermaidFlowchartGenerator; import org.junit.jupiter.api.Test; @@ -10,7 +10,7 @@ import java.lang.reflect.InvocationTargetException; import java.time.LocalDate; import java.util.Arrays; -import static net.hostsharing.hsadminng.hs.office.partner.TestHsOfficePartner.TEST_PARTNER; +import static net.hostsharing.hsadminng.hs.office.partner.HsOfficeTestRealPartner.TEST_PARTNER; import static org.assertj.core.api.Assertions.assertThat; class HsOfficeMembershipEntityUnitTest { @@ -57,7 +57,7 @@ class HsOfficeMembershipEntityUnitTest { @Test void getMemberNumberWithoutPartnerNumberButWithSuffix() { - givenMembership.setPartner(HsOfficePartnerRbacEntity.builder().build()); + givenMembership.setPartner(HsOfficePartnerRealEntity.builder().build()); final var result = givenMembership.getMemberNumber(); assertThat(result).isEqualTo(null); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepositoryIntegrationTest.java index 04be5edd..44713c61 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepositoryIntegrationTest.java @@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.membership; import io.hypersistence.utils.hibernate.type.range.Range; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository; -import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository; +import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRealRepository; import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.grant.RawRbacGrantRepository; import net.hostsharing.hsadminng.rbac.role.RawRbacRoleRepository; @@ -37,7 +37,7 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTestWithCl HsOfficeMembershipRepository membershipRepo; @Autowired - HsOfficePartnerRbacRepository partnerRepo; + HsOfficePartnerRealRepository partnerRepo; @Autowired HsOfficeDebitorRepository debitorRepo; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/TestHsMembership.java b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/TestHsMembership.java index 857e9369..416a29ff 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/membership/TestHsMembership.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/membership/TestHsMembership.java @@ -4,7 +4,7 @@ import io.hypersistence.utils.hibernate.type.range.Range; import java.time.LocalDate; -import static net.hostsharing.hsadminng.hs.office.partner.TestHsOfficePartner.TEST_PARTNER; +import static net.hostsharing.hsadminng.hs.office.partner.HsOfficeTestRealPartner.TEST_PARTNER; public class TestHsMembership { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/TestHsOfficePartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficeTestRealPartner.java similarity index 87% rename from src/test/java/net/hostsharing/hsadminng/hs/office/partner/TestHsOfficePartner.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficeTestRealPartner.java index 560ab443..630a1782 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/TestHsOfficePartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficeTestRealPartner.java @@ -7,12 +7,12 @@ import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; import static net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType.LEGAL_PERSON; -public class TestHsOfficePartner { +public class HsOfficeTestRealPartner { - public static final HsOfficePartnerRbacEntity TEST_PARTNER = hsOfficePartnerWithLegalPerson("Test Ltd."); + public static final HsOfficePartnerRealEntity TEST_PARTNER = hsOfficePartnerWithLegalPerson("Test Ltd."); - static public HsOfficePartnerRbacEntity hsOfficePartnerWithLegalPerson(final String tradeName) { - return HsOfficePartnerRbacEntity.builder() + static public HsOfficePartnerRealEntity hsOfficePartnerWithLegalPerson(final String tradeName) { + return HsOfficePartnerRealEntity.builder() .partnerNumber(10001) .partnerRel( HsOfficeRelationRealEntity.builder()