1
0

wip initial commit

This commit is contained in:
Marc O. Sandlus 2024-02-02 09:02:28 +01:00
parent d9558f2cfe
commit 1a3fad80ee
4 changed files with 27 additions and 1 deletions
src/main
java/net/hostsharing/hsadminng/hs/office/person
resources
api-definition/hs-office
db/changelog

@ -27,6 +27,8 @@ public class HsOfficePersonEntity implements HasUuid, 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);
@ -40,6 +42,12 @@ public class HsOfficePersonEntity implements HasUuid, 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;
@ -54,6 +62,6 @@ public class HsOfficePersonEntity implements HasUuid, Stringifyable {
@Override @Override
public String toShortString() { public String toShortString() {
return personType + " " + return personType + " " +
(!StringUtils.isEmpty(tradeName) ? tradeName : (familyName + ", " + givenName)); (!StringUtils.isEmpty(tradeName) ? tradeName : (StringUtils.isEmpty(salutation) ? "" : salutation + " ") + (familyName + ", " + givenName));
} }
} }

@ -22,6 +22,8 @@ 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);
} }

@ -23,6 +23,10 @@ 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:
@ -35,6 +39,10 @@ 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:
@ -51,6 +59,12 @@ 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

@ -19,6 +19,8 @@ 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)
); );