Compare commits
No commits in common. "6b8d677670f167410aed14fef47e0eea6b19d483" and "37f00a19f0a4336e0947469f7ab7e3b23d7b389b" have entirely different histories.
6b8d677670
...
37f00a19f0
@ -69,7 +69,7 @@ public class HsOfficePartnerEntity implements Stringifyable, HasUuid {
|
|||||||
private Integer partnerNumber;
|
private Integer partnerNumber;
|
||||||
|
|
||||||
@ManyToOne(cascade = CascadeType.ALL)
|
@ManyToOne(cascade = CascadeType.ALL)
|
||||||
@JoinColumn(name = "partnerreluuid", nullable = false)
|
@JoinColumn(name = "partnerReluuid", nullable = false)
|
||||||
private HsOfficeRelationEntity partnerRel;
|
private HsOfficeRelationEntity partnerRel;
|
||||||
|
|
||||||
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.DETACH }, optional = true)
|
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.DETACH }, optional = true)
|
||||||
|
@ -224,6 +224,7 @@ create or replace function currentSubjects()
|
|||||||
declare
|
declare
|
||||||
assumedRoles varchar(63)[];
|
assumedRoles varchar(63)[];
|
||||||
begin
|
begin
|
||||||
|
return assumedRoles();
|
||||||
assumedRoles := assumedRoles();
|
assumedRoles := assumedRoles();
|
||||||
if array_length(assumedRoles, 1) > 0 then
|
if array_length(assumedRoles, 1) > 0 then
|
||||||
return assumedRoles();
|
return assumedRoles();
|
||||||
|
@ -129,8 +129,7 @@ public class ArchitectureTest {
|
|||||||
public static final ArchRule hsOfficeBankAccountPackageRule = classes()
|
public static final ArchRule hsOfficeBankAccountPackageRule = classes()
|
||||||
.that().resideInAPackage("..hs.office.bankaccount..")
|
.that().resideInAPackage("..hs.office.bankaccount..")
|
||||||
.should().onlyBeAccessed().byClassesThat()
|
.should().onlyBeAccessed().byClassesThat()
|
||||||
.resideInAnyPackage(
|
.resideInAnyPackage("..hs.office.bankaccount..",
|
||||||
"..hs.office.bankaccount..",
|
|
||||||
"..hs.office.sepamandate..",
|
"..hs.office.sepamandate..",
|
||||||
"..hs.office.debitor..",
|
"..hs.office.debitor..",
|
||||||
"..hs.office.migration..");
|
"..hs.office.migration..");
|
||||||
@ -140,8 +139,7 @@ public class ArchitectureTest {
|
|||||||
public static final ArchRule hsOfficeSepaMandatePackageRule = classes()
|
public static final ArchRule hsOfficeSepaMandatePackageRule = classes()
|
||||||
.that().resideInAPackage("..hs.office.sepamandate..")
|
.that().resideInAPackage("..hs.office.sepamandate..")
|
||||||
.should().onlyBeAccessed().byClassesThat()
|
.should().onlyBeAccessed().byClassesThat()
|
||||||
.resideInAnyPackage(
|
.resideInAnyPackage("..hs.office.sepamandate..",
|
||||||
"..hs.office.sepamandate..",
|
|
||||||
"..hs.office.debitor..",
|
"..hs.office.debitor..",
|
||||||
"..hs.office.migration..");
|
"..hs.office.migration..");
|
||||||
|
|
||||||
@ -150,9 +148,7 @@ public class ArchitectureTest {
|
|||||||
public static final ArchRule hsOfficeContactPackageRule = classes()
|
public static final ArchRule hsOfficeContactPackageRule = classes()
|
||||||
.that().resideInAPackage("..hs.office.contact..")
|
.that().resideInAPackage("..hs.office.contact..")
|
||||||
.should().onlyBeAccessed().byClassesThat()
|
.should().onlyBeAccessed().byClassesThat()
|
||||||
.resideInAnyPackage(
|
.resideInAnyPackage("..hs.office.contact..", "..hs.office.relation..",
|
||||||
"..hs.office.contact..",
|
|
||||||
"..hs.office.relation..",
|
|
||||||
"..hs.office.partner..",
|
"..hs.office.partner..",
|
||||||
"..hs.office.debitor..",
|
"..hs.office.debitor..",
|
||||||
"..hs.office.membership..",
|
"..hs.office.membership..",
|
||||||
@ -163,46 +159,37 @@ public class ArchitectureTest {
|
|||||||
public static final ArchRule hsOfficePersonPackageRule = classes()
|
public static final ArchRule hsOfficePersonPackageRule = classes()
|
||||||
.that().resideInAPackage("..hs.office.person..")
|
.that().resideInAPackage("..hs.office.person..")
|
||||||
.should().onlyBeAccessed().byClassesThat()
|
.should().onlyBeAccessed().byClassesThat()
|
||||||
.resideInAnyPackage(
|
.resideInAnyPackage("..hs.office.person..", "..hs.office.relation..",
|
||||||
"..hs.office.person..",
|
|
||||||
"..hs.office.relation..",
|
|
||||||
"..hs.office.partner..",
|
"..hs.office.partner..",
|
||||||
"..hs.office.debitor..",
|
"..hs.office.debitor..",
|
||||||
"..hs.office.membership..",
|
"..hs.office.membership..",
|
||||||
"..hs.office.migration..")
|
"..hs.office.migration..");
|
||||||
.orShould().haveNameNotMatching(".*Test$");
|
|
||||||
|
|
||||||
|
|
||||||
@ArchTest
|
@ArchTest
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static final ArchRule hsOfficeRelationPackageRule = classes()
|
public static final ArchRule hsOfficeRelationPackageRule = classes()
|
||||||
.that().resideInAPackage("..hs.office.relation..")
|
.that().resideInAPackage("..hs.office.relation..")
|
||||||
.should().onlyBeAccessed().byClassesThat()
|
.should().onlyBeAccessed().byClassesThat()
|
||||||
.resideInAnyPackage(
|
.resideInAnyPackage("..hs.office.relation..",
|
||||||
"..hs.office.relation..",
|
|
||||||
"..hs.office.partner..",
|
"..hs.office.partner..",
|
||||||
"..hs.office.migration..")
|
"..hs.office.migration..");
|
||||||
.orShould().haveNameNotMatching(".*Test$");
|
|
||||||
|
|
||||||
@ArchTest
|
@ArchTest
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static final ArchRule hsOfficePartnerPackageRule = classes()
|
public static final ArchRule hsOfficePartnerPackageRule = classes()
|
||||||
.that().resideInAPackage("..hs.office.partner..")
|
.that().resideInAPackage("..hs.office.partner..")
|
||||||
.should().onlyBeAccessed().byClassesThat()
|
.should().onlyBeAccessed().byClassesThat()
|
||||||
.resideInAnyPackage(
|
.resideInAnyPackage("..hs.office.partner..",
|
||||||
"..hs.office.partner..",
|
|
||||||
"..hs.office.debitor..",
|
"..hs.office.debitor..",
|
||||||
"..hs.office.membership..",
|
"..hs.office.membership..",
|
||||||
"..hs.office.migration..")
|
"..hs.office.migration..");
|
||||||
.orShould().haveNameNotMatching(".*Test$");
|
|
||||||
|
|
||||||
@ArchTest
|
@ArchTest
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static final ArchRule hsOfficeMembershipPackageRule = classes()
|
public static final ArchRule hsOfficeMembershipPackageRule = classes()
|
||||||
.that().resideInAPackage("..hs.office.membership..")
|
.that().resideInAPackage("..hs.office.membership..")
|
||||||
.should().onlyBeAccessed().byClassesThat()
|
.should().onlyBeAccessed().byClassesThat()
|
||||||
.resideInAnyPackage(
|
.resideInAnyPackage("..hs.office.membership..",
|
||||||
"..hs.office.membership..",
|
|
||||||
"..hs.office.coopassets..",
|
"..hs.office.coopassets..",
|
||||||
"..hs.office.coopshares..",
|
"..hs.office.coopshares..",
|
||||||
"..hs.office.migration..");
|
"..hs.office.migration..");
|
||||||
|
@ -191,10 +191,10 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
assertThat(toFormattedString(contacts)).isEqualTo("{}");
|
assertThat(toFormattedString(contacts)).isEqualTo("{}");
|
||||||
assertThat(toFormattedString(debitors)).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(debitors)).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
17=debitor(D-1001700: rel(anchor='null null, null', type='DEBITOR'), mih),
|
17=debitor(D-1001700: rel(anchor='null null, null', type='DEBITOR', holder='null null, null'), mih),
|
||||||
20=debitor(D-1002000: rel(anchor='null null, null', type='DEBITOR'), xyz),
|
20=debitor(D-1002000: rel(anchor='null null, null', type='DEBITOR', holder='null null, null'), xyz),
|
||||||
22=debitor(D-1102200: rel(anchor='null null, null', type='DEBITOR'), xxx),
|
22=debitor(D-1102200: rel(anchor='null null, null', type='DEBITOR', holder='null null, null'), xxx),
|
||||||
99=debitor(D-1999900: rel(anchor='null null, null', type='DEBITOR'), zzz)
|
99=debitor(D-1999900: rel(anchor='null null, null', type='DEBITOR', holder='null null, null'), zzz)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
assertThat(toFormattedString(memberships)).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(memberships)).isEqualToIgnoringWhitespace("""
|
||||||
@ -278,7 +278,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
17=debitor(D-1001700: rel(anchor='NP Mellies, Michael', type='DEBITOR', holder='NP Mellies, Michael'), mih),
|
17=debitor(D-1001700: rel(anchor='NP Mellies, Michael', type='DEBITOR', holder='NP Mellies, Michael'), mih),
|
||||||
20=debitor(D-1002000: rel(anchor='LP JM GmbH', type='DEBITOR', holder='LP JM GmbH'), xyz),
|
20=debitor(D-1002000: rel(anchor='LP JM GmbH', type='DEBITOR', holder='LP JM GmbH'), xyz),
|
||||||
22=debitor(D-1102200: rel(anchor='?? Test PS', type='DEBITOR', holder='?? Test PS'), xxx),
|
22=debitor(D-1102200: rel(anchor='?? Test PS', type='DEBITOR', holder='?? Test PS'), xxx),
|
||||||
99=debitor(D-1999900: rel(anchor='null null, null', type='DEBITOR'), zzz)
|
99=debitor(D-1999900: rel(anchor='null null, null', type='DEBITOR', holder='null null, null'), zzz)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
assertThat(toFormattedString(memberships)).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(memberships)).isEqualToIgnoringWhitespace("""
|
||||||
@ -292,29 +292,25 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
{
|
{
|
||||||
2000000=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
2000000=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||||
2000001=rel(anchor='NP Mellies, Michael', type='DEBITOR', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
2000001=rel(anchor='NP Mellies, Michael', type='DEBITOR', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||||
2000002=rel(anchor='NP Mellies, Michael', type='DEBITOR', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
2000002=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||||
2000003=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
2000003=rel(anchor='LP JM GmbH', type='DEBITOR', holder='LP JM GmbH', contact='Frau Dr. Jenny Meyer-Billing , JM GmbH'),
|
||||||
2000004=rel(anchor='LP JM GmbH', type='DEBITOR', holder='LP JM GmbH', contact='Frau Dr. Jenny Meyer-Billing , JM GmbH'),
|
2000004=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||||
2000005=rel(anchor='LP JM GmbH', type='DEBITOR', holder='LP JM GmbH', contact='Frau Dr. Jenny Meyer-Billing , JM GmbH'),
|
2000005=rel(anchor='?? Test PS', type='DEBITOR', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||||
2000006=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
2000006=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='null null, null'),
|
||||||
2000007=rel(anchor='?? Test PS', type='DEBITOR', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
2000007=rel(anchor='null null, null', type='DEBITOR', holder='null null, null'),
|
||||||
2000008=rel(anchor='?? Test PS', type='DEBITOR', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
2000008=rel(anchor='NP Mellies, Michael', type='OPERATIONS', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||||
2000009=rel(anchor='LP Hostsharing eG', type='PARTNER', holder='null null, null'),
|
2000009=rel(anchor='NP Mellies, Michael', type='REPRESENTATIVE', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||||
2000010=rel(anchor='null null, null', type='DEBITOR'),
|
2000010=rel(anchor='LP JM GmbH', type='EX_PARTNER', holder='LP JM e.K.', contact='JM e.K.'),
|
||||||
2000011=rel(anchor='null null, null', type='DEBITOR'),
|
2000011=rel(anchor='LP JM GmbH', type='OPERATIONS', holder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||||
2000012=rel(anchor='NP Mellies, Michael', type='OPERATIONS', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
2000012=rel(anchor='LP JM GmbH', type='VIP_CONTACT', holder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||||
2000013=rel(anchor='NP Mellies, Michael', type='REPRESENTATIVE', holder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
2000013=rel(anchor='LP JM GmbH', type='SUBSCRIBER', mark='operations-announce', holder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||||
2000014=rel(anchor='LP JM GmbH', type='EX_PARTNER', holder='LP JM e.K.', contact='JM e.K.'),
|
2000014=rel(anchor='LP JM GmbH', type='REPRESENTATIVE', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||||
2000015=rel(anchor='LP JM GmbH', type='OPERATIONS', holder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
2000015=rel(anchor='LP JM GmbH', type='SUBSCRIBER', mark='members-announce', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||||
2000016=rel(anchor='LP JM GmbH', type='VIP_CONTACT', holder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
2000016=rel(anchor='LP JM GmbH', type='SUBSCRIBER', mark='customers-announce', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||||
2000017=rel(anchor='LP JM GmbH', type='SUBSCRIBER', mark='operations-announce', holder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
2000017=rel(anchor='LP JM GmbH', type='VIP_CONTACT', holder='LP JM GmbH', contact='Frau Tammy Meyer-VIP , JM GmbH'),
|
||||||
2000018=rel(anchor='LP JM GmbH', type='REPRESENTATIVE', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
2000018=rel(anchor='?? Test PS', type='OPERATIONS', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||||
2000019=rel(anchor='LP JM GmbH', type='SUBSCRIBER', mark='members-announce', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
2000019=rel(anchor='?? Test PS', type='REPRESENTATIVE', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||||
2000020=rel(anchor='LP JM GmbH', type='SUBSCRIBER', mark='customers-announce', holder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
2000020=rel(anchor='NP Mellies, Michael', type='SUBSCRIBER', mark='operations-announce', holder='NP Fanninga, Frauke', contact='Frau Frauke Fanninga ')
|
||||||
2000021=rel(anchor='LP JM GmbH', type='VIP_CONTACT', holder='LP JM GmbH', contact='Frau Tammy Meyer-VIP , JM GmbH'),
|
|
||||||
2000022=rel(anchor='?? Test PS', type='OPERATIONS', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
|
||||||
2000023=rel(anchor='?? Test PS', type='REPRESENTATIVE', holder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
|
||||||
2000024=rel(anchor='NP Mellies, Michael', type='SUBSCRIBER', mark='operations-announce', holder='NP Fanninga, Frauke', contact='Frau Frauke Fanninga ')
|
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
@ -429,7 +425,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
void removeEmptyRelations() {
|
void removeEmptyRelations() {
|
||||||
assumeThatWeAreImportingControlledTestData();
|
assumeThatWeAreImportingControlledTestData();
|
||||||
|
|
||||||
// avoid a error when persisting the deliberately invalid partner entry #99
|
// avoid a error when persisting the deliberetely invalid partner entry #99
|
||||||
final var idsToRemove = new HashSet<Integer>();
|
final var idsToRemove = new HashSet<Integer>();
|
||||||
relations.forEach( (id, r) -> {
|
relations.forEach( (id, r) -> {
|
||||||
// such a record
|
// such a record
|
||||||
@ -438,12 +434,8 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
idsToRemove.add(id);
|
idsToRemove.add(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
assertThat(idsToRemove.size()).isEqualTo(2); // partner #99 + Hostsharing eG itself
|
||||||
// expected relations created from partner #99 + Hostsharing eG itself
|
idsToRemove.forEach(id -> relations.remove(id));
|
||||||
idsToRemove.forEach(id -> {
|
|
||||||
System.out.println("removing unused relation: " + relations.get(id).toString());
|
|
||||||
relations.remove(id);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -462,12 +454,8 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
idsToRemove.add(id);
|
idsToRemove.add(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
assertThat(idsToRemove.size()).isEqualTo(1); // only from partner #99
|
||||||
// expected partners created from partner #99 + Hostsharing eG itself
|
idsToRemove.forEach(id -> partners.remove(id));
|
||||||
idsToRemove.forEach(id -> {
|
|
||||||
System.out.println("removing unused partner: " + partners.get(id).toString());
|
|
||||||
partners.remove(id);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -518,23 +506,13 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
|
|
||||||
jpaAttempt.transacted(() -> {
|
jpaAttempt.transacted(() -> {
|
||||||
context(rbacSuperuser);
|
context(rbacSuperuser);
|
||||||
partners.forEach((id, partner) -> {
|
partners.forEach(this::persist);
|
||||||
// TODO: this is ugly and I don't know why it's suddenly necessary
|
|
||||||
partner.getPartnerRel().setAnchor(em.merge(partner.getPartnerRel().getAnchor()));
|
|
||||||
partner.getPartnerRel().setHolder(em.merge(partner.getPartnerRel().getHolder()));
|
|
||||||
partner.getPartnerRel().setContact(em.merge(partner.getPartnerRel().getContact()));
|
|
||||||
partner.setPartnerRel(em.merge(partner.getPartnerRel()));
|
|
||||||
em.persist(partner);
|
|
||||||
});
|
|
||||||
updateLegacyIds(partners, "hs_office_partner_legacy_id", "bp_id");
|
updateLegacyIds(partners, "hs_office_partner_legacy_id", "bp_id");
|
||||||
}).assertSuccessful();
|
}).assertSuccessful();
|
||||||
|
|
||||||
jpaAttempt.transacted(() -> {
|
jpaAttempt.transacted(() -> {
|
||||||
context(rbacSuperuser);
|
context(rbacSuperuser);
|
||||||
debitors.forEach((id, debitor) -> {
|
debitors.forEach(this::persist);
|
||||||
debitor.setDebitorRel(em.merge(debitor.getDebitorRel()));
|
|
||||||
em.persist(debitor);
|
|
||||||
});
|
|
||||||
}).assertSuccessful();
|
}).assertSuccessful();
|
||||||
|
|
||||||
jpaAttempt.transacted(() -> {
|
jpaAttempt.transacted(() -> {
|
||||||
@ -704,10 +682,13 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
.forEach(rec -> {
|
.forEach(rec -> {
|
||||||
final var person = HsOfficePersonEntity.builder().build();
|
final var person = HsOfficePersonEntity.builder().build();
|
||||||
|
|
||||||
final var partnerRel = addRelation(
|
final var partnerRel = HsOfficeRelationEntity.builder()
|
||||||
HsOfficeRelationType.PARTNER, mandant, person,
|
.holder(person)
|
||||||
null // is set during contacts import depending on assigned roles
|
.type(HsOfficeRelationType.PARTNER)
|
||||||
);
|
.anchor(mandant)
|
||||||
|
.contact(null) // is set during contacts import depending on assigned roles
|
||||||
|
.build();
|
||||||
|
relations.put(relationId++, partnerRel);
|
||||||
|
|
||||||
final var partner = HsOfficePartnerEntity.builder()
|
final var partner = HsOfficePartnerEntity.builder()
|
||||||
.partnerNumber(rec.getInteger("member_id"))
|
.partnerNumber(rec.getInteger("member_id"))
|
||||||
@ -716,11 +697,11 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
.build();
|
.build();
|
||||||
partners.put(rec.getInteger("bp_id"), partner);
|
partners.put(rec.getInteger("bp_id"), partner);
|
||||||
|
|
||||||
final var debitorRel = addRelation(
|
final var debitorRel = HsOfficeRelationEntity.builder()
|
||||||
HsOfficeRelationType.DEBITOR, partnerRel.getHolder(), // partner person
|
.type(HsOfficeRelationType.DEBITOR)
|
||||||
null, // will be set in contacts import
|
.anchor(partnerRel.getHolder())
|
||||||
null // will beset in contacts import
|
.holder(partnerRel.getHolder()) // currently debitor = partner
|
||||||
);
|
.build();
|
||||||
relations.put(relationId++, debitorRel);
|
relations.put(relationId++, debitorRel);
|
||||||
|
|
||||||
final var debitor = HsOfficeDebitorEntity.builder()
|
final var debitor = HsOfficeDebitorEntity.builder()
|
||||||
@ -875,14 +856,14 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
|
|
||||||
final var partnerPerson = partner.getPartnerRel().getHolder();
|
final var partnerPerson = partner.getPartnerRel().getHolder();
|
||||||
if (containsPartnerRel(rec)) {
|
if (containsPartnerRel(rec)) {
|
||||||
addPerson(partnerPerson, rec);
|
initPerson(partnerPerson, rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
HsOfficePersonEntity contactPerson = partnerPerson;
|
HsOfficePersonEntity contactPerson = partnerPerson;
|
||||||
if (!StringUtils.equals(rec.getString("firma"), partnerPerson.getTradeName()) ||
|
if (!StringUtils.equals(rec.getString("firma"), partnerPerson.getTradeName()) ||
|
||||||
!StringUtils.equals(rec.getString("first_name"), partnerPerson.getGivenName()) ||
|
!StringUtils.equals(rec.getString("first_name"), partnerPerson.getGivenName()) ||
|
||||||
!StringUtils.equals(rec.getString("last_name"), partnerPerson.getFamilyName())) {
|
!StringUtils.equals(rec.getString("last_name"), partnerPerson.getFamilyName())) {
|
||||||
contactPerson = addPerson(HsOfficePersonEntity.builder().build(), rec);
|
contactPerson = initPerson(HsOfficePersonEntity.builder().build(), rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
final var contact = HsOfficeContactEntity.builder().build();
|
final var contact = HsOfficeContactEntity.builder().build();
|
||||||
@ -894,24 +875,23 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
}
|
}
|
||||||
if (containsRole(rec, "billing")) {
|
if (containsRole(rec, "billing")) {
|
||||||
assertThat(debitor.getDebitorRel().getContact()).isNull();
|
assertThat(debitor.getDebitorRel().getContact()).isNull();
|
||||||
debitor.getDebitorRel().setHolder(contactPerson);
|
|
||||||
debitor.getDebitorRel().setContact(contact);
|
debitor.getDebitorRel().setContact(contact);
|
||||||
}
|
}
|
||||||
if (containsRole(rec, "operation")) {
|
if (containsRole(rec, "operation")) {
|
||||||
addRelation(HsOfficeRelationType.OPERATIONS, partnerPerson, contactPerson, contact);
|
addRelation(partnerPerson, contactPerson, contact, HsOfficeRelationType.OPERATIONS);
|
||||||
}
|
}
|
||||||
if (containsRole(rec, "contractual")) {
|
if (containsRole(rec, "contractual")) {
|
||||||
addRelation(HsOfficeRelationType.REPRESENTATIVE, partnerPerson, contactPerson, contact);
|
addRelation(partnerPerson, contactPerson, contact, HsOfficeRelationType.REPRESENTATIVE);
|
||||||
}
|
}
|
||||||
if (containsRole(rec, "ex-partner")) {
|
if (containsRole(rec, "ex-partner")) {
|
||||||
addRelation(HsOfficeRelationType.EX_PARTNER, partnerPerson, contactPerson, contact);
|
addRelation(partnerPerson, contactPerson, contact, HsOfficeRelationType.EX_PARTNER);
|
||||||
}
|
}
|
||||||
if (containsRole(rec, "vip-contact")) {
|
if (containsRole(rec, "vip-contact")) {
|
||||||
addRelation(HsOfficeRelationType.VIP_CONTACT, partnerPerson, contactPerson, contact);
|
addRelation(partnerPerson, contactPerson, contact, HsOfficeRelationType.VIP_CONTACT);
|
||||||
}
|
}
|
||||||
for (String subscriberRole: SUBSCRIBER_ROLES) {
|
for (String subscriberRole: SUBSCRIBER_ROLES) {
|
||||||
if (containsRole(rec, subscriberRole)) {
|
if (containsRole(rec, subscriberRole)) {
|
||||||
addRelation(HsOfficeRelationType.SUBSCRIBER, partnerPerson, contactPerson, contact)
|
addRelation(partnerPerson, contactPerson, contact, HsOfficeRelationType.SUBSCRIBER)
|
||||||
.setMark(subscriberRole.split(":")[1])
|
.setMark(subscriberRole.split(":")[1])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -944,21 +924,21 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static HsOfficeRelationEntity addRelation(
|
private static HsOfficeRelationEntity addRelation(
|
||||||
final HsOfficeRelationType type,
|
final HsOfficePersonEntity partnerPerson,
|
||||||
final HsOfficePersonEntity anchor,
|
final HsOfficePersonEntity contactPerson,
|
||||||
final HsOfficePersonEntity holder,
|
final HsOfficeContactEntity contact,
|
||||||
final HsOfficeContactEntity contact) {
|
final HsOfficeRelationType representative) {
|
||||||
final var rel = HsOfficeRelationEntity.builder()
|
final var rel = HsOfficeRelationEntity.builder()
|
||||||
.anchor(anchor)
|
.anchor(partnerPerson)
|
||||||
.holder(holder)
|
.holder(contactPerson)
|
||||||
.contact(contact)
|
.contact(contact)
|
||||||
.type(type)
|
.type(representative)
|
||||||
.build();
|
.build();
|
||||||
relations.put(relationId++, rel);
|
relations.put(relationId++, rel);
|
||||||
return rel;
|
return rel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private HsOfficePersonEntity addPerson(final HsOfficePersonEntity person, final Record contactRecord) {
|
private HsOfficePersonEntity initPerson(final HsOfficePersonEntity person, final Record contactRecord) {
|
||||||
// TODO: title+salutation: add to person
|
// TODO: title+salutation: add to person
|
||||||
person.setGivenName(contactRecord.getString("first_name"));
|
person.setGivenName(contactRecord.getString("first_name"));
|
||||||
person.setFamilyName(contactRecord.getString("last_name"));
|
person.setFamilyName(contactRecord.getString("last_name"));
|
||||||
|
@ -204,7 +204,7 @@ class TestCustomerControllerAcceptanceTest {
|
|||||||
.statusCode(403)
|
.statusCode(403)
|
||||||
.contentType(ContentType.JSON)
|
.contentType(ContentType.JSON)
|
||||||
.statusCode(403)
|
.statusCode(403)
|
||||||
.body("message", containsString("ERROR: [403] insert into test_customer not allowed for current subjects {customer-admin@yyy.example.com}"));
|
.body("message", containsString("insert into test_customer not allowed for current subjects {customer-admin@yyy.example.com}"));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
// finally, the new customer was not created
|
// finally, the new customer was not created
|
||||||
|
@ -29,7 +29,6 @@ class TestCustomerEntityUnitTest {
|
|||||||
subgraph customer:permissions[ ]
|
subgraph customer:permissions[ ]
|
||||||
style customer:permissions fill:#dd4901,stroke:white
|
style customer:permissions fill:#dd4901,stroke:white
|
||||||
|
|
||||||
perm:customer:INSERT{{customer:INSERT}}
|
|
||||||
perm:customer:DELETE{{customer:DELETE}}
|
perm:customer:DELETE{{customer:DELETE}}
|
||||||
perm:customer:UPDATE{{customer:UPDATE}}
|
perm:customer:UPDATE{{customer:UPDATE}}
|
||||||
perm:customer:SELECT{{customer:SELECT}}
|
perm:customer:SELECT{{customer:SELECT}}
|
||||||
@ -45,7 +44,6 @@ class TestCustomerEntityUnitTest {
|
|||||||
role:customer:admin ==> role:customer:tenant
|
role:customer:admin ==> role:customer:tenant
|
||||||
|
|
||||||
%% granting permissions to roles
|
%% granting permissions to roles
|
||||||
role:global:admin ==> perm:customer:INSERT
|
|
||||||
role:customer:owner ==> perm:customer:DELETE
|
role:customer:owner ==> perm:customer:DELETE
|
||||||
role:customer:admin ==> perm:customer:UPDATE
|
role:customer:admin ==> perm:customer:UPDATE
|
||||||
role:customer:tenant ==> perm:customer:SELECT
|
role:customer:tenant ==> perm:customer:SELECT
|
||||||
|
Loading…
Reference in New Issue
Block a user