|
|
@ -134,7 +134,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
7=partner(Mellies, Michael: Herr Michael Mellies ),
|
|
|
|
7=partner(Mellies, Michael: Herr Michael Mellies ),
|
|
|
|
10=partner(JM e.K.: Frau Dr. Jenny Meyer , JM e.K.),
|
|
|
|
10=partner(JM e.K.: Frau Dr. Jenny Meyer , JM e.K.),
|
|
|
|
12=partner(Test PS: Paule Schmidt , Test PS)
|
|
|
|
12=partner(Test PS: Petra Schmidt , Test PS)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
""");
|
|
|
|
""");
|
|
|
|
assertThat(contacts.toString()).isEqualToIgnoringWhitespace("""
|
|
|
|
assertThat(contacts.toString()).isEqualToIgnoringWhitespace("""
|
|
|
@ -142,14 +142,14 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|
|
|
71=contact(label='Herr Michael Mellies ', emailAddresses='mih@example.org'),
|
|
|
|
71=contact(label='Herr Michael Mellies ', emailAddresses='mih@example.org'),
|
|
|
|
101=contact(label='Frau Dr. Jenny Meyer , JM e.K.', emailAddresses='jm@example.org'),
|
|
|
|
101=contact(label='Frau Dr. Jenny Meyer , JM e.K.', emailAddresses='jm@example.org'),
|
|
|
|
102=contact(label='Herr Andrew Meyer , JM e.K.', emailAddresses='am@example.org'),
|
|
|
|
102=contact(label='Herr Andrew Meyer , JM e.K.', emailAddresses='am@example.org'),
|
|
|
|
121=contact(label='Paule Schmidt , Test PS', emailAddresses='ps@example.com')
|
|
|
|
121=contact(label='Petra Schmidt , Test PS', emailAddresses='ps@example.com')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
""");
|
|
|
|
""");
|
|
|
|
assertThat(persons.toString()).isEqualToIgnoringWhitespace("""
|
|
|
|
assertThat(persons.toString()).isEqualToIgnoringWhitespace("""
|
|
|
|
{
|
|
|
|
{
|
|
|
|
7=person(personType='UNKNOWN', tradeName='', familyName='Mellies', givenName='Michael'),
|
|
|
|
7=person(personType='UNKNOWN', tradeName='', familyName='Mellies', givenName='Michael'),
|
|
|
|
10=person(personType='UNKNOWN', tradeName='JM e.K.', familyName='Meyer', givenName='Jenny'),
|
|
|
|
10=person(personType='UNKNOWN', tradeName='JM e.K.', familyName='Meyer', givenName='Jenny'),
|
|
|
|
12=person(personType='UNKNOWN', tradeName='Test PS', familyName='Schmidt', givenName='Paule')
|
|
|
|
12=person(personType='UNKNOWN', tradeName='Test PS', familyName='Schmidt', givenName='Petra')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
""");
|
|
|
|
""");
|
|
|
|
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
|
|
|
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
|
|
@ -242,7 +242,6 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
@Order(10)
|
|
|
|
@Order(10)
|
|
|
|
@Commit
|
|
|
|
@Commit
|
|
|
|
//@Rollback(false)
|
|
|
|
|
|
|
|
void persistEntities() {
|
|
|
|
void persistEntities() {
|
|
|
|
|
|
|
|
|
|
|
|
context("superuser-alex@hostsharing.net"); // TODO: use real user for actual import
|
|
|
|
context("superuser-alex@hostsharing.net"); // TODO: use real user for actual import
|
|
|
@ -390,6 +389,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|
|
|
final var member = memberships.get(rec.getInteger("bp_id"));
|
|
|
|
final var member = memberships.get(rec.getInteger("bp_id"));
|
|
|
|
|
|
|
|
|
|
|
|
final var assetTypeMapping = new HashMap<String, HsOfficeCoopAssetsTransactionType>() {
|
|
|
|
final var assetTypeMapping = new HashMap<String, HsOfficeCoopAssetsTransactionType>() {
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
put("HANDOVER", HsOfficeCoopAssetsTransactionType.TRANSFER);
|
|
|
|
put("HANDOVER", HsOfficeCoopAssetsTransactionType.TRANSFER);
|
|
|
|
put("ADOPTION", HsOfficeCoopAssetsTransactionType.ADOPTION);
|
|
|
|
put("ADOPTION", HsOfficeCoopAssetsTransactionType.ADOPTION);
|
|
|
@ -481,7 +481,12 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|
|
|
private void initContact(final HsOfficeContactEntity contact, final Record rec) {
|
|
|
|
private void initContact(final HsOfficeContactEntity contact, final Record rec) {
|
|
|
|
contacts.put(rec.getInteger("contact_id"), contact);
|
|
|
|
contacts.put(rec.getInteger("contact_id"), contact);
|
|
|
|
|
|
|
|
|
|
|
|
contact.setLabel(toLabel(rec.getString("salut"), rec.getString("title"), rec.getString("first_name"), rec.getString("last_name"), rec.getString("firma")));
|
|
|
|
contact.setLabel(toLabel(
|
|
|
|
|
|
|
|
rec.getString("salut"),
|
|
|
|
|
|
|
|
rec.getString("title"),
|
|
|
|
|
|
|
|
rec.getString("first_name"),
|
|
|
|
|
|
|
|
rec.getString("last_name"),
|
|
|
|
|
|
|
|
rec.getString("firma")));
|
|
|
|
contact.setEmailAddresses(rec.getString("email"));
|
|
|
|
contact.setEmailAddresses(rec.getString("email"));
|
|
|
|
contact.setPostalAddress(toAddress(rec));
|
|
|
|
contact.setPostalAddress(toAddress(rec));
|
|
|
|
contact.setPhoneNumbers(toPhoneNumbers(rec));
|
|
|
|
contact.setPhoneNumbers(toPhoneNumbers(rec));
|
|
|
@ -495,6 +500,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return record;
|
|
|
|
return record;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String toPhoneNumbers(final Record rec) {
|
|
|
|
private String toPhoneNumbers(final Record rec) {
|
|
|
|
final var result = new StringBuilder("{\n");
|
|
|
|
final var result = new StringBuilder("{\n");
|
|
|
|
if (isNotBlank(rec.getString("phone_private")))
|
|
|
|
if (isNotBlank(rec.getString("phone_private")))
|
|
|
@ -510,7 +516,11 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|
|
|
|
|
|
|
|
|
|
|
private String toAddress(final Record rec) {
|
|
|
|
private String toAddress(final Record rec) {
|
|
|
|
final var result = new StringBuilder();
|
|
|
|
final var result = new StringBuilder();
|
|
|
|
final var name = toName(rec.getString("salut"), rec.getString("title"), rec.getString("first_name"), rec.getString("last_name"));
|
|
|
|
final var name = toName(
|
|
|
|
|
|
|
|
rec.getString("salut"),
|
|
|
|
|
|
|
|
rec.getString("title"),
|
|
|
|
|
|
|
|
rec.getString("first_name"),
|
|
|
|
|
|
|
|
rec.getString("last_name"));
|
|
|
|
if (isNotBlank(name))
|
|
|
|
if (isNotBlank(name))
|
|
|
|
result.append(name + "\n");
|
|
|
|
result.append(name + "\n");
|
|
|
|
if (isNotBlank(rec.getString("firma")))
|
|
|
|
if (isNotBlank(rec.getString("firma")))
|
|
|
@ -561,7 +571,6 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|
|
|
return toLabel(salut, title, firstname, lastname, null);
|
|
|
|
return toLabel(salut, title, firstname, lastname, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Reader resourceReader(@NotNull final String resourcePath) {
|
|
|
|
private Reader resourceReader(@NotNull final String resourcePath) {
|
|
|
|
return new InputStreamReader(getClass().getClassLoader().getResourceAsStream(resourcePath));
|
|
|
|
return new InputStreamReader(getClass().getClassLoader().getResourceAsStream(resourcePath));
|
|
|
|
}
|
|
|
|
}
|
|
|
|