rename partnerRole -> partnerRel, relationship -> relation and remove rel-Prefix (relAnchor etc.) #23
@ -114,9 +114,9 @@ public class HsOfficeDebitorEntity implements HasUuid, Stringifyable {
|
||||
'D-' || (SELECT partner.partnerNumber
|
||||
FROM hs_office_partner partner
|
||||
JOIN hs_office_relation partnerRel
|
||||
ON partnerRel.uuid = partner.partnerRelUUid AND partnerRel.relType = 'PARTNER'
|
||||
ON partnerRel.uuid = partner.partnerRelUUid AND partnerRel.type = 'PARTNER'
|
||||
JOIN hs_office_relation debitorRel
|
||||
ON debitorRel.relAnchorUuid = partnerRel.relHolderUuid AND partnerRel.relType = 'DEBITOR'
|
||||
ON debitorRel.anchorUuid = partnerRel.holderUuid AND partnerRel.type = 'DEBITOR'
|
||||
WHERE debitorRel.uuid = debitor.debitorRelUuid)
|
||||
|| to_char(debitorNumberSuffix, 'fm00')
|
||||
from hs_office_debitor as debitor
|
||||
@ -137,7 +137,7 @@ public class HsOfficeDebitorEntity implements HasUuid, Stringifyable {
|
||||
fetchedBySql("""
|
||||
SELECT *
|
||||
FROM hs_office_relation AS r
|
||||
WHERE r.relType = 'DEBITOR' AND r.relHolderUuid = ${REF}.debitorRelUuid
|
||||
WHERE r.type = 'DEBITOR' AND r.holderUuid = ${REF}.debitorRelUuid
|
||||
"""),
|
||||
dependsOnColumn("debitorRelUuid"))
|
||||
.createPermission(DELETE).grantedTo("debitorRel", OWNER)
|
||||
@ -148,7 +148,7 @@ public class HsOfficeDebitorEntity implements HasUuid, Stringifyable {
|
||||
dependsOnColumn("refundBankAccountUuid"), fetchedBySql("""
|
||||
SELECT *
|
||||
FROM hs_office_relation AS r
|
||||
WHERE r.relType = 'DEBITOR' AND r.relHolderUuid = ${REF}.debitorRelUuid
|
||||
WHERE r.type = 'DEBITOR' AND r.holderUuid = ${REF}.debitorRelUuid
|
||||
""")
|
||||
)
|
||||
.toRole("refundBankAccount", ADMIN).grantRole("debitorRel", AGENT)
|
||||
@ -158,7 +158,7 @@ public class HsOfficeDebitorEntity implements HasUuid, Stringifyable {
|
||||
dependsOnColumn("partnerRelUuid"), fetchedBySql("""
|
||||
SELECT *
|
||||
FROM hs_office_relation AS partnerRel
|
||||
WHERE ${debitorRel}.relAnchorUuid = partnerRel.relHolderUuid
|
||||
WHERE ${debitorRel}.anchorUuid = partnerRel.holderUuid
|
||||
""")
|
||||
)
|
||||
.toRole("partnerRel", ADMIN).grantRole("debitorRel", ADMIN)
|
||||
|
@ -150,9 +150,9 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
|
||||
|
||||
private HsOfficeRelationEntity persistPartnerRel(final HsOfficePartnerRelInsertResource resource) {
|
||||
final var entity = new HsOfficeRelationEntity();
|
||||
entity.setRelType(HsOfficeRelationType.PARTNER);
|
||||
entity.setRelAnchor(ref(HsOfficePersonEntity.class, resource.getRelAnchorUuid()));
|
||||
entity.setRelHolder(ref(HsOfficePersonEntity.class, resource.getRelHolderUuid()));
|
||||
entity.setType(HsOfficeRelationType.PARTNER);
|
||||
entity.setAnchor(ref(HsOfficePersonEntity.class, resource.getAnchorUuid()));
|
||||
entity.setHolder(ref(HsOfficePersonEntity.class, resource.getHolderUuid()));
|
||||
entity.setContact(ref(HsOfficeContactEntity.class, resource.getContactUuid()));
|
||||
em.persist(entity);
|
||||
return entity;
|
||||
|
@ -34,7 +34,7 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
||||
private HsOfficeRelationRepository relationRepo;
|
||||
|
||||
@Autowired
|
||||
private HsOfficePersonRepository relHolderRepo;
|
||||
private HsOfficePersonRepository holderRepo;
|
||||
|
||||
@Autowired
|
||||
private HsOfficeContactRepository contactRepo;
|
||||
@ -69,12 +69,12 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
||||
context.define(currentUser, assumedRoles);
|
||||
|
||||
final var entityToSave = new HsOfficeRelationEntity();
|
||||
entityToSave.setRelType(HsOfficeRelationType.valueOf(body.getRelType()));
|
||||
entityToSave.setRelAnchor(relHolderRepo.findByUuid(body.getRelAnchorUuid()).orElseThrow(
|
||||
() -> new NoSuchElementException("cannot find relAnchorUuid " + body.getRelAnchorUuid())
|
||||
entityToSave.setType(HsOfficeRelationType.valueOf(body.getType()));
|
||||
entityToSave.setAnchor(holderRepo.findByUuid(body.getAnchorUuid()).orElseThrow(
|
||||
() -> new NoSuchElementException("cannot find anchorUuid " + body.getAnchorUuid())
|
||||
));
|
||||
entityToSave.setRelHolder(relHolderRepo.findByUuid(body.getRelHolderUuid()).orElseThrow(
|
||||
() -> new NoSuchElementException("cannot find relHolderUuid " + body.getRelHolderUuid())
|
||||
entityToSave.setHolder(holderRepo.findByUuid(body.getHolderUuid()).orElseThrow(
|
||||
() -> new NoSuchElementException("cannot find holderUuid " + body.getHolderUuid())
|
||||
));
|
||||
entityToSave.setContact(contactRepo.findByUuid(body.getContactUuid()).orElseThrow(
|
||||
() -> new NoSuchElementException("cannot find contactUuid " + body.getContactUuid())
|
||||
@ -145,8 +145,8 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
||||
|
||||
|
||||
final BiConsumer<HsOfficeRelationEntity, HsOfficeRelationResource> RELATION_ENTITY_TO_RESOURCE_POSTMAPPER = (entity, resource) -> {
|
||||
resource.setRelAnchor(mapper.map(entity.getRelAnchor(), HsOfficePersonResource.class));
|
||||
resource.setRelHolder(mapper.map(entity.getRelHolder(), HsOfficePersonResource.class));
|
||||
resource.setAnchor(mapper.map(entity.getAnchor(), HsOfficePersonResource.class));
|
||||
resource.setHolder(mapper.map(entity.getHolder(), HsOfficePersonResource.class));
|
||||
resource.setContact(mapper.map(entity.getContact(), HsOfficeContactResource.class));
|
||||
};
|
||||
}
|
||||
|
@ -34,39 +34,39 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
||||
public class HsOfficeRelationEntity implements HasUuid, Stringifyable {
|
||||
|
||||
private static Stringify<HsOfficeRelationEntity> toString = stringify(HsOfficeRelationEntity.class, "rel")
|
||||
.withProp(Fields.relAnchor, HsOfficeRelationEntity::getRelAnchor)
|
||||
.withProp(Fields.relType, HsOfficeRelationEntity::getRelType)
|
||||
.withProp(Fields.relMark, HsOfficeRelationEntity::getRelMark)
|
||||
.withProp(Fields.relHolder, HsOfficeRelationEntity::getRelHolder)
|
||||
.withProp(Fields.anchor, HsOfficeRelationEntity::getAnchor)
|
||||
.withProp(Fields.type, HsOfficeRelationEntity::getType)
|
||||
.withProp(Fields.mark, HsOfficeRelationEntity::getMark)
|
||||
.withProp(Fields.holder, HsOfficeRelationEntity::getHolder)
|
||||
.withProp(Fields.contact, HsOfficeRelationEntity::getContact);
|
||||
|
||||
private static Stringify<HsOfficeRelationEntity> toShortString = stringify(HsOfficeRelationEntity.class, "rel")
|
||||
.withProp(Fields.relAnchor, HsOfficeRelationEntity::getRelAnchor)
|
||||
.withProp(Fields.relType, HsOfficeRelationEntity::getRelType)
|
||||
.withProp(Fields.relHolder, HsOfficeRelationEntity::getRelHolder);
|
||||
.withProp(Fields.anchor, HsOfficeRelationEntity::getAnchor)
|
||||
.withProp(Fields.type, HsOfficeRelationEntity::getType)
|
||||
.withProp(Fields.holder, HsOfficeRelationEntity::getHolder);
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private UUID uuid;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "relanchoruuid")
|
||||
private HsOfficePersonEntity relAnchor;
|
||||
@JoinColumn(name = "anchoruuid")
|
||||
private HsOfficePersonEntity anchor;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "relholderuuid")
|
||||
private HsOfficePersonEntity relHolder;
|
||||
@JoinColumn(name = "holderuuid")
|
||||
private HsOfficePersonEntity holder;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "contactuuid")
|
||||
private HsOfficeContactEntity contact;
|
||||
|
||||
@Column(name = "reltype")
|
||||
@Column(name = "type")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private HsOfficeRelationType relType;
|
||||
private HsOfficeRelationType type;
|
||||
|
||||
@Column(name = "relmark")
|
||||
private String relMark;
|
||||
@Column(name = "mark")
|
||||
private String mark;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@ -81,20 +81,20 @@ public class HsOfficeRelationEntity implements HasUuid, Stringifyable {
|
||||
public static RbacView rbac() {
|
||||
return rbacViewFor("relation", HsOfficeRelationEntity.class)
|
||||
.withIdentityView(SQL.projection("""
|
||||
(select idName from hs_office_person_iv p where p.uuid = relAnchorUuid)
|
||||
|| '-with-' || target.relType || '-'
|
||||
|| (select idName from hs_office_person_iv p where p.uuid = relHolderUuid)
|
||||
(select idName from hs_office_person_iv p where p.uuid = anchorUuid)
|
||||
|| '-with-' || target.type || '-'
|
||||
|| (select idName from hs_office_person_iv p where p.uuid = holderUuid)
|
||||
"""))
|
||||
.withRestrictedViewOrderBy(SQL.expression(
|
||||
"(select idName from hs_office_person_iv p where p.uuid = target.relHolderUuid)"))
|
||||
"(select idName from hs_office_person_iv p where p.uuid = target.holderUuid)"))
|
||||
.withUpdatableColumns("contactUuid")
|
||||
.importEntityAlias("anchorPerson", HsOfficePersonEntity.class,
|
||||
dependsOnColumn("relAnchorUuid"),
|
||||
fetchedBySql("select * from hs_office_person as p where p.uuid = ${REF}.relAnchorUuid")
|
||||
dependsOnColumn("anchorUuid"),
|
||||
fetchedBySql("select * from hs_office_person as p where p.uuid = ${REF}.anchorUuid")
|
||||
)
|
||||
.importEntityAlias("holderPerson", HsOfficePersonEntity.class,
|
||||
dependsOnColumn("relHolderUuid"),
|
||||
fetchedBySql("select * from hs_office_person as p where p.uuid = ${REF}.relHolderUuid")
|
||||
dependsOnColumn("holderUuid"),
|
||||
fetchedBySql("select * from hs_office_person as p where p.uuid = ${REF}.holderUuid")
|
||||
)
|
||||
.importEntityAlias("contact", HsOfficeContactEntity.class,
|
||||
dependsOnColumn("contactUuid"),
|
||||
|
@ -18,14 +18,14 @@ public interface HsOfficeRelationRepository extends Repository<HsOfficeRelationE
|
||||
|
||||
@Query(value = """
|
||||
SELECT p.* FROM hs_office_relation_rv AS p
|
||||
WHERE p.relAnchorUuid = :personUuid OR p.relHolderUuid = :personUuid
|
||||
WHERE p.anchorUuid = :personUuid OR p.holderUuid = :personUuid
|
||||
""", nativeQuery = true)
|
||||
List<HsOfficeRelationEntity> findRelationRelatedToPersonUuid(@NotNull UUID personUuid);
|
||||
|
||||
@Query(value = """
|
||||
SELECT p.* FROM hs_office_relation_rv AS p
|
||||
WHERE (:relationType IS NULL OR p.relType = cast(:relationType AS HsOfficeRelationType))
|
||||
AND ( p.relAnchorUuid = :personUuid OR p.relHolderUuid = :personUuid)
|
||||
WHERE (:relationType IS NULL OR p.type = cast(:relationType AS HsOfficeRelationType))
|
||||
AND ( p.anchorUuid = :personUuid OR p.holderUuid = :personUuid)
|
||||
""", nativeQuery = true)
|
||||
List<HsOfficeRelationEntity> findRelationRelatedToPersonUuidAndRelationTypeString(@NotNull UUID personUuid, String relationType);
|
||||
|
||||
|
@ -116,18 +116,18 @@ components:
|
||||
type: object
|
||||
nullable: false
|
||||
properties:
|
||||
relAnchorUuid:
|
||||
anchorUuid:
|
||||
type: string
|
||||
format: uuid
|
||||
relHolderUuid:
|
||||
holderUuid:
|
||||
type: string
|
||||
format: uuid
|
||||
contactUuid:
|
||||
type: string
|
||||
format: uuid
|
||||
required:
|
||||
- relAnchorUuid
|
||||
- relHolderUuid
|
||||
- anchorUuid
|
||||
- holderUuid
|
||||
- relContactUuid
|
||||
|
||||
HsOfficePartnerDetailsInsert:
|
||||
|
@ -18,12 +18,12 @@ CREATE CAST (character varying as HsOfficeRelationType) WITH INOUT AS IMPLICIT;
|
||||
|
||||
create table if not exists hs_office_relation
|
||||
(
|
||||
uuid uuid unique references RbacObject (uuid) initially deferred, -- on delete cascade
|
||||
relAnchorUuid uuid not null references hs_office_person(uuid),
|
||||
relHolderUuid uuid not null references hs_office_person(uuid),
|
||||
contactUuid uuid references hs_office_contact(uuid),
|
||||
relType HsOfficeRelationType not null,
|
||||
relMark varchar(24)
|
||||
uuid uuid unique references RbacObject (uuid) initially deferred, -- on delete cascade
|
||||
anchorUuid uuid not null references hs_office_person(uuid),
|
||||
holderUuid uuid not null references hs_office_person(uuid),
|
||||
contactUuid uuid references hs_office_contact(uuid),
|
||||
type HsOfficeRelationType not null,
|
||||
mark varchar(24)
|
||||
);
|
||||
--//
|
||||
|
||||
|
@ -30,7 +30,7 @@ end
|
||||
|
||||
subgraph hsOfficeRelation
|
||||
|
||||
role:hsOfficePerson#relAnchor.admin[person#anchor.admin]
|
||||
role:hsOfficePerson#anchor.admin[person#anchor.admin]
|
||||
--- role:hsOfficePerson.admin
|
||||
|
||||
role:hsOfficeRelation.owner[relation.owner]
|
||||
@ -38,7 +38,7 @@ subgraph hsOfficeRelation
|
||||
role:hsOfficeRelation.owner --> perm:hsOfficeRelation.*{{relation.*}}
|
||||
%% incoming
|
||||
role:global.admin ---> role:hsOfficeRelation.owner
|
||||
role:hsOfficePersonAdmin#relAnchor.admin
|
||||
role:hsOfficePersonAdmin#anchor.admin
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -28,8 +28,8 @@ create or replace function hsOfficeRelationRbacRolesTrigger()
|
||||
strict as $$
|
||||
declare
|
||||
hsOfficeRelationTenant RbacRoleDescriptor;
|
||||
newRelAnchor hs_office_person;
|
||||
newRelHolder hs_office_person;
|
||||
newAnchor hs_office_person;
|
||||
newHolder hs_office_person;
|
||||
oldContact hs_office_contact;
|
||||
newContact hs_office_contact;
|
||||
begin
|
||||
@ -37,8 +37,8 @@ begin
|
||||
|
||||
hsOfficeRelationTenant := hsOfficeRelationTenant(NEW);
|
||||
|
||||
select * from hs_office_person as p where p.uuid = NEW.relAnchorUuid into newRelAnchor;
|
||||
select * from hs_office_person as p where p.uuid = NEW.relHolderUuid into newRelHolder;
|
||||
select * from hs_office_person as p where p.uuid = NEW.anchorUuid into newAnchor;
|
||||
select * from hs_office_person as p where p.uuid = NEW.holderUuid into newHolder;
|
||||
select * from hs_office_contact as c where c.uuid = NEW.contactUuid into newContact;
|
||||
|
||||
if TG_OP = 'INSERT' then
|
||||
@ -48,7 +48,7 @@ begin
|
||||
permissions => array['DELETE'],
|
||||
incomingSuperRoles => array[
|
||||
globalAdmin(),
|
||||
hsOfficePersonAdmin(newRelAnchor)]
|
||||
hsOfficePersonAdmin(newAnchor)]
|
||||
);
|
||||
|
||||
perform createRoleWithGrants(
|
||||
@ -63,21 +63,21 @@ begin
|
||||
permissions => array['SELECT'],
|
||||
incomingSuperRoles => array[
|
||||
hsOfficeRelationAdmin(NEW),
|
||||
hsOfficePersonAdmin(newRelAnchor),
|
||||
hsOfficePersonAdmin(newRelHolder),
|
||||
hsOfficePersonAdmin(newAnchor),
|
||||
hsOfficePersonAdmin(newHolder),
|
||||
hsOfficeContactAdmin(newContact)],
|
||||
outgoingSubRoles => array[
|
||||
hsOfficePersonTenant(newRelAnchor),
|
||||
hsOfficePersonTenant(newRelHolder),
|
||||
hsOfficePersonTenant(newAnchor),
|
||||
hsOfficePersonTenant(newHolder),
|
||||
hsOfficeContactTenant(newContact)]
|
||||
);
|
||||
|
||||
-- anchor and holder admin roles need each others tenant role
|
||||
-- to be able to see the joined relation
|
||||
-- TODO: this can probably be avoided through agent+guest roles
|
||||
call grantRoleToRole(hsOfficePersonTenant(newRelAnchor), hsOfficePersonAdmin(newRelHolder));
|
||||
call grantRoleToRole(hsOfficePersonTenant(newRelHolder), hsOfficePersonAdmin(newRelAnchor));
|
||||
call grantRoleToRoleIfNotNull(hsOfficePersonTenant(newRelHolder), hsOfficeContactAdmin(newContact));
|
||||
call grantRoleToRole(hsOfficePersonTenant(newAnchor), hsOfficePersonAdmin(newHolder));
|
||||
call grantRoleToRole(hsOfficePersonTenant(newHolder), hsOfficePersonAdmin(newAnchor));
|
||||
call grantRoleToRoleIfNotNull(hsOfficePersonTenant(newHolder), hsOfficeContactAdmin(newContact));
|
||||
|
||||
elsif TG_OP = 'UPDATE' then
|
||||
|
||||
@ -125,9 +125,9 @@ execute procedure hsOfficeRelationRbacRolesTrigger();
|
||||
--changeset hs-office-relation-rbac-IDENTITY-VIEW:1 endDelimiter:--//
|
||||
-- ----------------------------------------------------------------------------
|
||||
call generateRbacIdentityViewFromProjection('hs_office_relation', $idName$
|
||||
(select idName from hs_office_person_iv p where p.uuid = target.relAnchorUuid)
|
||||
|| '-with-' || target.relType || '-' ||
|
||||
(select idName from hs_office_person_iv p where p.uuid = target.relHolderUuid)
|
||||
(select idName from hs_office_person_iv p where p.uuid = target.anchorUuid)
|
||||
|| '-with-' || target.type || '-' ||
|
||||
(select idName from hs_office_person_iv p where p.uuid = target.holderUuid)
|
||||
$idName$);
|
||||
--//
|
||||
|
||||
@ -136,7 +136,7 @@ call generateRbacIdentityViewFromProjection('hs_office_relation', $idName$
|
||||
--changeset hs-office-relation-rbac-RESTRICTED-VIEW:1 endDelimiter:--//
|
||||
-- ----------------------------------------------------------------------------
|
||||
call generateRbacRestrictedView('hs_office_relation',
|
||||
'(select idName from hs_office_person_iv p where p.uuid = target.relHolderUuid)',
|
||||
'(select idName from hs_office_person_iv p where p.uuid = target.holderUuid)',
|
||||
$updates$
|
||||
contactUuid = new.contactUuid
|
||||
$updates$);
|
||||
|
@ -50,7 +50,7 @@ begin
|
||||
raise notice '- using holder person (%): %', holderPerson.uuid, holderPerson;
|
||||
raise notice '- using contact (%): %', contact.uuid, contact;
|
||||
insert
|
||||
into hs_office_relation (uuid, relanchoruuid, relholderuuid, reltype, relmark, contactUuid)
|
||||
into hs_office_relation (uuid, anchoruuid, holderuuid, type, mark, contactUuid)
|
||||
values (uuid_generate_v4(), anchorPerson.uuid, holderPerson.uuid, relationType, mark, contact.uuid);
|
||||
end; $$;
|
||||
--//
|
||||
|
@ -43,8 +43,8 @@ begin
|
||||
into relatedContact;
|
||||
|
||||
select r.* from hs_office_relation r
|
||||
where r.reltype = 'PARTNER'
|
||||
and r.relanchoruuid = mandantPerson.uuid and r.relholderuuid = relatedPerson.uuid
|
||||
where r.type = 'PARTNER'
|
||||
and r.anchoruuid = mandantPerson.uuid and r.holderuuid = relatedPerson.uuid
|
||||
into partnerRel;
|
||||
if partnerRel is null then
|
||||
raise exception 'partnerRel "%"-"%" not found', mandantPerson.tradename, partnerPersonName;
|
||||
|
@ -223,12 +223,12 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
void buildDebitorRelations() {
|
||||
debitors.forEach( (id, debitor) -> {
|
||||
final var debitorRel = HsOfficeRelationEntity.builder()
|
||||
.relType(HsOfficeRelationType.DEBITOR)
|
||||
.relAnchor(debitor.getPartner().getPartnerRel().getRelHolder())
|
||||
.relHolder(debitor.getPartner().getPartnerRel().getRelHolder()) // just 1 debitor/partner in legacy hsadmin
|
||||
.type(HsOfficeRelationType.DEBITOR)
|
||||
.anchor(debitor.getPartner().getPartnerRel().getHolder())
|
||||
.holder(debitor.getPartner().getPartnerRel().getHolder()) // just 1 debitor/partner in legacy hsadmin
|
||||
.contact(debitor.getBillingContact())
|
||||
.build();
|
||||
if (debitorRel.getRelAnchor() != null && debitorRel.getRelHolder() != null &&
|
||||
if (debitorRel.getAnchor() != null && debitorRel.getHolder() != null &&
|
||||
debitorRel.getContact() != null ) {
|
||||
relations.put(relationId++, debitorRel);
|
||||
}
|
||||
@ -290,26 +290,26 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
""");
|
||||
assertThat(toFormattedString(relations)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
2000000=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||
2000001=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000002=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000003=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='null null, null'),
|
||||
2000004=rel(relAnchor='NP Mellies, Michael', relType='OPERATIONS', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||
2000005=rel(relAnchor='NP Mellies, Michael', relType='REPRESENTATIVE', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||
2000006=rel(relAnchor='LP JM GmbH', relType='EX_PARTNER', relHolder='LP JM e.K.', contact='JM e.K.'),
|
||||
2000007=rel(relAnchor='LP JM GmbH', relType='OPERATIONS', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||
2000008=rel(relAnchor='LP JM GmbH', relType='VIP_CONTACT', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||
2000009=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='operations-announce', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||
2000010=rel(relAnchor='LP JM GmbH', relType='REPRESENTATIVE', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000011=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='members-announce', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000012=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='customers-announce', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000013=rel(relAnchor='LP JM GmbH', relType='VIP_CONTACT', relHolder='LP JM GmbH', contact='Frau Tammy Meyer-VIP , JM GmbH'),
|
||||
2000014=rel(relAnchor='?? Test PS', relType='OPERATIONS', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000015=rel(relAnchor='?? Test PS', relType='REPRESENTATIVE', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000016=rel(relAnchor='NP Mellies, Michael', relType='SUBSCRIBER', relMark='operations-announce', relHolder='NP Fanninga, Frauke', contact='Frau Frauke Fanninga '),
|
||||
2000017=rel(relAnchor='NP Mellies, Michael', relType='DEBITOR', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||
2000018=rel(relAnchor='LP JM GmbH', relType='DEBITOR', relHolder='LP JM GmbH', contact='Frau Dr. Jenny Meyer-Billing , JM GmbH'),
|
||||
2000019=rel(relAnchor='?? Test PS', relType='DEBITOR', relHolder='?? Test PS', contact='Petra Schmidt , Test PS')
|
||||
2000000=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||
2000001=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000002=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000003=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='null null, null'),
|
||||
2000004=rel(anchor='NP Mellies, Michael', type='OPERATIONS', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||
2000005=rel(anchor='NP Mellies, Michael', type='REPRESENTATIVE', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||
2000006=rel(anchor='LP JM GmbH', type='EX_PARTNER', holder='LP JM e.K.', contact='JM e.K.'),
|
||||
2000007=rel(anchor='LP JM GmbH', type='OPERATIONS', holder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||
2000008=rel(anchor='LP JM GmbH', type='VIP_CONTACT', holder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||
2000009=rel(anchor='LP JM GmbH', type='SUBSCRIBER', mark='operations-announce', holder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||
2000010=rel(anchor='LP JM GmbH', type='REPRESENTATIVE', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000011=rel(anchor='LP JM GmbH', type='SUBSCRIBER', mark='members-announce', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000012=rel(anchor='LP JM GmbH', type='SUBSCRIBER', mark='customers-announce', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000013=rel(anchor='LP JM GmbH', type='VIP_CONTACT', holder='LP JM GmbH', contact='Frau Tammy Meyer-VIP , JM GmbH'),
|
||||
2000014=rel(anchor='?? Test PS', type='OPERATIONS', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000015=rel(anchor='?? Test PS', type='REPRESENTATIVE', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000016=rel(anchor='NP Mellies, Michael', type='SUBSCRIBER', mark='operations-announce', holder='NP Fanninga, Frauke', contact='Frau Frauke Fanninga '),
|
||||
2000017=rel(anchor='NP Mellies, Michael', type='DEBITOR', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||
2000018=rel(anchor='LP JM GmbH', type='DEBITOR', holder='LP JM GmbH', contact='Frau Dr. Jenny Meyer-Billing , JM GmbH'),
|
||||
2000019=rel(anchor='?? Test PS', type='DEBITOR', holder='?? Test PS', contact='Petra Schmidt , Test PS')
|
||||
}
|
||||
""");
|
||||
}
|
||||
@ -427,7 +427,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
relations.forEach( (id, r) -> {
|
||||
// such a record
|
||||
if (r.getContact() == null || r.getContact().getLabel() == null ||
|
||||
r.getRelHolder() == null | r.getRelHolder().getPersonType() == null ) {
|
||||
r.getHolder() == null | r.getHolder().getPersonType() == null ) {
|
||||
idsToRemove.add(id);
|
||||
}
|
||||
});
|
||||
@ -677,9 +677,9 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
final var person = HsOfficePersonEntity.builder().build();
|
||||
|
||||
final var partnerRelation = HsOfficeRelationEntity.builder()
|
||||
.relHolder(person)
|
||||
.relType(HsOfficeRelationType.PARTNER)
|
||||
.relAnchor(mandant)
|
||||
.holder(person)
|
||||
.type(HsOfficeRelationType.PARTNER)
|
||||
.anchor(mandant)
|
||||
.contact(null) // is set during contacts import depending on assigned roles
|
||||
.build();
|
||||
relations.put(relationId++, partnerRelation);
|
||||
@ -883,7 +883,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
for (String subscriberRole: SUBSCRIBER_ROLES) {
|
||||
if (containsRole(rec, subscriberRole)) {
|
||||
addRelation(partnerPerson, contactPerson, contact, HsOfficeRelationType.SUBSCRIBER)
|
||||
.setRelMark(subscriberRole.split(":")[1])
|
||||
.setMark(subscriberRole.split(":")[1])
|
||||
;
|
||||
}
|
||||
}
|
||||
@ -898,7 +898,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
partners.forEach( (id, partner) -> {
|
||||
final var partnerPerson = partner.getPerson();
|
||||
if (relations.values().stream()
|
||||
.filter(rel -> rel.getRelAnchor() == partnerPerson && rel.getRelType() == HsOfficeRelationType.REPRESENTATIVE)
|
||||
.filter(rel -> rel.getAnchor() == partnerPerson && rel.getType() == HsOfficeRelationType.REPRESENTATIVE)
|
||||
.findFirst().isEmpty()) {
|
||||
contractualMissing.add(partner.getPartnerNumber());
|
||||
}
|
||||
@ -919,10 +919,10 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
final HsOfficeContactEntity contact,
|
||||
final HsOfficeRelationType representative) {
|
||||
final var rel = HsOfficeRelationEntity.builder()
|
||||
.relAnchor(partnerPerson)
|
||||
.relHolder(contactPerson)
|
||||
.anchor(partnerPerson)
|
||||
.holder(contactPerson)
|
||||
.contact(contact)
|
||||
.relType(representative)
|
||||
.type(representative)
|
||||
.build();
|
||||
relations.put(relationId++, rel);
|
||||
return rel;
|
||||
|
@ -103,8 +103,8 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
{
|
||||
"partnerNumber": "20002",
|
||||
"partnerRel": {
|
||||
"relAnchorUuid": "%s",
|
||||
"relHolderUuid": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
},
|
||||
"personUuid": "%s",
|
||||
@ -156,8 +156,8 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
{
|
||||
"partnerNumber": "20003",
|
||||
"partnerRel": {
|
||||
"relAnchorUuid": "%s",
|
||||
"relHolderUuid": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
},
|
||||
"personUuid": "%s",
|
||||
@ -194,8 +194,8 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
{
|
||||
"partnerNumber": "20004",
|
||||
"partnerRel": {
|
||||
"relAnchorUuid": "%s",
|
||||
"relHolderUuid": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
},
|
||||
"personUuid": "%s",
|
||||
@ -466,9 +466,9 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth contact").get(0);
|
||||
|
||||
final var partnerRel = new HsOfficeRelationEntity();
|
||||
partnerRel.setRelType(HsOfficeRelationType.PARTNER);
|
||||
partnerRel.setRelAnchor(givenMandantPerson);
|
||||
partnerRel.setRelHolder(givenPerson);
|
||||
partnerRel.setType(HsOfficeRelationType.PARTNER);
|
||||
partnerRel.setAnchor(givenMandantPerson);
|
||||
partnerRel.setHolder(givenPerson);
|
||||
partnerRel.setContact(givenContact);
|
||||
em.persist(partnerRel);
|
||||
|
||||
|
@ -101,8 +101,8 @@ class HsOfficePartnerControllerRestTest {
|
||||
{
|
||||
"partnerNumber": "20002",
|
||||
"partnerRel": {
|
||||
"relAnchorUuid": "%s",
|
||||
"relHolderUuid": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
},
|
||||
"personUuid": "%s",
|
||||
@ -138,8 +138,8 @@ class HsOfficePartnerControllerRestTest {
|
||||
{
|
||||
"partnerNumber": "20002",
|
||||
"partnerRel": {
|
||||
"relAnchorUuid": "%s",
|
||||
"relHolderUuid": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
},
|
||||
"personUuid": "%s",
|
||||
|
@ -81,9 +81,9 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("first contact").get(0);
|
||||
|
||||
final var partnerRel = HsOfficeRelationEntity.builder()
|
||||
.relHolder(givenPartnerPerson)
|
||||
.relType(HsOfficeRelationType.PARTNER)
|
||||
.relAnchor(givenMandantorPerson)
|
||||
.holder(givenPartnerPerson)
|
||||
.type(HsOfficeRelationType.PARTNER)
|
||||
.anchor(givenMandantorPerson)
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
relationRepo.save(partnerRel);
|
||||
@ -126,9 +126,9 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
final var givenMandantPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0);
|
||||
|
||||
final var newRelation = HsOfficeRelationEntity.builder()
|
||||
.relHolder(givenPartnerPerson)
|
||||
.relType(HsOfficeRelationType.PARTNER)
|
||||
.relAnchor(givenMandantPerson)
|
||||
.holder(givenPartnerPerson)
|
||||
.type(HsOfficeRelationType.PARTNER)
|
||||
.anchor(givenMandantPerson)
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
relationRepo.save(newRelation);
|
||||
@ -467,9 +467,9 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike(contact).get(0);
|
||||
|
||||
final var partnerRel = HsOfficeRelationEntity.builder()
|
||||
.relHolder(givenPartnerPerson)
|
||||
.relType(HsOfficeRelationType.PARTNER)
|
||||
.relAnchor(givenMandantorPerson)
|
||||
.holder(givenPartnerPerson)
|
||||
.type(HsOfficeRelationType.PARTNER)
|
||||
.anchor(givenMandantorPerson)
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
relationRepo.save(partnerRel);
|
||||
|
@ -79,37 +79,37 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.body("", lenientlyEquals("""
|
||||
[
|
||||
{
|
||||
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"relHolder": { "personType": "LEGAL_PERSON", "tradeName": "First GmbH" },
|
||||
"relType": "PARTNER",
|
||||
"relMark": null,
|
||||
"anchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"holder": { "personType": "LEGAL_PERSON", "tradeName": "First GmbH" },
|
||||
"type": "PARTNER",
|
||||
"mark": null,
|
||||
"contact": { "label": "first contact" }
|
||||
},
|
||||
{
|
||||
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"relHolder": { "personType": "INCORPORATED_FIRM", "tradeName": "Fourth eG" },
|
||||
"relType": "PARTNER",
|
||||
"anchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"holder": { "personType": "INCORPORATED_FIRM", "tradeName": "Fourth eG" },
|
||||
"type": "PARTNER",
|
||||
"contact": { "label": "fourth contact" }
|
||||
},
|
||||
{
|
||||
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"relHolder": { "personType": "LEGAL_PERSON", "tradeName": "Second e.K.", "givenName": "Peter", "familyName": "Smith" },
|
||||
"relType": "PARTNER",
|
||||
"relMark": null,
|
||||
"anchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"holder": { "personType": "LEGAL_PERSON", "tradeName": "Second e.K.", "givenName": "Peter", "familyName": "Smith" },
|
||||
"type": "PARTNER",
|
||||
"mark": null,
|
||||
"contact": { "label": "second contact" }
|
||||
},
|
||||
{
|
||||
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"relHolder": { "personType": "NATURAL_PERSON", "givenName": "Peter", "familyName": "Smith" },
|
||||
"relType": "PARTNER",
|
||||
"relMark": null,
|
||||
"anchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"holder": { "personType": "NATURAL_PERSON", "givenName": "Peter", "familyName": "Smith" },
|
||||
"type": "PARTNER",
|
||||
"mark": null,
|
||||
"contact": { "label": "sixth contact" }
|
||||
},
|
||||
{
|
||||
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"relHolder": { "personType": "INCORPORATED_FIRM", "tradeName": "Third OHG" },
|
||||
"relType": "PARTNER",
|
||||
"relMark": null,
|
||||
"anchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
|
||||
"holder": { "personType": "INCORPORATED_FIRM", "tradeName": "Third OHG" },
|
||||
"type": "PARTNER",
|
||||
"mark": null,
|
||||
"contact": { "label": "third contact" }
|
||||
}
|
||||
]
|
||||
@ -136,9 +136,9 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.contentType(ContentType.JSON)
|
||||
.body("""
|
||||
{
|
||||
"relType": "%s",
|
||||
"relAnchorUuid": "%s",
|
||||
"relHolderUuid": "%s",
|
||||
"type": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
}
|
||||
""".formatted(
|
||||
@ -153,9 +153,9 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.statusCode(201)
|
||||
.contentType(ContentType.JSON)
|
||||
.body("uuid", isUuidValid())
|
||||
.body("relType", is("DEBITOR"))
|
||||
.body("relAnchor.tradeName", is("Third OHG"))
|
||||
.body("relHolder.givenName", is("Paul"))
|
||||
.body("type", is("DEBITOR"))
|
||||
.body("anchor.tradeName", is("Third OHG"))
|
||||
.body("holder.givenName", is("Paul"))
|
||||
.body("contact.label", is("second contact"))
|
||||
.header("Location", startsWith("http://localhost"))
|
||||
.extract().header("Location"); // @formatter:on
|
||||
@ -180,9 +180,9 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.contentType(ContentType.JSON)
|
||||
.body("""
|
||||
{
|
||||
"relType": "%s",
|
||||
"relAnchorUuid": "%s",
|
||||
"relHolderUuid": "%s",
|
||||
"type": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
}
|
||||
""".formatted(
|
||||
@ -195,7 +195,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.post("http://localhost/api/hs/office/relations")
|
||||
.then().log().all().assertThat()
|
||||
.statusCode(404)
|
||||
.body("message", is("cannot find relAnchorUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
|
||||
.body("message", is("cannot find anchorUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
@ -212,9 +212,9 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.contentType(ContentType.JSON)
|
||||
.body("""
|
||||
{
|
||||
"relType": "%s",
|
||||
"relAnchorUuid": "%s",
|
||||
"relHolderUuid": "%s",
|
||||
"type": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
}
|
||||
""".formatted(
|
||||
@ -227,7 +227,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.post("http://localhost/api/hs/office/relations")
|
||||
.then().log().all().assertThat()
|
||||
.statusCode(404)
|
||||
.body("message", is("cannot find relHolderUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
|
||||
.body("message", is("cannot find holderUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
@ -245,9 +245,9 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.contentType(ContentType.JSON)
|
||||
.body("""
|
||||
{
|
||||
"relType": "%s",
|
||||
"relAnchorUuid": "%s",
|
||||
"relHolderUuid": "%s",
|
||||
"type": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
}
|
||||
""".formatted(
|
||||
@ -285,8 +285,8 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.contentType("application/json")
|
||||
.body("", lenientlyEquals("""
|
||||
{
|
||||
"relAnchor": { "tradeName": "First GmbH" },
|
||||
"relHolder": { "familyName": "Firby" },
|
||||
"anchor": { "tradeName": "First GmbH" },
|
||||
"holder": { "familyName": "Firby" },
|
||||
"contact": { "label": "first contact" }
|
||||
}
|
||||
""")); // @formatter:on
|
||||
@ -326,8 +326,8 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.contentType("application/json")
|
||||
.body("", lenientlyEquals("""
|
||||
{
|
||||
"relAnchor": { "tradeName": "First GmbH" },
|
||||
"relHolder": { "familyName": "Firby" },
|
||||
"anchor": { "tradeName": "First GmbH" },
|
||||
"holder": { "familyName": "Firby" },
|
||||
"contact": { "label": "first contact" }
|
||||
}
|
||||
""")); // @formatter:on
|
||||
@ -342,7 +342,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
final var givenRelation = relationRepo
|
||||
.findRelationRelatedToPersonUuid(anchorPersonUuid)
|
||||
.stream()
|
||||
.filter(r -> r.getRelHolder().getUuid().equals(holderPersonUuid))
|
||||
.filter(r -> r.getHolder().getUuid().equals(holderPersonUuid))
|
||||
.findFirst().orElseThrow();
|
||||
return givenRelation;
|
||||
}
|
||||
@ -375,9 +375,9 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.statusCode(200)
|
||||
.contentType(ContentType.JSON)
|
||||
.body("uuid", isUuidValid())
|
||||
.body("relType", is("REPRESENTATIVE"))
|
||||
.body("relAnchor.tradeName", is("Erben Bessler"))
|
||||
.body("relHolder.familyName", is("Winkler"))
|
||||
.body("type", is("REPRESENTATIVE"))
|
||||
.body("anchor.tradeName", is("Erben Bessler"))
|
||||
.body("holder.familyName", is("Winkler"))
|
||||
.body("contact.label", is("fourth contact"));
|
||||
// @formatter:on
|
||||
|
||||
@ -385,10 +385,10 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
assertThat(relationRepo.findByUuid(givenRelation.getUuid())).isPresent().get()
|
||||
.matches(rel -> {
|
||||
assertThat(rel.getRelAnchor().getTradeName()).contains("Bessler");
|
||||
assertThat(rel.getRelHolder().getFamilyName()).contains("Winkler");
|
||||
assertThat(rel.getAnchor().getTradeName()).contains("Bessler");
|
||||
assertThat(rel.getHolder().getFamilyName()).contains("Winkler");
|
||||
assertThat(rel.getContact().getLabel()).isEqualTo("fourth contact");
|
||||
assertThat(rel.getRelType()).isEqualTo(HsOfficeRelationType.REPRESENTATIVE);
|
||||
assertThat(rel.getType()).isEqualTo(HsOfficeRelationType.REPRESENTATIVE);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@ -464,9 +464,9 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Winkler").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("seventh contact").get(0);
|
||||
final var newRelation = HsOfficeRelationEntity.builder()
|
||||
.relType(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.relAnchor(givenAnchorPerson)
|
||||
.relHolder(givenHolderPerson)
|
||||
.type(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.anchor(givenAnchorPerson)
|
||||
.holder(givenHolderPerson)
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
|
||||
|
@ -52,9 +52,9 @@ class HsOfficeRelationEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||
protected HsOfficeRelationEntity newInitialEntity() {
|
||||
final var entity = new HsOfficeRelationEntity();
|
||||
entity.setUuid(INITIAL_RELATION_UUID);
|
||||
entity.setRelType(HsOfficeRelationType.REPRESENTATIVE);
|
||||
entity.setRelAnchor(givenInitialAnchorPerson);
|
||||
entity.setRelHolder(givenInitialHolderPerson);
|
||||
entity.setType(HsOfficeRelationType.REPRESENTATIVE);
|
||||
entity.setAnchor(givenInitialAnchorPerson);
|
||||
entity.setHolder(givenInitialHolderPerson);
|
||||
entity.setContact(givenInitialContact);
|
||||
return entity;
|
||||
}
|
||||
|
@ -21,23 +21,23 @@ class HsOfficeRelationEntityUnitTest {
|
||||
@Test
|
||||
void toStringReturnsAllProperties() {
|
||||
final var given = HsOfficeRelationEntity.builder()
|
||||
.relType(HsOfficeRelationType.SUBSCRIBER)
|
||||
.relMark("members-announce")
|
||||
.relAnchor(anchor)
|
||||
.relHolder(holder)
|
||||
.type(HsOfficeRelationType.SUBSCRIBER)
|
||||
.mark("members-announce")
|
||||
.anchor(anchor)
|
||||
.holder(holder)
|
||||
.build();
|
||||
|
||||
assertThat(given.toString()).isEqualTo("rel(relAnchor='LP some trade name', relType='SUBSCRIBER', relMark='members-announce', relHolder='NP Meier, Mellie')");
|
||||
assertThat(given.toString()).isEqualTo("rel(anchor='LP some trade name', type='SUBSCRIBER', mark='members-announce', holder='NP Meier, Mellie')");
|
||||
}
|
||||
|
||||
@Test
|
||||
void toShortString() {
|
||||
final var given = HsOfficeRelationEntity.builder()
|
||||
.relType(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.relAnchor(anchor)
|
||||
.relHolder(holder)
|
||||
.type(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.anchor(anchor)
|
||||
.holder(holder)
|
||||
.build();
|
||||
|
||||
assertThat(given.toShortString()).isEqualTo("rel(relAnchor='LP some trade name', relType='REPRESENTATIVE', relHolder='NP Meier, Mellie')");
|
||||
assertThat(given.toShortString()).isEqualTo("rel(anchor='LP some trade name', type='REPRESENTATIVE', holder='NP Meier, Mellie')");
|
||||
}
|
||||
}
|
||||
|
@ -70,9 +70,9 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
|
||||
// when
|
||||
final var result = attempt(em, () -> {
|
||||
final var newRelation = HsOfficeRelationEntity.builder()
|
||||
.relAnchor(givenAnchorPerson)
|
||||
.relHolder(givenHolderPerson)
|
||||
.relType(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.anchor(givenAnchorPerson)
|
||||
.holder(givenHolderPerson)
|
||||
.type(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
return toCleanup(relationRepo.save(newRelation));
|
||||
@ -98,9 +98,9 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
|
||||
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Anita").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth contact").get(0);
|
||||
final var newRelation = HsOfficeRelationEntity.builder()
|
||||
.relAnchor(givenAnchorPerson)
|
||||
.relHolder(givenHolderPerson)
|
||||
.relType(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.anchor(givenAnchorPerson)
|
||||
.holder(givenHolderPerson)
|
||||
.type(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
return toCleanup(relationRepo.save(newRelation));
|
||||
@ -154,8 +154,8 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
|
||||
// then
|
||||
allTheseRelationsAreReturned(
|
||||
result,
|
||||
"rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='LP Second e.K.', contact='second contact')",
|
||||
"rel(relAnchor='LP Second e.K.', relType='REPRESENTATIVE', relHolder='NP Smith, Peter', contact='second contact')");
|
||||
"rel(anchor='LP Hostsharing eG', type='PARTNER', holder='LP Second e.K.', contact='second contact')",
|
||||
"rel(anchor='LP Second e.K.', type='REPRESENTATIVE', holder='NP Smith, Peter', contact='second contact')");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -170,8 +170,8 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
|
||||
// then:
|
||||
exactlyTheseRelationsAreReturned(
|
||||
result,
|
||||
"rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='LP First GmbH', contact='first contact')",
|
||||
"rel(relAnchor='LP First GmbH', relType='REPRESENTATIVE', relHolder='NP Firby, Susan', contact='first contact')");
|
||||
"rel(anchor='LP Hostsharing eG', type='PARTNER', holder='LP First GmbH', contact='first contact')",
|
||||
"rel(anchor='LP First GmbH', type='REPRESENTATIVE', holder='NP Firby, Susan', contact='first contact')");
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
|
||||
}
|
||||
|
||||
@Test
|
||||
public void relHolderAdmin_canNotUpdateRelatedRelation() {
|
||||
public void holderAdmin_canNotUpdateRelatedRelation() {
|
||||
// given
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var givenRelation = givenSomeTemporaryRelationBessler(
|
||||
@ -382,9 +382,9 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
|
||||
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike(holderPerson).get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike(contact).get(0);
|
||||
final var newRelation = HsOfficeRelationEntity.builder()
|
||||
.relType(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.relAnchor(givenAnchorPerson)
|
||||
.relHolder(givenHolderPerson)
|
||||
.type(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.anchor(givenAnchorPerson)
|
||||
.holder(givenHolderPerson)
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user