split PersonEntity/Repo into Rbac and Real Entity/Repo and use in Relation for faster lazy loading #130
@ -36,7 +36,7 @@ public interface HsOfficeDebitorRepository extends Repository<HsOfficeDebitorEnt
|
||||
JOIN HsOfficePartnerEntity partner
|
||||
ON partner.partnerRel.holder = debitor.debitorRel.anchor
|
||||
AND partner.partnerRel.type = 'PARTNER' AND debitor.debitorRel.type = 'DEBITOR'
|
||||
JOIN HsOfficePersonEntity person
|
||||
JOIN HsOfficePersonRealEntity person
|
||||
ON person.uuid = partner.partnerRel.holder.uuid
|
||||
OR person.uuid = debitor.debitorRel.holder.uuid
|
||||
JOIN HsOfficeContactRealEntity contact
|
||||
|
@ -9,7 +9,7 @@ import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartne
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerPatchResource;
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerResource;
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerRelInsertResource;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType;
|
||||
@ -166,8 +166,8 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
|
||||
private HsOfficeRelationRealEntity persistPartnerRel(final HsOfficePartnerRelInsertResource resource) {
|
||||
final var entity = new HsOfficeRelationRealEntity();
|
||||
entity.setType(HsOfficeRelationType.PARTNER);
|
||||
entity.setAnchor(ref(HsOfficePersonEntity.class, resource.getAnchorUuid()));
|
||||
entity.setHolder(ref(HsOfficePersonEntity.class, resource.getHolderUuid()));
|
||||
entity.setAnchor(ref(HsOfficePersonRealEntity.class, resource.getAnchorUuid()));
|
||||
entity.setHolder(ref(HsOfficePersonRealEntity.class, resource.getHolderUuid()));
|
||||
entity.setContact(ref(HsOfficeContactRealEntity.class, resource.getContactUuid()));
|
||||
em.persist(entity);
|
||||
return entity;
|
||||
|
@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import net.hostsharing.hsadminng.errors.DisplayAs;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContact;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
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;
|
||||
@ -51,7 +51,7 @@ public class HsOfficePartnerEntity implements Stringifyable, BaseEntity<HsOffice
|
||||
.withIdProp(HsOfficePartnerEntity::toShortString)
|
||||
.withProp(p -> ofNullable(p.getPartnerRel())
|
||||
.map(HsOfficeRelation::getHolder)
|
||||
.map(HsOfficePersonEntity::toShortString)
|
||||
.map(HsOfficePerson::toShortString)
|
||||
.orElse(null))
|
||||
.withProp(p -> ofNullable(p.getPartnerRel())
|
||||
.map(HsOfficeRelation::getContact)
|
||||
|
@ -20,7 +20,7 @@ public interface HsOfficePartnerRepository extends Repository<HsOfficePartnerEnt
|
||||
SELECT partner FROM HsOfficePartnerEntity partner
|
||||
JOIN HsOfficeRelationRealEntity rel ON rel.uuid = partner.partnerRel.uuid
|
||||
JOIN HsOfficeContactRealEntity contact ON contact.uuid = rel.contact.uuid
|
||||
JOIN HsOfficePersonEntity person ON person.uuid = rel.holder.uuid
|
||||
JOIN HsOfficePersonRealEntity person ON person.uuid = rel.holder.uuid
|
||||
WHERE :name is null
|
||||
OR partner.details.birthName like concat(cast(:name as text), '%')
|
||||
OR contact.caption like concat(cast(:name as text), '%')
|
||||
|
@ -27,7 +27,7 @@ public class HsOfficePersonController implements HsOfficePersonsApi {
|
||||
private StandardMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private HsOfficePersonRepository personRepo;
|
||||
private HsOfficePersonRbacRepository personRepo;
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
@ -54,7 +54,7 @@ public class HsOfficePersonController implements HsOfficePersonsApi {
|
||||
|
||||
context.define(currentSubject, assumedRoles);
|
||||
|
||||
final var entityToSave = mapper.map(body, HsOfficePersonEntity.class);
|
||||
final var entityToSave = mapper.map(body, HsOfficePersonRbacEntity.class);
|
||||
|
||||
final var saved = personRepo.save(entityToSave);
|
||||
|
||||
|
@ -1,103 +0,0 @@
|
||||
package net.hostsharing.hsadminng.hs.office.person;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import net.hostsharing.hsadminng.errors.DisplayAs;
|
||||
import net.hostsharing.hsadminng.persistence.BaseEntity;
|
||||
import net.hostsharing.hsadminng.rbac.generator.RbacView;
|
||||
import net.hostsharing.hsadminng.rbac.generator.RbacView.SQL;
|
||||
import net.hostsharing.hsadminng.repr.Stringify;
|
||||
import net.hostsharing.hsadminng.repr.Stringifyable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.GLOBAL;
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.Permission.*;
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.RbacSubjectReference.UserRole.CREATOR;
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.Role.*;
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.rbacViewFor;
|
||||
import static net.hostsharing.hsadminng.repr.Stringify.stringify;
|
||||
|
||||
// TODO.refa: split HsOfficePersonEntity into Real+Rbac-Entity
|
||||
@Entity
|
||||
@Table(schema = "hs_office", name = "person_rv")
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@FieldNameConstants
|
||||
@DisplayAs("Person")
|
||||
public class HsOfficePersonEntity implements BaseEntity<HsOfficePersonEntity>, Stringifyable {
|
||||
|
||||
private static Stringify<HsOfficePersonEntity> toString = stringify(HsOfficePersonEntity.class, "person")
|
||||
.withProp(Fields.personType, HsOfficePersonEntity::getPersonType)
|
||||
.withProp(Fields.tradeName, HsOfficePersonEntity::getTradeName)
|
||||
.withProp(Fields.salutation, HsOfficePersonEntity::getSalutation)
|
||||
.withProp(Fields.title, HsOfficePersonEntity::getTitle)
|
||||
.withProp(Fields.familyName, HsOfficePersonEntity::getFamilyName)
|
||||
.withProp(Fields.givenName, HsOfficePersonEntity::getGivenName);
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private UUID uuid;
|
||||
|
||||
@Version
|
||||
private int version;
|
||||
|
||||
@Column(name = "persontype")
|
||||
private HsOfficePersonType personType;
|
||||
|
||||
@Column(name = "tradename")
|
||||
private String tradeName;
|
||||
|
||||
@Column(name = "salutation")
|
||||
private String salutation;
|
||||
|
||||
@Column(name = "title")
|
||||
private String title;
|
||||
|
||||
@Column(name = "familyname")
|
||||
private String familyName;
|
||||
|
||||
@Column(name = "givenname")
|
||||
private String givenName;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString.apply(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toShortString() {
|
||||
return personType + " " +
|
||||
(!StringUtils.isEmpty(tradeName) ? tradeName : (familyName + ", " + givenName));
|
||||
}
|
||||
|
||||
public static RbacView rbac() {
|
||||
return rbacViewFor("person", HsOfficePersonEntity.class)
|
||||
.withIdentityView(SQL.projection("concat(tradeName, familyName, givenName)"))
|
||||
.withUpdatableColumns("personType", "title", "salutation", "tradeName", "givenName", "familyName")
|
||||
.toRole(GLOBAL, GUEST).grantPermission(INSERT)
|
||||
|
||||
.createRole(OWNER, (with) -> {
|
||||
with.permission(DELETE);
|
||||
with.owningUser(CREATOR);
|
||||
with.incomingSuperRole(GLOBAL, ADMIN);
|
||||
})
|
||||
.createSubRole(ADMIN, (with) -> {
|
||||
with.permission(UPDATE);
|
||||
})
|
||||
.createSubRole(REFERRER, (with) -> {
|
||||
with.permission(SELECT);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
rbac().generateWithBaseFileName("5-hs-office/502-person/5023-hs-office-person-rbac");
|
||||
}
|
||||
}
|
@ -9,9 +9,9 @@ import java.util.Optional;
|
||||
|
||||
class HsOfficePersonEntityPatcher implements EntityPatcher<HsOfficePersonPatchResource> {
|
||||
|
||||
private final HsOfficePersonEntity entity;
|
||||
private final HsOfficePersonRbacEntity entity;
|
||||
|
||||
HsOfficePersonEntityPatcher(final HsOfficePersonEntity entity) {
|
||||
HsOfficePersonEntityPatcher(final HsOfficePersonRbacEntity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,52 @@
|
||||
package net.hostsharing.hsadminng.hs.office.person;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import net.hostsharing.hsadminng.errors.DisplayAs;
|
||||
import net.hostsharing.hsadminng.rbac.generator.RbacView;
|
||||
import net.hostsharing.hsadminng.rbac.generator.RbacView.SQL;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.GLOBAL;
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.Permission.*;
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.RbacSubjectReference.UserRole.CREATOR;
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.Role.*;
|
||||
import static net.hostsharing.hsadminng.rbac.generator.RbacView.rbacViewFor;
|
||||
|
||||
@Entity
|
||||
@Table(schema = "hs_office", name = "person_rv")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder(toBuilder = true)
|
||||
@FieldNameConstants
|
||||
@DisplayAs("RbacPerson")
|
||||
public class HsOfficePersonRbacEntity extends HsOfficePerson<HsOfficePersonRbacEntity> {
|
||||
|
||||
public static RbacView rbac() {
|
||||
return rbacViewFor("person", HsOfficePersonRbacEntity.class)
|
||||
.withIdentityView(SQL.projection("concat(tradeName, familyName, givenName)"))
|
||||
.withUpdatableColumns("personType", "title", "salutation", "tradeName", "givenName", "familyName")
|
||||
.toRole(GLOBAL, GUEST).grantPermission(INSERT)
|
||||
|
||||
.createRole(OWNER, (with) -> {
|
||||
with.permission(DELETE);
|
||||
with.owningUser(CREATOR);
|
||||
with.incomingSuperRole(GLOBAL, ADMIN);
|
||||
})
|
||||
.createSubRole(ADMIN, (with) -> {
|
||||
with.permission(UPDATE);
|
||||
})
|
||||
.createSubRole(REFERRER, (with) -> {
|
||||
with.permission(SELECT);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
rbac().generateWithBaseFileName("5-hs-office/502-person/5023-hs-office-person-rbac");
|
||||
}
|
||||
}
|
@ -8,23 +8,23 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface HsOfficePersonRepository extends Repository<HsOfficePersonEntity, UUID> {
|
||||
public interface HsOfficePersonRbacRepository extends Repository<HsOfficePersonRbacEntity, UUID> {
|
||||
|
||||
@Timed("app.office.persons.repo.findByUuid.rbac")
|
||||
Optional<HsOfficePersonEntity> findByUuid(UUID personUuid);
|
||||
Optional<HsOfficePersonRbacEntity> findByUuid(UUID personUuid);
|
||||
|
||||
@Query("""
|
||||
SELECT p FROM HsOfficePersonEntity p
|
||||
SELECT p FROM HsOfficePersonRbacEntity p
|
||||
WHERE :name is null
|
||||
OR p.tradeName like concat(cast(:name as text), '%')
|
||||
OR p.givenName like concat(cast(:name as text), '%')
|
||||
OR p.familyName like concat(cast(:name as text), '%')
|
||||
""")
|
||||
@Timed("app.office.persons.repo.findPersonByOptionalNameLike.rbac")
|
||||
List<HsOfficePersonEntity> findPersonByOptionalNameLike(String name);
|
||||
List<HsOfficePersonRbacEntity> findPersonByOptionalNameLike(String name);
|
||||
|
||||
@Timed("app.office.persons.repo.save.rbac")
|
||||
HsOfficePersonEntity save(final HsOfficePersonEntity entity);
|
||||
HsOfficePersonRbacEntity save(final HsOfficePersonRbacEntity entity);
|
||||
|
||||
@Timed("app.office.persons.repo.deleteByUuid.rbac")
|
||||
int deleteByUuid(final UUID personUuid);
|
@ -0,0 +1,23 @@
|
||||
package net.hostsharing.hsadminng.hs.office.person;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import net.hostsharing.hsadminng.errors.DisplayAs;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(schema = "hs_office", name = "person")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder(toBuilder = true)
|
||||
@FieldNameConstants
|
||||
@DisplayAs("RealPerson")
|
||||
public class HsOfficePersonRealEntity extends HsOfficePerson<HsOfficePersonRealEntity> {
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package net.hostsharing.hsadminng.hs.office.person;
|
||||
|
||||
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 HsOfficePersonRealRepository extends Repository<HsOfficePersonRealEntity, UUID> {
|
||||
|
||||
@Timed("app.office.persons.repo.findByUuid.rbac")
|
||||
Optional<HsOfficePersonRealEntity> findByUuid(UUID personUuid);
|
||||
|
||||
@Query("""
|
||||
SELECT p FROM HsOfficePersonRbacEntity p
|
||||
WHERE :name is null
|
||||
OR p.tradeName like concat(cast(:name as text), '%')
|
||||
OR p.givenName like concat(cast(:name as text), '%')
|
||||
OR p.familyName like concat(cast(:name as text), '%')
|
||||
""")
|
||||
@Timed("app.office.persons.repo.findPersonByOptionalNameLike.rbac")
|
||||
List<HsOfficePersonRealEntity> findPersonByOptionalNameLike(String name);
|
||||
|
||||
@Timed("app.office.persons.repo.save.rbac")
|
||||
HsOfficePersonRealEntity save(final HsOfficePersonRealEntity entity);
|
||||
|
||||
@Timed("app.office.persons.repo.deleteByUuid.rbac")
|
||||
int deleteByUuid(final UUID personUuid);
|
||||
|
||||
@Timed("app.office.persons.repo.count.rbac")
|
||||
long count();
|
||||
}
|
@ -4,7 +4,7 @@ import lombok.*;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||
import net.hostsharing.hsadminng.persistence.BaseEntity;
|
||||
import net.hostsharing.hsadminng.repr.Stringify;
|
||||
import net.hostsharing.hsadminng.repr.Stringifyable;
|
||||
@ -45,11 +45,11 @@ public class HsOfficeRelation implements BaseEntity<HsOfficeRelation>, Stringify
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "anchoruuid")
|
||||
private HsOfficePersonEntity anchor;
|
||||
private HsOfficePersonRealEntity anchor;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "holderuuid")
|
||||
private HsOfficePersonEntity holder;
|
||||
private HsOfficePersonRealEntity holder;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "contactuuid")
|
||||
|
@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.context.Context;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeRelationsApi;
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.*;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
||||
import net.hostsharing.hsadminng.mapper.StandardMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -34,7 +34,7 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
||||
private HsOfficeRelationRbacRepository relationRbacRepo;
|
||||
|
||||
@Autowired
|
||||
private HsOfficePersonRepository holderRepo;
|
||||
private HsOfficePersonRealRepository personRepo;
|
||||
|
||||
@Autowired
|
||||
private HsOfficeContactRealRepository realContactRepo;
|
||||
@ -78,10 +78,10 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
||||
final var entityToSave = new HsOfficeRelationRbacEntity();
|
||||
entityToSave.setType(HsOfficeRelationType.valueOf(body.getType()));
|
||||
entityToSave.setMark(body.getMark());
|
||||
entityToSave.setAnchor(holderRepo.findByUuid(body.getAnchorUuid()).orElseThrow(
|
||||
entityToSave.setAnchor(personRepo.findByUuid(body.getAnchorUuid()).orElseThrow(
|
||||
() -> new NoSuchElementException("cannot find Person by anchorUuid: " + body.getAnchorUuid())
|
||||
));
|
||||
entityToSave.setHolder(holderRepo.findByUuid(body.getHolderUuid()).orElseThrow(
|
||||
entityToSave.setHolder(personRepo.findByUuid(body.getHolderUuid()).orElseThrow(
|
||||
() -> new NoSuchElementException("cannot find Person by holderUuid: " + body.getHolderUuid())
|
||||
));
|
||||
entityToSave.setContact(realContactRepo.findByUuid(body.getContactUuid()).orElseThrow(
|
||||
|
@ -6,7 +6,7 @@ import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import net.hostsharing.hsadminng.errors.DisplayAs;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacEntity;
|
||||
import net.hostsharing.hsadminng.rbac.generator.RbacView;
|
||||
import net.hostsharing.hsadminng.rbac.generator.RbacView.SQL;
|
||||
|
||||
@ -52,11 +52,11 @@ public class HsOfficeRelationRbacEntity extends HsOfficeRelation {
|
||||
.withRestrictedViewOrderBy(SQL.expression(
|
||||
"(select idName from hs_office.person_iv p where p.uuid = target.holderUuid)"))
|
||||
.withUpdatableColumns("contactUuid")
|
||||
.importEntityAlias("anchorPerson", HsOfficePersonEntity.class, usingDefaultCase(),
|
||||
.importEntityAlias("anchorPerson", HsOfficePersonRbacEntity.class, usingDefaultCase(),
|
||||
dependsOnColumn("anchorUuid"),
|
||||
directlyFetchedByDependsOnColumn(),
|
||||
NOT_NULL)
|
||||
.importEntityAlias("holderPerson", HsOfficePersonEntity.class, usingDefaultCase(),
|
||||
.importEntityAlias("holderPerson", HsOfficePersonRbacEntity.class, usingDefaultCase(),
|
||||
dependsOnColumn("holderUuid"),
|
||||
directlyFetchedByDependsOnColumn(),
|
||||
NOT_NULL)
|
||||
|
@ -11,7 +11,7 @@ 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.HsOfficePartnerEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
@ -81,7 +81,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
|
||||
);
|
||||
|
||||
static Map<Integer, HsOfficeContactRealEntity> contacts = new WriteOnceMap<>();
|
||||
static Map<Integer, HsOfficePersonEntity> persons = new WriteOnceMap<>();
|
||||
static Map<Integer, HsOfficePersonRealEntity> persons = new WriteOnceMap<>();
|
||||
static Map<Integer, HsOfficePartnerEntity> partners = new WriteOnceMap<>();
|
||||
static Map<Integer, HsOfficeDebitorEntity> debitors = new WriteOnceMap<>();
|
||||
static Map<Integer, HsOfficeMembershipEntity> memberships = new WriteOnceMap<>();
|
||||
@ -731,7 +731,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
|
||||
return;
|
||||
}
|
||||
|
||||
final var person = HsOfficePersonEntity.builder().build();
|
||||
final var person = HsOfficePersonRealEntity.builder().build();
|
||||
|
||||
final var partnerRel = addRelation(
|
||||
HsOfficeRelationType.PARTNER,
|
||||
@ -994,14 +994,14 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
|
||||
addPerson(partnerPerson, rec);
|
||||
}
|
||||
|
||||
HsOfficePersonEntity contactPerson = partnerPerson;
|
||||
HsOfficePersonRealEntity contactPerson = partnerPerson;
|
||||
if (!StringUtils.equals(rec.getString("firma"), partnerPerson.getTradeName()) ||
|
||||
partnerPerson.getPersonType() != determinePersonType(rec) ||
|
||||
!StringUtils.equals(rec.getString("title"), partnerPerson.getTitle()) ||
|
||||
!StringUtils.equals(rec.getString("salut"), partnerPerson.getSalutation()) ||
|
||||
!StringUtils.equals(rec.getString("first_name"), partnerPerson.getGivenName()) ||
|
||||
!StringUtils.equals(rec.getString("last_name"), partnerPerson.getFamilyName())) {
|
||||
contactPerson = addPerson(HsOfficePersonEntity.builder().build(), rec);
|
||||
contactPerson = addPerson(HsOfficePersonRealEntity.builder().build(), rec);
|
||||
}
|
||||
|
||||
final var contact = HsOfficeContactRealEntity.builder().build();
|
||||
@ -1084,8 +1084,8 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
|
||||
|
||||
private static HsOfficeRelationRealEntity addRelation(
|
||||
final HsOfficeRelationType type,
|
||||
final HsOfficePersonEntity anchor,
|
||||
final HsOfficePersonEntity holder,
|
||||
final HsOfficePersonRealEntity anchor,
|
||||
final HsOfficePersonRealEntity holder,
|
||||
final HsOfficeContactRealEntity contact) {
|
||||
final var rel = HsOfficeRelationRealEntity.builder()
|
||||
.anchor(anchor)
|
||||
@ -1097,7 +1097,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
|
||||
return rel;
|
||||
}
|
||||
|
||||
private HsOfficePersonEntity addPerson(final HsOfficePersonEntity person, final Record contactRecord) {
|
||||
private HsOfficePersonRealEntity addPerson(final HsOfficePersonRealEntity person, final Record contactRecord) {
|
||||
person.setSalutation(contactRecord.getString("salut"));
|
||||
person.setTitle(contactRecord.getString("title"));
|
||||
person.setGivenName(contactRecord.getString("first_name"));
|
||||
|
@ -7,7 +7,7 @@ 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.HsOfficePartnerRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository;
|
||||
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
|
||||
@ -57,16 +57,16 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
HsOfficePartnerRepository partnerRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficeContactRealRepository contactrealRepo;
|
||||
HsOfficeContactRealRepository contactRealRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficeBankAccountRepository bankAccountRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRealRepository personRealRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficeRelationRealRepository relrealRepo;
|
||||
HsOfficeRelationRealRepository relationRealRepo;
|
||||
|
||||
@Autowired
|
||||
JpaAttempt jpaAttempt;
|
||||
@ -270,13 +270,13 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Third").get(0);
|
||||
final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0);
|
||||
final var givenContact = contactRealRepo.findContactByOptionalCaptionLike("fourth").get(0);
|
||||
final var givenBankAccount = bankAccountRepo.findByOptionalHolderLike("Fourth").get(0);
|
||||
final var givenBillingPerson = personRepo.findPersonByOptionalNameLike("Fourth").get(0);
|
||||
final var givenBillingPerson = personRealRepo.findPersonByOptionalNameLike("Fourth").get(0);
|
||||
|
||||
final var givenDebitorRelUUid = jpaAttempt.transacted(() -> {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
return relrealRepo.save(HsOfficeRelationRealEntity.builder()
|
||||
return relationRealRepo.save(HsOfficeRelationRealEntity.builder()
|
||||
.type(DEBITOR)
|
||||
.anchor(givenPartner.getPartnerRel().getHolder())
|
||||
.holder(givenBillingPerson)
|
||||
@ -327,7 +327,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Third").get(0);
|
||||
final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0);
|
||||
final var givenContact = contactRealRepo.findContactByOptionalCaptionLike("fourth").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -554,7 +554,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenDebitor = givenSomeTemporaryDebitor();
|
||||
final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0);
|
||||
final var givenContact = contactRealRepo.findContactByOptionalCaptionLike("fourth").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -724,7 +724,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
return jpaAttempt.transacted(() -> {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Fourth").get(0).load();
|
||||
final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth contact").get(0);
|
||||
final var givenContact = contactRealRepo.findContactByOptionalCaptionLike("fourth contact").get(0);
|
||||
final var newDebitor = HsOfficeDebitorEntity.builder()
|
||||
.debitorNumberSuffix(nextDebitorSuffix())
|
||||
.billable(true)
|
||||
|
@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.debitor;
|
||||
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.rbac.generator.RbacViewMermaidFlowchartGenerator;
|
||||
@ -13,11 +13,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class HsOfficeDebitorEntityUnitTest {
|
||||
|
||||
private final HsOfficeRelationRealEntity givenDebitorRel = HsOfficeRelationRealEntity.builder()
|
||||
.anchor(HsOfficePersonEntity.builder()
|
||||
.anchor(HsOfficePersonRealEntity.builder()
|
||||
.personType(HsOfficePersonType.LEGAL_PERSON)
|
||||
.tradeName("some partner trade name")
|
||||
.build())
|
||||
.holder(HsOfficePersonEntity.builder()
|
||||
.holder(HsOfficePersonRealEntity.builder()
|
||||
.personType(HsOfficePersonType.LEGAL_PERSON)
|
||||
.tradeName("some billing trade name")
|
||||
.build())
|
||||
|
@ -4,7 +4,7 @@ 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.HsOfficePartnerRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType;
|
||||
@ -53,7 +53,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
HsOfficeContactRealRepository contactrealRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRealRepository personRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficeBankAccountRepository bankAccountRepo;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.hostsharing.hsadminng.hs.office.debitor;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
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;
|
||||
@ -15,8 +15,8 @@ public class TestHsOfficeDebitor {
|
||||
public static final HsOfficeDebitorEntity TEST_DEBITOR = HsOfficeDebitorEntity.builder()
|
||||
.debitorNumberSuffix(DEFAULT_DEBITOR_SUFFIX)
|
||||
.debitorRel(HsOfficeRelationRealEntity.builder()
|
||||
.holder(HsOfficePersonEntity.builder().build())
|
||||
.anchor(HsOfficePersonEntity.builder().build())
|
||||
.holder(HsOfficePersonRealEntity.builder().build())
|
||||
.anchor(HsOfficePersonRealEntity.builder().build())
|
||||
.contact(TEST_REAL_CONTACT)
|
||||
.build())
|
||||
.partner(TEST_PARTNER)
|
||||
|
@ -5,8 +5,8 @@ import io.restassured.http.ContentType;
|
||||
import net.hostsharing.hsadminng.HsadminNgApplication;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository;
|
||||
@ -48,7 +48,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
HsOfficeRelationRealRepository relationRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRealRepository personRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficeContactRealRepository contactrealRepo;
|
||||
@ -224,7 +224,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
// TODO.impl: we want this error message:
|
||||
// .body("message", is("ERROR: [400] Unable to find Person by uuid: " + GIVEN_NON_EXISTING_UUID));
|
||||
// but ModelMapper creates this error message:
|
||||
.body("message", is("ERROR: [400] Unable to find " + HsOfficePersonEntity.class.getName() + " with id " + GIVEN_NON_EXISTING_UUID));
|
||||
.body("message", is("ERROR: [400] Unable to find " + HsOfficePersonRbacEntity.class.getName() + " with id " + GIVEN_NON_EXISTING_UUID));
|
||||
// @formatter:on
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.partner;
|
||||
|
||||
import net.hostsharing.hsadminng.context.Context;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository;
|
||||
import net.hostsharing.hsadminng.mapper.StandardMapper;
|
||||
@ -66,10 +66,10 @@ class HsOfficePartnerControllerRestTest {
|
||||
EntityManagerFactory emf;
|
||||
|
||||
@Mock
|
||||
HsOfficePersonEntity mandateMock;
|
||||
HsOfficePersonRbacEntity mandateMock;
|
||||
|
||||
@Mock
|
||||
HsOfficePersonEntity personMock;
|
||||
HsOfficePersonRbacEntity personMock;
|
||||
|
||||
@Mock
|
||||
HsOfficeContactRbacEntity contactMock;
|
||||
@ -84,8 +84,8 @@ class HsOfficePartnerControllerRestTest {
|
||||
when(emf.createEntityManager(any(SynchronizationType.class))).thenReturn(em);
|
||||
when(emf.createEntityManager(any(SynchronizationType.class), any(Map.class))).thenReturn(em);
|
||||
|
||||
lenient().when(em.getReference(HsOfficePersonEntity.class, GIVEN_MANDANTE_UUID)).thenReturn(mandateMock);
|
||||
lenient().when(em.getReference(HsOfficePersonEntity.class, GIVEN_PERSON_UUID)).thenReturn(personMock);
|
||||
lenient().when(em.getReference(HsOfficePersonRbacEntity.class, GIVEN_MANDANTE_UUID)).thenReturn(mandateMock);
|
||||
lenient().when(em.getReference(HsOfficePersonRbacEntity.class, GIVEN_PERSON_UUID)).thenReturn(personMock);
|
||||
lenient().when(em.getReference(HsOfficeContactRbacEntity.class, GIVEN_CONTACT_UUID)).thenReturn(contactMock);
|
||||
lenient().when(em.getReference(any(), eq(GIVEN_INVALID_UUID))).thenThrow(EntityNotFoundException.class);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.partner;
|
||||
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerDetailsPatchResource;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacEntity;
|
||||
import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
@ -45,8 +45,8 @@ class HsOfficePartnerDetailsEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||
void initMocks() {
|
||||
lenient().when(em.getReference(eq(HsOfficeContactRbacEntity.class), any())).thenAnswer(invocation ->
|
||||
HsOfficeContactRbacEntity.builder().uuid(invocation.getArgument(1)).build());
|
||||
lenient().when(em.getReference(eq(HsOfficePersonEntity.class), any())).thenAnswer(invocation ->
|
||||
HsOfficePersonEntity.builder().uuid(invocation.getArgument(1)).build());
|
||||
lenient().when(em.getReference(eq(HsOfficePersonRbacEntity.class), any())).thenAnswer(invocation ->
|
||||
HsOfficePersonRbacEntity.builder().uuid(invocation.getArgument(1)).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.partner;
|
||||
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerPatchResource;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@ -33,7 +33,7 @@ class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||
private static final UUID INITIAL_DETAILS_UUID = UUID.randomUUID();
|
||||
private static final UUID PATCHED_PARTNER_ROLE_UUID = UUID.randomUUID();
|
||||
|
||||
private final HsOfficePersonEntity givenInitialPerson = HsOfficePersonEntity.builder()
|
||||
private final HsOfficePersonRealEntity givenInitialPerson = HsOfficePersonRealEntity.builder()
|
||||
.uuid(INITIAL_PERSON_UUID)
|
||||
.build();
|
||||
private final HsOfficeContactRealEntity givenInitialContact = HsOfficeContactRealEntity.builder()
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.hostsharing.hsadminng.hs.office.partner;
|
||||
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType;
|
||||
@ -15,12 +15,12 @@ class HsOfficePartnerEntityUnitTest {
|
||||
private final HsOfficePartnerEntity givenPartner = HsOfficePartnerEntity.builder()
|
||||
.partnerNumber(12345)
|
||||
.partnerRel(HsOfficeRelationRealEntity.builder()
|
||||
.anchor(HsOfficePersonEntity.builder()
|
||||
.anchor(HsOfficePersonRealEntity.builder()
|
||||
.personType(HsOfficePersonType.LEGAL_PERSON)
|
||||
.tradeName("Hostsharing eG")
|
||||
.build())
|
||||
.type(HsOfficeRelationType.PARTNER)
|
||||
.holder(HsOfficePersonEntity.builder()
|
||||
.holder(HsOfficePersonRealEntity.builder()
|
||||
.personType(HsOfficePersonType.LEGAL_PERSON)
|
||||
.tradeName("some trade name")
|
||||
.build())
|
||||
|
@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.partner;
|
||||
|
||||
import net.hostsharing.hsadminng.context.Context;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType;
|
||||
@ -45,7 +45,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
HsOfficeRelationRealRepository relationRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRealRepository personRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficeContactRealRepository contactrealRepo;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.hostsharing.hsadminng.hs.office.partner;
|
||||
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType;
|
||||
|
||||
@ -16,12 +16,12 @@ public class TestHsOfficePartner {
|
||||
.partnerNumber(10001)
|
||||
.partnerRel(
|
||||
HsOfficeRelationRealEntity.builder()
|
||||
.holder(HsOfficePersonEntity.builder()
|
||||
.holder(HsOfficePersonRealEntity.builder()
|
||||
.personType(LEGAL_PERSON)
|
||||
.tradeName("Hostsharing eG")
|
||||
.build())
|
||||
.type(HsOfficeRelationType.PARTNER)
|
||||
.holder(HsOfficePersonEntity.builder()
|
||||
.holder(HsOfficePersonRealEntity.builder()
|
||||
.personType(LEGAL_PERSON)
|
||||
.tradeName(tradeName)
|
||||
.build())
|
||||
|
@ -43,7 +43,7 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
||||
Context contextMock;
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRealRepository personRepo;
|
||||
|
||||
@Autowired
|
||||
JpaAttempt jpaAttempt;
|
||||
@ -327,10 +327,10 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
||||
}
|
||||
}
|
||||
|
||||
private HsOfficePersonEntity givenSomeTemporaryPersonCreatedBy(final String creatingUser) {
|
||||
private HsOfficePersonRealEntity givenSomeTemporaryPersonCreatedBy(final String creatingUser) {
|
||||
return jpaAttempt.transacted(() -> {
|
||||
context.define(creatingUser);
|
||||
final var newPerson = HsOfficePersonEntity.builder()
|
||||
final var newPerson = HsOfficePersonRealEntity.builder()
|
||||
.uuid(UUID.randomUUID())
|
||||
.personType(HsOfficePersonType.LEGAL_PERSON)
|
||||
.tradeName("Temp " + Context.getCallerMethodNameFromStackFrame(2))
|
||||
@ -347,7 +347,7 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
||||
jpaAttempt.transacted(() -> {
|
||||
context.define("superuser-alex@hostsharing.net", null);
|
||||
em.createQuery("""
|
||||
DELETE FROM HsOfficePersonEntity p
|
||||
DELETE FROM HsOfficePersonRealEntity p
|
||||
WHERE p.tradeName LIKE 'Temp %' OR p.givenName LIKE 'Temp %'
|
||||
""").executeUpdate();
|
||||
}).assertSuccessful();
|
||||
|
@ -13,14 +13,14 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
|
||||
@TestInstance(PER_CLASS)
|
||||
class HsOfficePersonEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||
HsOfficePersonPatchResource,
|
||||
HsOfficePersonEntity
|
||||
HsOfficePersonRbacEntity
|
||||
> {
|
||||
|
||||
private static final UUID INITIAL_PERSON_UUID = UUID.randomUUID();
|
||||
|
||||
@Override
|
||||
protected HsOfficePersonEntity newInitialEntity() {
|
||||
final var entity = new HsOfficePersonEntity();
|
||||
protected HsOfficePersonRbacEntity newInitialEntity() {
|
||||
final var entity = new HsOfficePersonRbacEntity();
|
||||
entity.setUuid(INITIAL_PERSON_UUID);
|
||||
entity.setPersonType(HsOfficePersonType.LEGAL_PERSON);
|
||||
entity.setTradeName("initial trade name");
|
||||
@ -37,7 +37,7 @@ class HsOfficePersonEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HsOfficePersonEntityPatcher createPatcher(final HsOfficePersonEntity entity) {
|
||||
protected HsOfficePersonEntityPatcher createPatcher(final HsOfficePersonRbacEntity entity) {
|
||||
return new HsOfficePersonEntityPatcher(entity);
|
||||
}
|
||||
|
||||
@ -48,34 +48,34 @@ class HsOfficePersonEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||
"personType",
|
||||
HsOfficePersonPatchResource::setPersonType,
|
||||
HsOfficePersonTypeResource.INCORPORATED_FIRM,
|
||||
HsOfficePersonEntity::setPersonType,
|
||||
HsOfficePersonRbacEntity::setPersonType,
|
||||
HsOfficePersonType.INCORPORATED_FIRM)
|
||||
.notNullable(),
|
||||
new JsonNullableProperty<>(
|
||||
"tradeName",
|
||||
HsOfficePersonPatchResource::setTradeName,
|
||||
"patched trade name",
|
||||
HsOfficePersonEntity::setTradeName),
|
||||
HsOfficePersonRbacEntity::setTradeName),
|
||||
new JsonNullableProperty<>(
|
||||
"title",
|
||||
HsOfficePersonPatchResource::setTitle,
|
||||
"Dr. Patch.",
|
||||
HsOfficePersonEntity::setTitle),
|
||||
HsOfficePersonRbacEntity::setTitle),
|
||||
new JsonNullableProperty<>(
|
||||
"salutation",
|
||||
HsOfficePersonPatchResource::setSalutation,
|
||||
"Hallo Ini",
|
||||
HsOfficePersonEntity::setSalutation),
|
||||
HsOfficePersonRbacEntity::setSalutation),
|
||||
new JsonNullableProperty<>(
|
||||
"familyName",
|
||||
HsOfficePersonPatchResource::setFamilyName,
|
||||
"patched family name",
|
||||
HsOfficePersonEntity::setFamilyName),
|
||||
HsOfficePersonRbacEntity::setFamilyName),
|
||||
new JsonNullableProperty<>(
|
||||
"patched given name",
|
||||
HsOfficePersonPatchResource::setGivenName,
|
||||
"patched given name",
|
||||
HsOfficePersonEntity::setGivenName)
|
||||
HsOfficePersonRbacEntity::setGivenName)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void getDisplayReturnsTradeNameIfAvailable() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.personType(HsOfficePersonType.LEGAL_PERSON)
|
||||
.tradeName("some trade name")
|
||||
.build();
|
||||
@ -23,7 +23,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void getDisplayReturnsFamilyAndGivenNameIfNoTradeNameAvailable() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.personType(HsOfficePersonType.NATURAL_PERSON)
|
||||
.familyName("some family name")
|
||||
.givenName("some given name")
|
||||
@ -36,7 +36,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void toShortStringWithTradeNameReturnsTradeName() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.personType(HsOfficePersonType.LEGAL_PERSON)
|
||||
.tradeName("some trade name")
|
||||
.familyName("some family name")
|
||||
@ -50,7 +50,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void toShortStringWithoutTradeNameReturnsFamilyAndGivenName() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.personType(HsOfficePersonType.NATURAL_PERSON)
|
||||
.familyName("some family name")
|
||||
.givenName("some given name")
|
||||
@ -63,7 +63,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void toShortStringWithSalutationAndTitleReturnsSalutationAndTitle() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.personType(HsOfficePersonType.NATURAL_PERSON)
|
||||
.salutation("Frau")
|
||||
.title("Dr.")
|
||||
@ -78,7 +78,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void toShortStringWithSalutationAndWithoutTitleReturnsSalutation() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.personType(HsOfficePersonType.NATURAL_PERSON)
|
||||
.salutation("Frau")
|
||||
.familyName("some family name")
|
||||
@ -92,7 +92,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void toShortStringWithoutSalutationAndWithTitleReturnsTitle() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.personType(HsOfficePersonType.NATURAL_PERSON)
|
||||
.title("Dr. Dr.")
|
||||
.familyName("some family name")
|
||||
@ -106,7 +106,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void toStringWithAllFieldsReturnsAllButUuid() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.uuid(UUID.randomUUID())
|
||||
.personType(HsOfficePersonType.NATURAL_PERSON)
|
||||
.tradeName("some trade name")
|
||||
@ -122,7 +122,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void toStringSkipsNullFields() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.familyName("some family name")
|
||||
.givenName("some given name")
|
||||
.build();
|
||||
@ -133,7 +133,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
}
|
||||
@Test
|
||||
void toStringWithSalutationAndTitleRetursSalutationAndTitle() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.salutation("Herr")
|
||||
.title("Prof. Dr.")
|
||||
.familyName("some family name")
|
||||
@ -146,7 +146,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
}
|
||||
@Test
|
||||
void toStringWithSalutationAndWithoutTitleSkipsTitle() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.salutation("Herr")
|
||||
.familyName("some family name")
|
||||
.givenName("some given name")
|
||||
@ -159,7 +159,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void toStringWithoutSalutationAndWithTitleSkipsSalutation() {
|
||||
final var givenPersonEntity = HsOfficePersonEntity.builder()
|
||||
final var givenPersonEntity = HsOfficePersonRbacEntity.builder()
|
||||
.title("some title")
|
||||
.familyName("some family name")
|
||||
.givenName("some given name")
|
||||
@ -172,7 +172,7 @@ class HsOfficePersonEntityUnitTest {
|
||||
|
||||
@Test
|
||||
void definesRbac() {
|
||||
final var rbacFlowchart = new RbacViewMermaidFlowchartGenerator(HsOfficePersonEntity.rbac()).toString();
|
||||
final var rbacFlowchart = new RbacViewMermaidFlowchartGenerator(HsOfficePersonRbacEntity.rbac()).toString();
|
||||
assertThat(rbacFlowchart).isEqualTo("""
|
||||
%%{init:{'flowchart':{'htmlLabels':false}}}%%
|
||||
flowchart TB
|
||||
|
@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTestWithCleanup {
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRbacRepository personRepo;
|
||||
|
||||
@Autowired
|
||||
RawRbacRoleRepository rawRoleRepo;
|
||||
@ -64,7 +64,7 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTestWithCleanu
|
||||
|
||||
// then
|
||||
result.assertSuccessful();
|
||||
assertThat(result.returnedValue()).isNotNull().extracting(HsOfficePersonEntity::getUuid).isNotNull();
|
||||
assertThat(result.returnedValue()).isNotNull().extracting(HsOfficePersonRbacEntity::getUuid).isNotNull();
|
||||
assertThatPersonIsPersisted(result.returnedValue());
|
||||
assertThat(personRepo.count()).isEqualTo(count + 1);
|
||||
}
|
||||
@ -81,7 +81,7 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTestWithCleanu
|
||||
|
||||
// then
|
||||
result.assertSuccessful();
|
||||
assertThat(result.returnedValue()).isNotNull().extracting(HsOfficePersonEntity::getUuid).isNotNull();
|
||||
assertThat(result.returnedValue()).isNotNull().extracting(HsOfficePersonRbacEntity::getUuid).isNotNull();
|
||||
assertThatPersonIsPersisted(result.returnedValue());
|
||||
assertThat(personRepo.count()).isEqualTo(count + 1);
|
||||
}
|
||||
@ -122,7 +122,7 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTestWithCleanu
|
||||
));
|
||||
}
|
||||
|
||||
private void assertThatPersonIsPersisted(final HsOfficePersonEntity saved) {
|
||||
private void assertThatPersonIsPersisted(final HsOfficePersonRbacEntity saved) {
|
||||
final var found = personRepo.findByUuid(saved.getUuid());
|
||||
assertThat(found).isNotEmpty().get().extracting(Object::toString).isEqualTo(saved.toString());
|
||||
}
|
||||
@ -276,27 +276,27 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTestWithCleanu
|
||||
"[creating person test-data, hs_office.person, INSERT, Third OHG, null]");
|
||||
}
|
||||
|
||||
private HsOfficePersonEntity givenSomeTemporaryPerson(
|
||||
private HsOfficePersonRbacEntity givenSomeTemporaryPerson(
|
||||
final String createdByUser,
|
||||
Supplier<HsOfficePersonEntity> entitySupplier) {
|
||||
Supplier<HsOfficePersonRbacEntity> entitySupplier) {
|
||||
return jpaAttempt.transacted(() -> {
|
||||
context(createdByUser);
|
||||
return toCleanup(personRepo.save(entitySupplier.get()));
|
||||
}).assumeSuccessful().returnedValue();
|
||||
}
|
||||
|
||||
private HsOfficePersonEntity givenSomeTemporaryPerson(final String createdByUser) {
|
||||
private HsOfficePersonRbacEntity givenSomeTemporaryPerson(final String createdByUser) {
|
||||
return givenSomeTemporaryPerson(createdByUser, () ->
|
||||
hsOfficePerson("some temporary person #" + RandomStringUtils.random(12)));
|
||||
}
|
||||
|
||||
void exactlyThesePersonsAreReturned(final List<HsOfficePersonEntity> actualResult, final String... personCaptions) {
|
||||
void exactlyThesePersonsAreReturned(final List<HsOfficePersonRbacEntity> actualResult, final String... personCaptions) {
|
||||
assertThat(actualResult)
|
||||
.extracting(HsOfficePersonEntity::getTradeName)
|
||||
.extracting(HsOfficePersonRbacEntity::getTradeName)
|
||||
.containsExactlyInAnyOrder(personCaptions);
|
||||
}
|
||||
|
||||
void allThesePersonsAreReturned(final List<HsOfficePersonEntity> actualResult, final String... personCaptions) {
|
||||
void allThesePersonsAreReturned(final List<HsOfficePersonRbacEntity> actualResult, final String... personCaptions) {
|
||||
assertThat(actualResult)
|
||||
.extracting(hsOfficePersonEntity -> hsOfficePersonEntity.toShortString())
|
||||
.contains(personCaptions);
|
||||
|
@ -3,10 +3,10 @@ package net.hostsharing.hsadminng.hs.office.person;
|
||||
|
||||
public class TestHsOfficePerson {
|
||||
|
||||
public static final HsOfficePersonEntity somePerson = hsOfficePerson("some person");
|
||||
public static final HsOfficePersonRbacEntity somePerson = hsOfficePerson("some person");
|
||||
|
||||
static public HsOfficePersonEntity hsOfficePerson(final String tradeName) {
|
||||
return HsOfficePersonEntity.builder()
|
||||
static public HsOfficePersonRbacEntity hsOfficePerson(final String tradeName) {
|
||||
return HsOfficePersonRbacEntity.builder()
|
||||
.personType(HsOfficePersonType.NATURAL_PERSON)
|
||||
.tradeName(tradeName)
|
||||
.build();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.hostsharing.hsadminng.hs.office.relation;
|
||||
|
||||
import net.hostsharing.hsadminng.context.Context;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
|
||||
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
|
||||
import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
|
||||
@ -30,7 +30,7 @@ class HsOfficeRealRelationRepositoryIntegrationTest extends ContextBasedTestWith
|
||||
HsOfficeRelationRealRepository relationRealRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRbacRepository personRepo;
|
||||
|
||||
@PersistenceContext
|
||||
EntityManager em;
|
||||
|
@ -3,11 +3,11 @@ package net.hostsharing.hsadminng.hs.office.relation;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
||||
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
|
||||
import net.hostsharing.hsadminng.HsadminNgApplication;
|
||||
import net.hostsharing.hsadminng.context.Context;
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationTypeResource;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||
import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
|
||||
import net.hostsharing.hsadminng.test.DisableSecurityConfig;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
@ -45,7 +45,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
HsOfficeRelationRealRepository relationrealRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRealRepository personRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficeContactRealRepository contactrealRepo;
|
||||
|
@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.relation;
|
||||
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationPatchResource;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||
import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
@ -38,10 +38,10 @@ class HsOfficeRelationPatcherUnitTest extends PatchUnitTestBase<
|
||||
HsOfficeContactRealEntity.builder().uuid(invocation.getArgument(1)).build());
|
||||
}
|
||||
|
||||
final HsOfficePersonEntity givenInitialAnchorPerson = HsOfficePersonEntity.builder()
|
||||
final HsOfficePersonRealEntity givenInitialAnchorPerson = HsOfficePersonRealEntity.builder()
|
||||
.uuid(UUID.randomUUID())
|
||||
.build();
|
||||
final HsOfficePersonEntity givenInitialHolderPerson = HsOfficePersonEntity.builder()
|
||||
final HsOfficePersonRealEntity givenInitialHolderPerson = HsOfficePersonRealEntity.builder()
|
||||
.uuid(UUID.randomUUID())
|
||||
.build();
|
||||
final HsOfficeContactRealEntity givenInitialContact = HsOfficeContactRealEntity.builder()
|
||||
|
@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.relation;
|
||||
|
||||
import net.hostsharing.hsadminng.context.Context;
|
||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
||||
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 HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
|
||||
HsOfficeRelationRbacRepository relationRbacRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRealRepository personRepo;
|
||||
|
||||
@Autowired
|
||||
HsOfficeContactRealRepository contactrealRepo;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.hostsharing.hsadminng.hs.office.relation;
|
||||
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
|
||||
import net.hostsharing.hsadminng.rbac.generator.RbacViewMermaidFlowchartGenerator;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -9,11 +9,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class HsOfficeRelationUnitTest {
|
||||
|
||||
private HsOfficePersonEntity anchor = HsOfficePersonEntity.builder()
|
||||
private HsOfficePersonRealEntity anchor = HsOfficePersonRealEntity.builder()
|
||||
.personType(HsOfficePersonType.LEGAL_PERSON)
|
||||
.tradeName("some trade name")
|
||||
.build();
|
||||
private HsOfficePersonEntity holder = HsOfficePersonEntity.builder()
|
||||
private HsOfficePersonRealEntity holder = HsOfficePersonRealEntity.builder()
|
||||
.personType(HsOfficePersonType.NATURAL_PERSON)
|
||||
.familyName("Meier")
|
||||
.givenName("Mellie")
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.hostsharing.hsadminng.hs.scenarios;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacEntity;
|
||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacRepository;
|
||||
import net.hostsharing.hsadminng.lambda.Reducer;
|
||||
import net.hostsharing.hsadminng.rbac.context.ContextBasedTest;
|
||||
import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
|
||||
@ -68,7 +68,7 @@ public abstract class ScenarioTest extends ContextBasedTest {
|
||||
Integer port;
|
||||
|
||||
@Autowired
|
||||
HsOfficePersonRepository personRepo;
|
||||
HsOfficePersonRbacRepository personRepo;
|
||||
|
||||
@Autowired
|
||||
JpaAttempt jpaAttempt;
|
||||
@ -117,7 +117,7 @@ public abstract class ScenarioTest extends ContextBasedTest {
|
||||
null,
|
||||
personRepo.findPersonByOptionalNameLike("Hostsharing eG")
|
||||
.stream()
|
||||
.map(HsOfficePersonEntity::getUuid)
|
||||
.map(HsOfficePersonRbacEntity::getUuid)
|
||||
.reduce(Reducer::toSingleElement).orElseThrow())
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user