Compare commits

..

No commits in common. "3998341a5b75c8cbb7c92cdaa51a97967ebc99c0" and "5051198e00e35d373a42859ef118b5c2cfd6556d" have entirely different histories.

7 changed files with 3 additions and 125 deletions

View File

@ -35,8 +35,6 @@ public class HsOfficePersonEntity implements RbacObject, Stringifyable {
private static Stringify<HsOfficePersonEntity> toString = stringify(HsOfficePersonEntity.class, "person") private static Stringify<HsOfficePersonEntity> toString = stringify(HsOfficePersonEntity.class, "person")
.withProp(Fields.personType, HsOfficePersonEntity::getPersonType) .withProp(Fields.personType, HsOfficePersonEntity::getPersonType)
.withProp(Fields.tradeName, HsOfficePersonEntity::getTradeName) .withProp(Fields.tradeName, HsOfficePersonEntity::getTradeName)
.withProp(Fields.salutation, HsOfficePersonEntity::getSalutation)
.withProp(Fields.title, HsOfficePersonEntity::getTitle)
.withProp(Fields.familyName, HsOfficePersonEntity::getFamilyName) .withProp(Fields.familyName, HsOfficePersonEntity::getFamilyName)
.withProp(Fields.givenName, HsOfficePersonEntity::getGivenName); .withProp(Fields.givenName, HsOfficePersonEntity::getGivenName);
@ -50,12 +48,6 @@ public class HsOfficePersonEntity implements RbacObject, Stringifyable {
@Column(name = "tradename") @Column(name = "tradename")
private String tradeName; private String tradeName;
@Column(name = "salutation")
private String salutation;
@Column(name = "title")
private String title;
@Column(name = "familyname") @Column(name = "familyname")
private String familyName; private String familyName;
@ -76,7 +68,7 @@ public class HsOfficePersonEntity implements RbacObject, Stringifyable {
public static RbacView rbac() { public static RbacView rbac() {
return rbacViewFor("person", HsOfficePersonEntity.class) return rbacViewFor("person", HsOfficePersonEntity.class)
.withIdentityView(SQL.projection("concat(tradeName, familyName, givenName)")) .withIdentityView(SQL.projection("concat(tradeName, familyName, givenName)"))
.withUpdatableColumns("personType", "title", "salutation", "tradeName", "givenName", "familyName") .withUpdatableColumns("personType", "tradeName", "givenName", "familyName")
.toRole("global", GUEST).grantPermission(INSERT) .toRole("global", GUEST).grantPermission(INSERT)
.createRole(OWNER, (with) -> { .createRole(OWNER, (with) -> {

View File

@ -22,8 +22,6 @@ class HsOfficePersonEntityPatcher implements EntityPatcher<HsOfficePersonPatchRe
.map(HsOfficePersonType::valueOf) .map(HsOfficePersonType::valueOf)
.ifPresent(entity::setPersonType); .ifPresent(entity::setPersonType);
OptionalFromJson.of(resource.getTradeName()).ifPresent(entity::setTradeName); OptionalFromJson.of(resource.getTradeName()).ifPresent(entity::setTradeName);
OptionalFromJson.of(resource.getSalutation()).ifPresent(entity::setSalutation);
OptionalFromJson.of(resource.getTitle()).ifPresent(entity::setTitle);
OptionalFromJson.of(resource.getFamilyName()).ifPresent(entity::setFamilyName); OptionalFromJson.of(resource.getFamilyName()).ifPresent(entity::setFamilyName);
OptionalFromJson.of(resource.getGivenName()).ifPresent(entity::setGivenName); OptionalFromJson.of(resource.getGivenName()).ifPresent(entity::setGivenName);
} }

View File

@ -23,10 +23,6 @@ components:
$ref: '#/components/schemas/HsOfficePersonType' $ref: '#/components/schemas/HsOfficePersonType'
tradeName: tradeName:
type: string type: string
salutation:
type: string
title:
type: string
givenName: givenName:
type: string type: string
familyName: familyName:
@ -39,10 +35,6 @@ components:
$ref: '#/components/schemas/HsOfficePersonType' $ref: '#/components/schemas/HsOfficePersonType'
tradeName: tradeName:
type: string type: string
salutation:
type: string
title:
type: string
givenName: givenName:
type: string type: string
familyName: familyName:
@ -59,12 +51,6 @@ components:
tradeName: tradeName:
type: string type: string
nullable: true nullable: true
salutation:
type: string
nullable: true
title:
type: string
nullable: true
givenName: givenName:
type: string type: string
nullable: true nullable: true

View File

@ -19,8 +19,6 @@ create table if not exists hs_office_person
uuid uuid unique references RbacObject (uuid) initially deferred, uuid uuid unique references RbacObject (uuid) initially deferred,
personType HsOfficePersonType not null, personType HsOfficePersonType not null,
tradeName varchar(96), tradeName varchar(96),
salutation varchar(30),
title varchar(20),
givenName varchar(48), givenName varchar(48),
familyName varchar(48) familyName varchar(48)
); );

View File

@ -138,8 +138,6 @@ call generateRbacRestrictedView('hs_office_person',
$orderBy$, $orderBy$,
$updates$ $updates$
personType = new.personType, personType = new.personType,
title = new.title,
salutation = new.salutation,
tradeName = new.tradeName, tradeName = new.tradeName,
givenName = new.givenName, givenName = new.givenName,
familyName = new.familyName familyName = new.familyName

View File

@ -23,9 +23,7 @@ class HsOfficePersonEntityPatcherUnitTest extends PatchUnitTestBase<
final var entity = new HsOfficePersonEntity(); final var entity = new HsOfficePersonEntity();
entity.setUuid(INITIAL_PERSON_UUID); entity.setUuid(INITIAL_PERSON_UUID);
entity.setPersonType(HsOfficePersonType.LEGAL_PERSON); entity.setPersonType(HsOfficePersonType.LEGAL_PERSON);
entity.setTradeName("initial trade name"); entity.setTradeName("initial@example.org");
entity.setTitle("Dr. Init.");
entity.setSalutation("Herr Initial");
entity.setFamilyName("initial postal address"); entity.setFamilyName("initial postal address");
entity.setGivenName("+01 100 123456789"); entity.setGivenName("+01 100 123456789");
return entity; return entity;
@ -56,16 +54,6 @@ class HsOfficePersonEntityPatcherUnitTest extends PatchUnitTestBase<
HsOfficePersonPatchResource::setTradeName, HsOfficePersonPatchResource::setTradeName,
"patched trade name", "patched trade name",
HsOfficePersonEntity::setTradeName), HsOfficePersonEntity::setTradeName),
new JsonNullableProperty<>(
"title",
HsOfficePersonPatchResource::setTitle,
"Dr. Patch.",
HsOfficePersonEntity::setTitle),
new JsonNullableProperty<>(
"salutation",
HsOfficePersonPatchResource::setSalutation,
"Hallo Ini",
HsOfficePersonEntity::setSalutation),
new JsonNullableProperty<>( new JsonNullableProperty<>(
"familyName", "familyName",
HsOfficePersonPatchResource::setFamilyName, HsOfficePersonPatchResource::setFamilyName,

View File

@ -60,63 +60,19 @@ class HsOfficePersonEntityUnitTest {
assertThat(actualDisplay).isEqualTo("NP some family name, some given name"); assertThat(actualDisplay).isEqualTo("NP some family name, some given name");
} }
@Test
void toShortStringWithSalutationAndTitleReturnsSalutationAndTitle() {
final var givenPersonEntity = HsOfficePersonEntity.builder()
.personType(HsOfficePersonType.NATURAL_PERSON)
.salutation("Frau")
.title("Dr.")
.familyName("some family name")
.givenName("some given name")
.build();
final var actualDisplay = givenPersonEntity.toShortString();
assertThat(actualDisplay).isEqualTo("NP some family name, some given name");
}
@Test
void toShortStringWithSalutationAndWithoutTitleReturnsSalutation() {
final var givenPersonEntity = HsOfficePersonEntity.builder()
.personType(HsOfficePersonType.NATURAL_PERSON)
.salutation("Frau")
.familyName("some family name")
.givenName("some given name")
.build();
final var actualDisplay = givenPersonEntity.toShortString();
assertThat(actualDisplay).isEqualTo("NP Frau some family name, some given name");
}
@Test
void toShortStringWithoutSalutationAndWithTitleReturnsTitle() {
final var givenPersonEntity = HsOfficePersonEntity.builder()
.personType(HsOfficePersonType.NATURAL_PERSON)
.title("Dr. Dr.")
.familyName("some family name")
.givenName("some given name")
.build();
final var actualDisplay = givenPersonEntity.toShortString();
assertThat(actualDisplay).isEqualTo("NP some family name, some given name");
}
@Test @Test
void toStringWithAllFieldsReturnsAllButUuid() { void toStringWithAllFieldsReturnsAllButUuid() {
final var givenPersonEntity = HsOfficePersonEntity.builder() final var givenPersonEntity = HsOfficePersonEntity.builder()
.uuid(UUID.randomUUID()) .uuid(UUID.randomUUID())
.personType(HsOfficePersonType.NATURAL_PERSON) .personType(HsOfficePersonType.NATURAL_PERSON)
.tradeName("some trade name") .tradeName("some trade name")
.title("Dr.")
.familyName("some family name") .familyName("some family name")
.givenName("some given name") .givenName("some given name")
.build(); .build();
final var actualDisplay = givenPersonEntity.toString(); final var actualDisplay = givenPersonEntity.toString();
assertThat(actualDisplay).isEqualTo("person(personType='NP', tradeName='some trade name', title='Dr.', familyName='some family name', givenName='some given name')"); assertThat(actualDisplay).isEqualTo("person(personType='NP', tradeName='some trade name', familyName='some family name', givenName='some given name')");
} }
@Test @Test
@ -130,42 +86,4 @@ class HsOfficePersonEntityUnitTest {
assertThat(actualDisplay).isEqualTo("person(familyName='some family name', givenName='some given name')"); assertThat(actualDisplay).isEqualTo("person(familyName='some family name', givenName='some given name')");
} }
@Test
void toStringWithSalutationAndTitleRetursSalutationAndTitle() {
final var givenPersonEntity = HsOfficePersonEntity.builder()
.salutation("Herr")
.title("Prof. Dr.")
.familyName("some family name")
.givenName("some given name")
.build();
final var actualDisplay = givenPersonEntity.toString();
assertThat(actualDisplay).isEqualTo("person(salutation='Herr', title='Prof. Dr.', familyName='some family name', givenName='some given name')");
}
@Test
void toStringWithSalutationAndWithoutTitleSkipsTitle() {
final var givenPersonEntity = HsOfficePersonEntity.builder()
.salutation("Herr")
.familyName("some family name")
.givenName("some given name")
.build();
final var actualDisplay = givenPersonEntity.toString();
assertThat(actualDisplay).isEqualTo("person(salutation='Herr', familyName='some family name', givenName='some given name')");
}
@Test
void toStringWithoutSalutationAndWithTitleSkipsSalutation() {
final var givenPersonEntity = HsOfficePersonEntity.builder()
.title("some title")
.familyName("some family name")
.givenName("some given name")
.build();
final var actualDisplay = givenPersonEntity.toString();
assertThat(actualDisplay).isEqualTo("person(title='some title', familyName='some family name', givenName='some given name')");
}
} }