introduce HsOfficeContactRbacEntity (WIP) Import working, but not normal tests

This commit is contained in:
Michael Hoennig 2024-08-02 14:02:42 +02:00
parent 457fe37306
commit ab3365941b
33 changed files with 201 additions and 117 deletions

View File

@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.hosting.asset;
import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity;
import net.hostsharing.hsadminng.hs.booking.project.HsBookingProjectEntity; import net.hostsharing.hsadminng.hs.booking.project.HsBookingProjectEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.validation.PropertiesProvider; import net.hostsharing.hsadminng.hs.validation.PropertiesProvider;
import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject;
import net.hostsharing.hsadminng.stringify.Stringify; import net.hostsharing.hsadminng.stringify.Stringify;
@ -36,7 +36,7 @@ public interface HsHostingAsset extends Stringifyable, RbacObject<HsHostingAsset
String getIdentifier(); String getIdentifier();
HsBookingItemEntity getBookingItem(); HsBookingItemEntity getBookingItem();
HsHostingAsset getAssignedToAsset(); HsHostingAsset getAssignedToAsset();
HsOfficeContactEntity getAlarmContact(); HsOfficeContactRbacEntity getAlarmContact();
List<? extends HsHostingAsset> getSubHostingAssets(); List<? extends HsHostingAsset> getSubHostingAssets();
String getCaption(); String getCaption();
Map<String, Object> getConfig(); Map<String, Object> getConfig();

View File

@ -8,7 +8,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.mapper.PatchableMapWrapper; import net.hostsharing.hsadminng.mapper.PatchableMapWrapper;
import net.hostsharing.hsadminng.rbac.rbacdef.RbacView; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView;
import net.hostsharing.hsadminng.rbac.rbacdef.RbacView.SQL; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView.SQL;
@ -90,7 +90,7 @@ public class HsHostingAssetEntity implements HsHostingAsset {
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "alarmcontactuuid") @JoinColumn(name = "alarmcontactuuid")
private HsOfficeContactEntity alarmContact; private HsOfficeContactRbacEntity alarmContact;
@OneToMany(cascade = CascadeType.REFRESH, orphanRemoval = true, fetch = FetchType.LAZY) @OneToMany(cascade = CascadeType.REFRESH, orphanRemoval = true, fetch = FetchType.LAZY)
@JoinColumn(name = "parentassetuuid", referencedColumnName = "uuid") @JoinColumn(name = "parentassetuuid", referencedColumnName = "uuid")
@ -160,7 +160,7 @@ public class HsHostingAssetEntity implements HsHostingAsset {
directlyFetchedByDependsOnColumn(), directlyFetchedByDependsOnColumn(),
NULLABLE) NULLABLE)
.importEntityAlias("alarmContact", HsOfficeContactEntity.class, usingDefaultCase(), .importEntityAlias("alarmContact", HsOfficeContactRbacEntity.class, usingDefaultCase(),
dependsOnColumn("alarmContactUuid"), dependsOnColumn("alarmContactUuid"),
directlyFetchedByDependsOnColumn(), directlyFetchedByDependsOnColumn(),
NULLABLE) NULLABLE)

View File

@ -1,7 +1,7 @@
package net.hostsharing.hsadminng.hs.hosting.asset; package net.hostsharing.hsadminng.hs.hosting.asset;
import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetPatchResource; import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetPatchResource;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.mapper.EntityPatcher; import net.hostsharing.hsadminng.mapper.EntityPatcher;
import net.hostsharing.hsadminng.mapper.KeyValueMap; import net.hostsharing.hsadminng.mapper.KeyValueMap;
import net.hostsharing.hsadminng.mapper.OptionalFromJson; import net.hostsharing.hsadminng.mapper.OptionalFromJson;
@ -29,7 +29,7 @@ public class HsHostingAssetEntityPatcher implements EntityPatcher<HsHostingAsset
// HOWTO: patch nullable JSON resource uuid to an ntity reference // HOWTO: patch nullable JSON resource uuid to an ntity reference
.ifPresent(newValue -> entity.setAlarmContact( .ifPresent(newValue -> entity.setAlarmContact(
Optional.ofNullable(newValue) Optional.ofNullable(newValue)
.map(uuid -> em.getReference(HsOfficeContactEntity.class, newValue)) .map(uuid -> em.getReference(HsOfficeContactRbacEntity.class, newValue))
.orElse(null))); .orElse(null)));
} }
} }

View File

@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemType;
import net.hostsharing.hsadminng.hs.booking.item.validators.HsBookingItemEntityValidatorRegistry; import net.hostsharing.hsadminng.hs.booking.item.validators.HsBookingItemEntityValidatorRegistry;
import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAsset; import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAsset;
import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType; import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.validation.HsEntityValidator; import net.hostsharing.hsadminng.hs.validation.HsEntityValidator;
import net.hostsharing.hsadminng.hs.validation.ValidatableProperty; import net.hostsharing.hsadminng.hs.validation.ValidatableProperty;
@ -213,7 +213,7 @@ public abstract class HostingAssetEntityValidator extends HsEntityValidator<HsHo
} }
} }
static class AlarmContact extends ReferenceValidator<HsOfficeContactEntity, Enum<?>> { static class AlarmContact extends ReferenceValidator<HsOfficeContactRbacEntity, Enum<?>> {
AlarmContact(final HsHostingAssetType.RelationPolicy policy) { AlarmContact(final HsHostingAssetType.RelationPolicy policy) {
super(policy, HsHostingAsset::getAlarmContact); super(policy, HsHostingAsset::getAlarmContact);

View File

@ -54,7 +54,7 @@ public class HsOfficeContactController implements HsOfficeContactsApi {
context.define(currentUser, assumedRoles); context.define(currentUser, assumedRoles);
final var entityToSave = mapper.map(body, HsOfficeContactEntity.class, RESOURCE_TO_ENTITY_POSTMAPPER); final var entityToSave = mapper.map(body, HsOfficeContactRbacEntity.class, RESOURCE_TO_ENTITY_POSTMAPPER);
final var saved = contactRepo.save(entityToSave); final var saved = contactRepo.save(entityToSave);
@ -119,7 +119,7 @@ public class HsOfficeContactController implements HsOfficeContactsApi {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final BiConsumer<HsOfficeContactInsertResource, HsOfficeContactEntity> RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> { final BiConsumer<HsOfficeContactInsertResource, HsOfficeContactRbacEntity> RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> {
entity.putEmailAddresses(from(resource.getEmailAddresses())); entity.putEmailAddresses(from(resource.getEmailAddresses()));
entity.putPhoneNumbers(from(resource.getPhoneNumbers())); entity.putPhoneNumbers(from(resource.getPhoneNumbers()));
}; };

View File

@ -1,36 +1,58 @@
package net.hostsharing.hsadminng.hs.office.contact; package net.hostsharing.hsadminng.hs.office.contact;
import io.hypersistence.utils.hibernate.type.json.JsonType; import io.hypersistence.utils.hibernate.type.json.JsonType;
import lombok.*; import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.FieldNameConstants; import lombok.experimental.FieldNameConstants;
import lombok.experimental.SuperBuilder;
import net.hostsharing.hsadminng.errors.DisplayName; import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity;
import net.hostsharing.hsadminng.mapper.PatchableMapWrapper; import net.hostsharing.hsadminng.mapper.PatchableMapWrapper;
import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject;
import net.hostsharing.hsadminng.rbac.rbacdef.RbacView; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView;
import net.hostsharing.hsadminng.rbac.rbacdef.RbacView.SQL; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView.SQL;
import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject;
import net.hostsharing.hsadminng.stringify.Stringify; import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable; import net.hostsharing.hsadminng.stringify.Stringifyable;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import jakarta.persistence.*; import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.Inheritance;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import jakarta.persistence.Version;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import static jakarta.persistence.InheritanceType.TABLE_PER_CLASS;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.GLOBAL; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.GLOBAL;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Permission.*; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Permission.DELETE;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Permission.INSERT;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Permission.SELECT;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Permission.UPDATE;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.RbacUserReference.UserRole.CREATOR; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.RbacUserReference.UserRole.CREATOR;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Role.*; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Role.ADMIN;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Role.GUEST;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Role.OWNER;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Role.REFERRER;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.rbacViewFor; import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.rbacViewFor;
import static net.hostsharing.hsadminng.stringify.Stringify.stringify; import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
@Entity @Entity
@Table(name = "hs_office_contact_rv") @Table(name = "hs_office_contact")
@Inheritance(strategy = TABLE_PER_CLASS)
@Getter @Getter
@Setter @Setter
@Builder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@FieldNameConstants @FieldNameConstants
@ -99,6 +121,9 @@ public class HsOfficeContactEntity implements Stringifyable, RbacObject<HsOffice
return caption; return caption;
} }
public HsOfficeRelationEntity.HsOfficeRelationEntityBuilder<?, ?> toBuilder() {
return null;
}
public static RbacView rbac() { public static RbacView rbac() {
return rbacViewFor("contact", HsOfficeContactEntity.class) return rbacViewFor("contact", HsOfficeContactEntity.class)
.withIdentityView(SQL.projection("caption")) .withIdentityView(SQL.projection("caption"))

View File

@ -9,9 +9,9 @@ import java.util.Optional;
class HsOfficeContactEntityPatcher implements EntityPatcher<HsOfficeContactPatchResource> { class HsOfficeContactEntityPatcher implements EntityPatcher<HsOfficeContactPatchResource> {
private final HsOfficeContactEntity entity; private final HsOfficeContactRbacEntity entity;
HsOfficeContactEntityPatcher(final HsOfficeContactEntity entity) { HsOfficeContactEntityPatcher(final HsOfficeContactRbacEntity entity) {
this.entity = entity; this.entity = entity;
} }

View File

@ -0,0 +1,56 @@
package net.hostsharing.hsadminng.hs.office.contact;
import lombok.*;
import lombok.experimental.FieldNameConstants;
import lombok.experimental.SuperBuilder;
import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity;
import net.hostsharing.hsadminng.rbac.rbacdef.RbacView;
import net.hostsharing.hsadminng.rbac.rbacdef.RbacView.SQL;
import jakarta.persistence.*;
import java.io.IOException;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.GLOBAL;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Permission.*;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.RbacUserReference.UserRole.CREATOR;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.Role.*;
import static net.hostsharing.hsadminng.rbac.rbacdef.RbacView.rbacViewFor;
@Entity
@Table(name = "hs_office_contact_rv")
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@FieldNameConstants
@DisplayName("Contact")
public class HsOfficeContactRbacEntity extends HsOfficeContactEntity {
@Override
public HsOfficeRelationEntity.HsOfficeRelationEntityBuilder<?, ?> toBuilder() {
return null;
}
public static RbacView rbac() {
return rbacViewFor("contact", HsOfficeContactRbacEntity.class)
.withIdentityView(SQL.projection("caption"))
.withUpdatableColumns("caption", "postalAddress", "emailAddresses", "phoneNumbers")
.createRole(OWNER, (with) -> {
with.owningUser(CREATOR);
with.incomingSuperRole(GLOBAL, ADMIN);
with.permission(DELETE);
})
.createSubRole(ADMIN, (with) -> {
with.permission(UPDATE);
})
.createSubRole(REFERRER, (with) -> {
with.permission(SELECT);
})
.toRole(GLOBAL, GUEST).grantPermission(INSERT);
}
public static void main(String[] args) throws IOException {
rbac().generateWithBaseFileName("5-hs-office/501-contact/5013-hs-office-contact-rbac");
}
}

View File

@ -7,18 +7,18 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
public interface HsOfficeContactRepository extends Repository<HsOfficeContactEntity, UUID> { public interface HsOfficeContactRepository extends Repository<HsOfficeContactRbacEntity, UUID> {
Optional<HsOfficeContactEntity> findByUuid(UUID id); Optional<HsOfficeContactRbacEntity> findByUuid(UUID id);
@Query(""" @Query("""
SELECT c FROM HsOfficeContactEntity c SELECT c FROM HsOfficeContactRbacEntity c
WHERE :caption is null WHERE :caption is null
OR c.caption like concat(cast(:caption as text), '%') OR c.caption like concat(cast(:caption as text), '%')
""") """)
List<HsOfficeContactEntity> findContactByOptionalCaptionLike(String caption); List<HsOfficeContactRbacEntity> findContactByOptionalCaptionLike(String caption);
HsOfficeContactEntity save(final HsOfficeContactEntity entity); HsOfficeContactRbacEntity save(final HsOfficeContactRbacEntity entity);
int deleteByUuid(final UUID uuid); int deleteByUuid(final UUID uuid);

View File

@ -3,6 +3,7 @@ package net.hostsharing.hsadminng.hs.office.partner;
import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.context.Context;
import net.hostsharing.hsadminng.errors.ReferenceNotFoundException; import net.hostsharing.hsadminng.errors.ReferenceNotFoundException;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficePartnersApi; import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficePartnersApi;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerInsertResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerInsertResource;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerPatchResource;

View File

@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import net.hostsharing.hsadminng.errors.DisplayName; import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity;

View File

@ -11,15 +11,14 @@ import jakarta.persistence.Table;
@Entity @Entity
@Table(name = "hs_office_relation") @Table(name = "hs_office_relation")
//@DiscriminatorValue("0")
@SuperBuilder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@Getter @Getter
@Setter @Setter
public class HsOfficeRelationRawEntity extends HsOfficeRelationEntity { public class HsOfficeRelationBareEntity extends HsOfficeRelationEntity {
@Override @Override
public HsOfficeRelationEntityBuilder<?, ?> toBuilder() { public HsOfficeRelationEntityBuilder<?, ?> toBuilder() {
return null; return null; // FIXME: also the ugly generics, if possible
} }
} }

View File

@ -4,6 +4,8 @@ import lombok.*;
import lombok.experimental.FieldNameConstants; import lombok.experimental.FieldNameConstants;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject;
import net.hostsharing.hsadminng.rbac.rbacdef.RbacView; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView;
@ -116,7 +118,7 @@ public abstract class HsOfficeRelationEntity implements RbacObject<HsOfficeRelat
dependsOnColumn("holderUuid"), dependsOnColumn("holderUuid"),
directlyFetchedByDependsOnColumn(), directlyFetchedByDependsOnColumn(),
NOT_NULL) NOT_NULL)
.importEntityAlias("contact", HsOfficeContactEntity.class, usingDefaultCase(), .importEntityAlias("contact", HsOfficeContactRbacEntity.class, usingDefaultCase(),
dependsOnColumn("contactUuid"), dependsOnColumn("contactUuid"),
directlyFetchedByDependsOnColumn(), directlyFetchedByDependsOnColumn(),
NOT_NULL) NOT_NULL)

View File

@ -1,6 +1,6 @@
package net.hostsharing.hsadminng.hs.office.relation; package net.hostsharing.hsadminng.hs.office.relation;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationPatchResource;
import net.hostsharing.hsadminng.mapper.EntityPatcher; import net.hostsharing.hsadminng.mapper.EntityPatcher;
import net.hostsharing.hsadminng.mapper.OptionalFromJson; import net.hostsharing.hsadminng.mapper.OptionalFromJson;
@ -22,7 +22,7 @@ class HsOfficeRelationEntityPatcher implements EntityPatcher<HsOfficeRelationPat
public void apply(final HsOfficeRelationPatchResource resource) { public void apply(final HsOfficeRelationPatchResource resource) {
OptionalFromJson.of(resource.getContactUuid()).ifPresent(newValue -> { OptionalFromJson.of(resource.getContactUuid()).ifPresent(newValue -> {
verifyNotNull(newValue, "contact"); verifyNotNull(newValue, "contact");
entity.setContact(em.getReference(HsOfficeContactEntity.class, newValue)); entity.setContact(em.getReference(HsOfficeContactRbacEntity.class, newValue));
}); });
} }

View File

@ -4,7 +4,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.rbac.rbacdef.RbacView; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView;
import net.hostsharing.hsadminng.rbac.rbacdef.RbacView.SQL; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView.SQL;
@ -63,7 +63,7 @@ public class HsOfficeRelationRbacEntity extends HsOfficeRelationEntity {
dependsOnColumn("holderUuid"), dependsOnColumn("holderUuid"),
directlyFetchedByDependsOnColumn(), directlyFetchedByDependsOnColumn(),
NOT_NULL) NOT_NULL)
.importEntityAlias("contact", HsOfficeContactEntity.class, usingDefaultCase(), .importEntityAlias("contact", HsOfficeContactRbacEntity.class, usingDefaultCase(),
dependsOnColumn("contactUuid"), dependsOnColumn("contactUuid"),
directlyFetchedByDependsOnColumn(), directlyFetchedByDependsOnColumn(),
NOT_NULL) NOT_NULL)

View File

@ -8,7 +8,7 @@ import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity;
import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemRepository; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemRepository;
import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemType; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemType;
import net.hostsharing.hsadminng.hs.booking.project.HsBookingProjectRepository; import net.hostsharing.hsadminng.hs.booking.project.HsBookingProjectRepository;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRepository; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRepository;
import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository; import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository;
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
@ -732,7 +732,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
}).assertSuccessful().returnedValue(); }).assertSuccessful().returnedValue();
} }
private HsOfficeContactEntity givenContact() { private HsOfficeContactRbacEntity givenContact() {
return jpaAttempt.transacted(() -> { return jpaAttempt.transacted(() -> {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
return contactRepo.findContactByOptionalCaptionLike("second").stream().findFirst().orElseThrow(); return contactRepo.findContactByOptionalCaptionLike("second").stream().findFirst().orElseThrow();

View File

@ -1,7 +1,7 @@
package net.hostsharing.hsadminng.hs.hosting.asset; package net.hostsharing.hsadminng.hs.hosting.asset;
import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetPatchResource; import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetPatchResource;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.mapper.KeyValueMap; import net.hostsharing.hsadminng.mapper.KeyValueMap;
import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
@ -48,7 +48,7 @@ class HsHostingAssetEntityPatcherUnitTest extends PatchUnitTestBase<
entry("SSD", 256), entry("SSD", 256),
entry("MEM", 64) entry("MEM", 64)
); );
final HsOfficeContactEntity givenInitialContact = HsOfficeContactEntity.builder() final HsOfficeContactRbacEntity givenInitialContact = HsOfficeContactRbacEntity.builder()
.uuid(UUID.randomUUID()) .uuid(UUID.randomUUID())
.build(); .build();
@ -62,8 +62,8 @@ class HsHostingAssetEntityPatcherUnitTest extends PatchUnitTestBase<
void initMocks() { void initMocks() {
lenient().when(em.getReference(eq(HsHostingAssetEntity.class), any())).thenAnswer(invocation -> lenient().when(em.getReference(eq(HsHostingAssetEntity.class), any())).thenAnswer(invocation ->
HsHostingAssetEntity.builder().uuid(invocation.getArgument(1)).build()); HsHostingAssetEntity.builder().uuid(invocation.getArgument(1)).build());
lenient().when(em.getReference(eq(HsOfficeContactEntity.class), any())).thenAnswer(invocation -> lenient().when(em.getReference(eq(HsOfficeContactRbacEntity.class), any())).thenAnswer(invocation ->
HsOfficeContactEntity.builder().uuid(invocation.getArgument(1)).build()); HsOfficeContactRbacEntity.builder().uuid(invocation.getArgument(1)).build());
} }
@Override @Override
@ -111,7 +111,7 @@ class HsHostingAssetEntityPatcherUnitTest extends PatchUnitTestBase<
); );
} }
static HsOfficeContactEntity newContact(final UUID uuid) { static HsOfficeContactRbacEntity newContact(final UUID uuid) {
return HsOfficeContactEntity.builder().uuid(uuid).build(); return HsOfficeContactRbacEntity.builder().uuid(uuid).build();
} }
} }

View File

@ -10,7 +10,7 @@ import lombok.Setter;
import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity;
import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAsset; import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAsset;
import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType; import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.mapper.PatchableMapWrapper; import net.hostsharing.hsadminng.mapper.PatchableMapWrapper;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
@ -42,7 +42,7 @@ import java.util.UUID;
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class HsHostingAssetRawEntity implements HsHostingAsset { public class HsHostingAssetBareEntity implements HsHostingAsset {
@Id @Id
@GeneratedValue @GeneratedValue
@ -57,11 +57,11 @@ public class HsHostingAssetRawEntity implements HsHostingAsset {
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "parentassetuuid") @JoinColumn(name = "parentassetuuid")
private HsHostingAssetRawEntity parentAsset; private HsHostingAssetBareEntity parentAsset;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "assignedtoassetuuid") @JoinColumn(name = "assignedtoassetuuid")
private HsHostingAssetRawEntity assignedToAsset; private HsHostingAssetBareEntity assignedToAsset;
@Column(name = "type") @Column(name = "type")
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
@ -69,11 +69,11 @@ public class HsHostingAssetRawEntity implements HsHostingAsset {
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "alarmcontactuuid") @JoinColumn(name = "alarmcontactuuid")
private HsOfficeContactEntity alarmContact; private HsOfficeContactRbacEntity alarmContact;
@OneToMany(cascade = CascadeType.REFRESH, orphanRemoval = true, fetch = FetchType.LAZY) @OneToMany(cascade = CascadeType.REFRESH, orphanRemoval = true, fetch = FetchType.LAZY)
@JoinColumn(name = "parentassetuuid", referencedColumnName = "uuid") @JoinColumn(name = "parentassetuuid", referencedColumnName = "uuid")
private List<HsHostingAssetRawEntity> subHostingAssets; private List<HsHostingAssetBareEntity> subHostingAssets;
@Column(name = "identifier") @Column(name = "identifier")
private String identifier; // e.g. vm1234, xyz00, example.org, xyz00_abc private String identifier; // e.g. vm1234, xyz00, example.org, xyz00_abc
@ -109,6 +109,6 @@ public class HsHostingAssetRawEntity implements HsHostingAsset {
@Override @Override
public String toString() { public String toString() {
return stringify.using(HsHostingAssetRawEntity.class).apply(this); return stringify.using(HsHostingAssetBareEntity.class).apply(this);
} }
} }

View File

@ -113,13 +113,13 @@ public class ImportHostingAssets extends ImportOfficeData {
static final Integer DBUSER_ID_OFFSET = 7000000; static final Integer DBUSER_ID_OFFSET = 7000000;
static final Integer DB_ID_OFFSET = 8000000; static final Integer DB_ID_OFFSET = 8000000;
record Hive(int hive_id, String hive_name, int inet_addr_id, AtomicReference<HsHostingAssetRawEntity> serverRef) {} record Hive(int hive_id, String hive_name, int inet_addr_id, AtomicReference<HsHostingAssetBareEntity> serverRef) {}
static Map<Integer, HsBookingProjectEntity> bookingProjects = new WriteOnceMap<>(); static Map<Integer, HsBookingProjectEntity> bookingProjects = new WriteOnceMap<>();
static Map<Integer, HsBookingItemEntity> bookingItems = new WriteOnceMap<>(); static Map<Integer, HsBookingItemEntity> bookingItems = new WriteOnceMap<>();
static Map<Integer, Hive> hives = new WriteOnceMap<>(); static Map<Integer, Hive> hives = new WriteOnceMap<>();
static Map<Integer, HsHostingAssetRawEntity> hostingAssets = new WriteOnceMap<>(); // TODO.impl: separate maps for each type? static Map<Integer, HsHostingAssetBareEntity> hostingAssets = new WriteOnceMap<>(); // TODO.impl: separate maps for each type?
static Map<String, HsHostingAssetRawEntity> dbUsersByEngineAndName = new WriteOnceMap<>(); static Map<String, HsHostingAssetBareEntity> dbUsersByEngineAndName = new WriteOnceMap<>();
@Test @Test
@Order(11010) @Order(11010)
@ -670,7 +670,7 @@ public class ImportHostingAssets extends ImportOfficeData {
.map(this::trimAll) .map(this::trimAll)
.map(row -> new Record(columns, row)) .map(row -> new Record(columns, row))
.forEach(rec -> { .forEach(rec -> {
final var ipNumber = HsHostingAssetRawEntity.builder() final var ipNumber = HsHostingAssetBareEntity.builder()
.type(IPV4_NUMBER) .type(IPV4_NUMBER)
.identifier(rec.getString("inet_addr")) .identifier(rec.getString("inet_addr"))
.caption(rec.getString("description")) .caption(rec.getString("description"))
@ -734,7 +734,7 @@ public class ImportHostingAssets extends ImportOfficeData {
+ packet_name) + packet_name)
.isTrue()); .isTrue());
final var asset = HsHostingAssetRawEntity.builder() final var asset = HsHostingAssetBareEntity.builder()
// this turns off identifier validation to accept former default prefixes // this turns off identifier validation to accept former default prefixes
.isLoaded(haType == MANAGED_WEBSPACE) .isLoaded(haType == MANAGED_WEBSPACE)
.type(haType) .type(haType)
@ -874,7 +874,7 @@ public class ImportHostingAssets extends ImportOfficeData {
.forEach(rec -> { .forEach(rec -> {
final var unixuser_id = rec.getInteger("unixuser_id"); final var unixuser_id = rec.getInteger("unixuser_id");
final var packet_id = rec.getInteger("packet_id"); final var packet_id = rec.getInteger("packet_id");
final var unixUserAsset = HsHostingAssetRawEntity.builder() final var unixUserAsset = HsHostingAssetBareEntity.builder()
.type(UNIX_USER) .type(UNIX_USER)
.parentAsset(hostingAssets.get(PACKET_ID_OFFSET + packet_id)) .parentAsset(hostingAssets.get(PACKET_ID_OFFSET + packet_id))
.identifier(rec.getString("name")) .identifier(rec.getString("name"))
@ -931,7 +931,7 @@ public class ImportHostingAssets extends ImportOfficeData {
final var unixuser_id = rec.getInteger("emailalias_id"); final var unixuser_id = rec.getInteger("emailalias_id");
final var packet_id = rec.getInteger("pac_id"); final var packet_id = rec.getInteger("pac_id");
final var targets = parseCsvLine(rec.getString("target")); final var targets = parseCsvLine(rec.getString("target"));
final var unixUserAsset = HsHostingAssetRawEntity.builder() final var unixUserAsset = HsHostingAssetBareEntity.builder()
.type(EMAIL_ALIAS) .type(EMAIL_ALIAS)
.parentAsset(hostingAssets.get(PACKET_ID_OFFSET + packet_id)) .parentAsset(hostingAssets.get(PACKET_ID_OFFSET + packet_id))
.identifier(rec.getString("name")) .identifier(rec.getString("name"))
@ -944,14 +944,14 @@ public class ImportHostingAssets extends ImportOfficeData {
}); });
} }
private void createDatabaseInstances(final List<HsHostingAssetRawEntity> parentAssets) { private void createDatabaseInstances(final List<HsHostingAssetBareEntity> parentAssets) {
final var idRef = new AtomicInteger(0); final var idRef = new AtomicInteger(0);
parentAssets.forEach(pa -> { parentAssets.forEach(pa -> {
if (pa.getSubHostingAssets() == null) { if (pa.getSubHostingAssets() == null) {
pa.setSubHostingAssets(new ArrayList<>()); pa.setSubHostingAssets(new ArrayList<>());
} }
final var pgSqlInstanceAsset = HsHostingAssetRawEntity.builder() final var pgSqlInstanceAsset = HsHostingAssetBareEntity.builder()
.type(PGSQL_INSTANCE) .type(PGSQL_INSTANCE)
.parentAsset(pa) .parentAsset(pa)
.identifier(pa.getIdentifier() + "|PgSql.default") .identifier(pa.getIdentifier() + "|PgSql.default")
@ -960,7 +960,7 @@ public class ImportHostingAssets extends ImportOfficeData {
pa.getSubHostingAssets().add(pgSqlInstanceAsset); pa.getSubHostingAssets().add(pgSqlInstanceAsset);
hostingAssets.put(DBINSTANCE_ID_OFFSET + idRef.getAndIncrement(), pgSqlInstanceAsset); hostingAssets.put(DBINSTANCE_ID_OFFSET + idRef.getAndIncrement(), pgSqlInstanceAsset);
final var mariaDbInstanceAsset = HsHostingAssetRawEntity.builder() final var mariaDbInstanceAsset = HsHostingAssetBareEntity.builder()
.type(MARIADB_INSTANCE) .type(MARIADB_INSTANCE)
.parentAsset(pa) .parentAsset(pa)
.identifier(pa.getIdentifier() + "|MariaDB.default") .identifier(pa.getIdentifier() + "|MariaDB.default")
@ -996,7 +996,7 @@ public class ImportHostingAssets extends ImportOfficeData {
.filter(ha -> ha.getType() == dbInstanceAssetType) .filter(ha -> ha.getType() == dbInstanceAssetType)
.findAny().orElseThrow(); // there is exactly one: the default instance for the given type .findAny().orElseThrow(); // there is exactly one: the default instance for the given type
final var dbUserAsset = HsHostingAssetRawEntity.builder() final var dbUserAsset = HsHostingAssetBareEntity.builder()
.type(dbUserAssetType) .type(dbUserAssetType)
.parentAsset(hostingAssets.get(PACKET_ID_OFFSET + packet_id)) .parentAsset(hostingAssets.get(PACKET_ID_OFFSET + packet_id))
.assignedToAsset(dbInstanceAsset) .assignedToAsset(dbInstanceAsset)
@ -1027,7 +1027,7 @@ public class ImportHostingAssets extends ImportOfficeData {
: failWith("unknown DB engine " + engine); : failWith("unknown DB engine " + engine);
final var name = rec.getString("name"); final var name = rec.getString("name");
final var encoding = rec.getString("encoding").replaceAll("[-_]+", ""); final var encoding = rec.getString("encoding").replaceAll("[-_]+", "");
final var dbAsset = HsHostingAssetRawEntity.builder() final var dbAsset = HsHostingAssetBareEntity.builder()
.type(type) .type(type)
.parentAsset(owningDbUserHA) .parentAsset(owningDbUserHA)
.identifier(type.name().substring(0, 2) + "D|" + name) .identifier(type.name().substring(0, 2) + "D|" + name)
@ -1069,7 +1069,7 @@ public class ImportHostingAssets extends ImportOfficeData {
}; };
} }
private static HsHostingAssetRawEntity ipNumber(final Integer inet_addr_id) { private static HsHostingAssetBareEntity ipNumber(final Integer inet_addr_id) {
return inet_addr_id != null ? hostingAssets.get(IP_NUMBER_ID_OFFSET + inet_addr_id) : null; return inet_addr_id != null ? hostingAssets.get(IP_NUMBER_ID_OFFSET + inet_addr_id) : null;
} }
@ -1077,7 +1077,7 @@ public class ImportHostingAssets extends ImportOfficeData {
return hive_id != null ? hives.get(HIVE_ID_OFFSET + hive_id) : null; return hive_id != null ? hives.get(HIVE_ID_OFFSET + hive_id) : null;
} }
private static HsHostingAssetRawEntity pac(final Integer packet_id) { private static HsHostingAssetBareEntity pac(final Integer packet_id) {
return packet_id != null ? hostingAssets.get(PACKET_ID_OFFSET + packet_id) : null; return packet_id != null ? hostingAssets.get(PACKET_ID_OFFSET + packet_id) : null;
} }

View File

@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.migration;
import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.context.Context;
import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionEntity; import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionEntity;
import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionType; import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionType;
import net.hostsharing.hsadminng.hs.office.coopshares.HsOfficeCoopSharesTransactionEntity; import net.hostsharing.hsadminng.hs.office.coopshares.HsOfficeCoopSharesTransactionEntity;
@ -15,7 +15,7 @@ import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRawEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType;
import net.hostsharing.hsadminng.hs.office.sepamandate.HsOfficeSepaMandateEntity; import net.hostsharing.hsadminng.hs.office.sepamandate.HsOfficeSepaMandateEntity;
import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject; import net.hostsharing.hsadminng.rbac.rbacobject.RbacObject;
@ -121,7 +121,7 @@ public class ImportOfficeData extends CsvDataImport {
-1 -1
); );
static Map<Integer, HsOfficeContactEntity> contacts = new WriteOnceMap<>(); static Map<Integer, HsOfficeContactRbacEntity> contacts = new WriteOnceMap<>();
static Map<Integer, HsOfficePersonEntity> persons = new WriteOnceMap<>(); static Map<Integer, HsOfficePersonEntity> persons = new WriteOnceMap<>();
static Map<Integer, HsOfficePartnerEntity> partners = new WriteOnceMap<>(); static Map<Integer, HsOfficePartnerEntity> partners = new WriteOnceMap<>();
static Map<Integer, HsOfficeDebitorEntity> debitors = new WriteOnceMap<>(); static Map<Integer, HsOfficeDebitorEntity> debitors = new WriteOnceMap<>();
@ -979,7 +979,7 @@ public class ImportOfficeData extends CsvDataImport {
contactPerson = addPerson(HsOfficePersonEntity.builder().build(), rec); contactPerson = addPerson(HsOfficePersonEntity.builder().build(), rec);
} }
final var contact = HsOfficeContactEntity.builder().build(); final var contact = HsOfficeContactRbacEntity.builder().build();
initContact(contact, rec); initContact(contact, rec);
if (containsPartnerRel(rec)) { if (containsPartnerRel(rec)) {
@ -1057,8 +1057,8 @@ public class ImportOfficeData extends CsvDataImport {
final HsOfficeRelationType type, final HsOfficeRelationType type,
final HsOfficePersonEntity anchor, final HsOfficePersonEntity anchor,
final HsOfficePersonEntity holder, final HsOfficePersonEntity holder,
final HsOfficeContactEntity contact) { final HsOfficeContactRbacEntity contact) {
final var rel = HsOfficeRelationRawEntity.builder() final var rel = HsOfficeRelationBareEntity.builder()
.anchor(anchor) .anchor(anchor)
.holder(holder) .holder(holder)
.contact(contact) .contact(contact)
@ -1118,7 +1118,7 @@ public class ImportOfficeData extends CsvDataImport {
assertThat(unexpectedRolesSet).isEmpty(); assertThat(unexpectedRolesSet).isEmpty();
} }
private HsOfficeContactEntity initContact(final HsOfficeContactEntity contact, final Record contactRecord) { private HsOfficeContactRbacEntity initContact(final HsOfficeContactRbacEntity contact, final Record contactRecord) {
contact.setCaption(toCaption( contact.setCaption(toCaption(
contactRecord.getString("salut"), contactRecord.getString("salut"),

View File

@ -355,10 +355,10 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
} }
} }
private HsOfficeContactEntity givenSomeTemporaryContactCreatedBy(final String creatingUser) { private HsOfficeContactRbacEntity givenSomeTemporaryContactCreatedBy(final String creatingUser) {
return jpaAttempt.transacted(() -> { return jpaAttempt.transacted(() -> {
context.define(creatingUser); context.define(creatingUser);
final var newContact = HsOfficeContactEntity.builder() final var newContact = HsOfficeContactRbacEntity.builder()
.uuid(UUID.randomUUID()) .uuid(UUID.randomUUID())
.caption("Temp from " + Context.getCallerMethodNameFromStackFrame(1) ) .caption("Temp from " + Context.getCallerMethodNameFromStackFrame(1) )
.emailAddresses(Map.of("main", RandomStringUtils.randomAlphabetic(10) + "@example.org")) .emailAddresses(Map.of("main", RandomStringUtils.randomAlphabetic(10) + "@example.org"))
@ -375,7 +375,7 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
void cleanup() { void cleanup() {
jpaAttempt.transacted(() -> { jpaAttempt.transacted(() -> {
context.define("superuser-alex@hostsharing.net", null); context.define("superuser-alex@hostsharing.net", null);
em.createQuery("DELETE FROM HsOfficeContactEntity c WHERE c.caption LIKE 'Temp %'").executeUpdate(); em.createQuery("DELETE FROM HsOfficeContactRbacEntity c WHERE c.caption LIKE 'Temp %'").executeUpdate();
}).assertSuccessful(); }).assertSuccessful();
} }
} }

View File

@ -15,7 +15,7 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
@TestInstance(PER_CLASS) @TestInstance(PER_CLASS)
class HsOfficeContactEntityPatcherUnitTest extends PatchUnitTestBase< class HsOfficeContactEntityPatcherUnitTest extends PatchUnitTestBase<
HsOfficeContactPatchResource, HsOfficeContactPatchResource,
HsOfficeContactEntity HsOfficeContactRbacEntity
> { > {
private static final UUID INITIAL_CONTACT_UUID = UUID.randomUUID(); private static final UUID INITIAL_CONTACT_UUID = UUID.randomUUID();
@ -42,8 +42,8 @@ class HsOfficeContactEntityPatcherUnitTest extends PatchUnitTestBase<
); );
@Override @Override
protected HsOfficeContactEntity newInitialEntity() { protected HsOfficeContactRbacEntity newInitialEntity() {
final var entity = new HsOfficeContactEntity(); final var entity = new HsOfficeContactRbacEntity();
entity.setUuid(INITIAL_CONTACT_UUID); entity.setUuid(INITIAL_CONTACT_UUID);
entity.setCaption("initial caption"); entity.setCaption("initial caption");
entity.putEmailAddresses(Map.ofEntries( entity.putEmailAddresses(Map.ofEntries(
@ -64,7 +64,7 @@ class HsOfficeContactEntityPatcherUnitTest extends PatchUnitTestBase<
} }
@Override @Override
protected HsOfficeContactEntityPatcher createPatcher(final HsOfficeContactEntity entity) { protected HsOfficeContactEntityPatcher createPatcher(final HsOfficeContactRbacEntity entity) {
return new HsOfficeContactEntityPatcher(entity); return new HsOfficeContactEntityPatcher(entity);
} }
@ -75,26 +75,26 @@ class HsOfficeContactEntityPatcherUnitTest extends PatchUnitTestBase<
"caption", "caption",
HsOfficeContactPatchResource::setCaption, HsOfficeContactPatchResource::setCaption,
"patched caption", "patched caption",
HsOfficeContactEntity::setCaption), HsOfficeContactRbacEntity::setCaption),
new SimpleProperty<>( new SimpleProperty<>(
"resources", "resources",
HsOfficeContactPatchResource::setEmailAddresses, HsOfficeContactPatchResource::setEmailAddresses,
PATCH_EMAIL_ADDRESSES, PATCH_EMAIL_ADDRESSES,
HsOfficeContactEntity::putEmailAddresses, HsOfficeContactRbacEntity::putEmailAddresses,
PATCHED_EMAIL_ADDRESSES) PATCHED_EMAIL_ADDRESSES)
.notNullable(), .notNullable(),
new SimpleProperty<>( new SimpleProperty<>(
"resources", "resources",
HsOfficeContactPatchResource::setPhoneNumbers, HsOfficeContactPatchResource::setPhoneNumbers,
PATCH_PHONE_NUMBERS, PATCH_PHONE_NUMBERS,
HsOfficeContactEntity::putPhoneNumbers, HsOfficeContactRbacEntity::putPhoneNumbers,
PATCHED_PHONE_NUMBERS) PATCHED_PHONE_NUMBERS)
.notNullable(), .notNullable(),
new JsonNullableProperty<>( new JsonNullableProperty<>(
"patched given name", "patched given name",
HsOfficeContactPatchResource::setPostalAddress, HsOfficeContactPatchResource::setPostalAddress,
"patched given name", "patched given name",
HsOfficeContactEntity::setPostalAddress) HsOfficeContactRbacEntity::setPostalAddress)
); );
} }
} }

View File

@ -8,13 +8,13 @@ class HsOfficeContactEntityUnitTest {
@Test @Test
void toStringReturnsNullForNullContact() { void toStringReturnsNullForNullContact() {
final HsOfficeContactEntity givenContact = null; final HsOfficeContactRbacEntity givenContact = null;
assertThat("" + givenContact).isEqualTo("null"); assertThat("" + givenContact).isEqualTo("null");
} }
@Test @Test
void toStringReturnsCaption() { void toStringReturnsCaption() {
final var givenContact = HsOfficeContactEntity.builder().caption("given caption").build(); final var givenContact = HsOfficeContactRbacEntity.builder().caption("given caption").build();
assertThat("" + givenContact).isEqualTo("contact(caption='given caption')"); assertThat("" + givenContact).isEqualTo("contact(caption='given caption')");
} }

View File

@ -65,7 +65,7 @@ class HsOfficeContactRepositoryIntegrationTest extends ContextBasedTestWithClean
// then // then
result.assertSuccessful(); result.assertSuccessful();
assertThat(result.returnedValue()).isNotNull().extracting(HsOfficeContactEntity::getUuid).isNotNull(); assertThat(result.returnedValue()).isNotNull().extracting(HsOfficeContactRbacEntity::getUuid).isNotNull();
assertThatContactIsPersisted(result.returnedValue()); assertThatContactIsPersisted(result.returnedValue());
assertThat(contactRepo.count()).isEqualTo(count + 1); assertThat(contactRepo.count()).isEqualTo(count + 1);
} }
@ -82,7 +82,7 @@ class HsOfficeContactRepositoryIntegrationTest extends ContextBasedTestWithClean
// then // then
result.assertSuccessful(); result.assertSuccessful();
assertThat(result.returnedValue()).isNotNull().extracting(HsOfficeContactEntity::getUuid).isNotNull(); assertThat(result.returnedValue()).isNotNull().extracting(HsOfficeContactRbacEntity::getUuid).isNotNull();
assertThatContactIsPersisted(result.returnedValue()); assertThatContactIsPersisted(result.returnedValue());
assertThat(contactRepo.count()).isEqualTo(count + 1); assertThat(contactRepo.count()).isEqualTo(count + 1);
} }
@ -120,7 +120,7 @@ class HsOfficeContactRepositoryIntegrationTest extends ContextBasedTestWithClean
)); ));
} }
private void assertThatContactIsPersisted(final HsOfficeContactEntity saved) { private void assertThatContactIsPersisted(final HsOfficeContactRbacEntity saved) {
final var found = contactRepo.findByUuid(saved.getUuid()); final var found = contactRepo.findByUuid(saved.getUuid());
assertThat(found).isNotEmpty().get().extracting(Object::toString).isEqualTo(saved.toString()); assertThat(found).isNotEmpty().get().extracting(Object::toString).isEqualTo(saved.toString());
} }
@ -270,16 +270,16 @@ class HsOfficeContactRepositoryIntegrationTest extends ContextBasedTestWithClean
"[creating contact test-data second contact, hs_office_contact, INSERT]"); "[creating contact test-data second contact, hs_office_contact, INSERT]");
} }
private HsOfficeContactEntity givenSomeTemporaryContact( private HsOfficeContactRbacEntity givenSomeTemporaryContact(
final String createdByUser, final String createdByUser,
Supplier<HsOfficeContactEntity> entitySupplier) { Supplier<HsOfficeContactRbacEntity> entitySupplier) {
return jpaAttempt.transacted(() -> { return jpaAttempt.transacted(() -> {
context(createdByUser); context(createdByUser);
return toCleanup(contactRepo.save(entitySupplier.get())); return toCleanup(contactRepo.save(entitySupplier.get()));
}).assumeSuccessful().returnedValue(); }).assumeSuccessful().returnedValue();
} }
private HsOfficeContactEntity givenSomeTemporaryContact(final String createdByUser) { private HsOfficeContactRbacEntity givenSomeTemporaryContact(final String createdByUser) {
final var random = RandomStringUtils.randomAlphabetic(12); final var random = RandomStringUtils.randomAlphabetic(12);
return givenSomeTemporaryContact(createdByUser, () -> return givenSomeTemporaryContact(createdByUser, () ->
hsOfficeContact( hsOfficeContact(
@ -287,15 +287,15 @@ class HsOfficeContactRepositoryIntegrationTest extends ContextBasedTestWithClean
"some-temporary-contact" + random + "@example.com")); "some-temporary-contact" + random + "@example.com"));
} }
void exactlyTheseContactsAreReturned(final List<HsOfficeContactEntity> actualResult, final String... contactCaptions) { void exactlyTheseContactsAreReturned(final List<HsOfficeContactRbacEntity> actualResult, final String... contactCaptions) {
assertThat(actualResult) assertThat(actualResult)
.extracting(HsOfficeContactEntity::getCaption) .extracting(HsOfficeContactRbacEntity::getCaption)
.containsExactlyInAnyOrder(contactCaptions); .containsExactlyInAnyOrder(contactCaptions);
} }
void allTheseContactsAreReturned(final List<HsOfficeContactEntity> actualResult, final String... contactCaptions) { void allTheseContactsAreReturned(final List<HsOfficeContactRbacEntity> actualResult, final String... contactCaptions) {
assertThat(actualResult) assertThat(actualResult)
.extracting(HsOfficeContactEntity::getCaption) .extracting(HsOfficeContactRbacEntity::getCaption)
.contains(contactCaptions); .contains(contactCaptions);
} }
} }

View File

@ -4,10 +4,10 @@ import java.util.Map;
public class TestHsOfficeContact { public class TestHsOfficeContact {
public static final HsOfficeContactEntity TEST_CONTACT = hsOfficeContact("some contact", "some-contact@example.com"); public static final HsOfficeContactRbacEntity TEST_CONTACT = hsOfficeContact("some contact", "some-contact@example.com");
static public HsOfficeContactEntity hsOfficeContact(final String caption, final String emailAddr) { static public HsOfficeContactRbacEntity hsOfficeContact(final String caption, final String emailAddr) {
return HsOfficeContactEntity.builder() return HsOfficeContactRbacEntity.builder()
.caption(caption) .caption(caption)
.postalAddress("address of " + caption) .postalAddress("address of " + caption)
.emailAddresses(Map.of("main", emailAddr)) .emailAddresses(Map.of("main", emailAddr))

View File

@ -1,6 +1,6 @@
package net.hostsharing.hsadminng.hs.office.debitor; package net.hostsharing.hsadminng.hs.office.debitor;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
@ -21,7 +21,7 @@ class HsOfficeDebitorEntityUnitTest {
.personType(HsOfficePersonType.LEGAL_PERSON) .personType(HsOfficePersonType.LEGAL_PERSON)
.tradeName("some billing trade name") .tradeName("some billing trade name")
.build()) .build())
.contact(HsOfficeContactEntity.builder().caption("some caption").build()) .contact(HsOfficeContactRbacEntity.builder().caption("some caption").build())
.build(); .build();
@Test @Test

View File

@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.partner;
import io.restassured.RestAssured; import io.restassured.RestAssured;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.HsadminNgApplication;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRepository; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRepository;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
@ -180,7 +180,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
.post("http://localhost/api/hs/office/partners") .post("http://localhost/api/hs/office/partners")
.then().log().all().assertThat() .then().log().all().assertThat()
.statusCode(400) .statusCode(400)
.body("message", is("Unable to find " + HsOfficeContactEntity.class.getName() + " with id " + GIVEN_NON_EXISTING_UUID)); .body("message", is("Unable to find " + HsOfficeContactRbacEntity.class.getName() + " with id " + GIVEN_NON_EXISTING_UUID));
// @formatter:on // @formatter:on
} }

View File

@ -1,7 +1,7 @@
package net.hostsharing.hsadminng.hs.office.partner; package net.hostsharing.hsadminng.hs.office.partner;
import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.context.Context;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRepository;
@ -69,7 +69,7 @@ class HsOfficePartnerControllerRestTest {
HsOfficePersonEntity personMock; HsOfficePersonEntity personMock;
@Mock @Mock
HsOfficeContactEntity contactMock; HsOfficeContactRbacEntity contactMock;
@Mock @Mock
HsOfficePartnerEntity partnerMock; HsOfficePartnerEntity partnerMock;
@ -83,7 +83,7 @@ class HsOfficePartnerControllerRestTest {
lenient().when(em.getReference(HsOfficePersonEntity.class, GIVEN_MANDANTE_UUID)).thenReturn(mandateMock); lenient().when(em.getReference(HsOfficePersonEntity.class, GIVEN_MANDANTE_UUID)).thenReturn(mandateMock);
lenient().when(em.getReference(HsOfficePersonEntity.class, GIVEN_PERSON_UUID)).thenReturn(personMock); lenient().when(em.getReference(HsOfficePersonEntity.class, GIVEN_PERSON_UUID)).thenReturn(personMock);
lenient().when(em.getReference(HsOfficeContactEntity.class, GIVEN_CONTACT_UUID)).thenReturn(contactMock); lenient().when(em.getReference(HsOfficeContactRbacEntity.class, GIVEN_CONTACT_UUID)).thenReturn(contactMock);
lenient().when(em.getReference(any(), eq(GIVEN_INVALID_UUID))).thenThrow(EntityNotFoundException.class); lenient().when(em.getReference(any(), eq(GIVEN_INVALID_UUID))).thenThrow(EntityNotFoundException.class);
} }

View File

@ -1,6 +1,6 @@
package net.hostsharing.hsadminng.hs.office.partner; package net.hostsharing.hsadminng.hs.office.partner;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerDetailsPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerDetailsPatchResource;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase;
@ -43,8 +43,8 @@ class HsOfficePartnerDetailsEntityPatcherUnitTest extends PatchUnitTestBase<
@BeforeEach @BeforeEach
void initMocks() { void initMocks() {
lenient().when(em.getReference(eq(HsOfficeContactEntity.class), any())).thenAnswer(invocation -> lenient().when(em.getReference(eq(HsOfficeContactRbacEntity.class), any())).thenAnswer(invocation ->
HsOfficeContactEntity.builder().uuid(invocation.getArgument(1)).build()); HsOfficeContactRbacEntity.builder().uuid(invocation.getArgument(1)).build());
lenient().when(em.getReference(eq(HsOfficePersonEntity.class), any())).thenAnswer(invocation -> lenient().when(em.getReference(eq(HsOfficePersonEntity.class), any())).thenAnswer(invocation ->
HsOfficePersonEntity.builder().uuid(invocation.getArgument(1)).build()); HsOfficePersonEntity.builder().uuid(invocation.getArgument(1)).build());
} }

View File

@ -1,6 +1,6 @@
package net.hostsharing.hsadminng.hs.office.partner; package net.hostsharing.hsadminng.hs.office.partner;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerPatchResource;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationEntity;
@ -37,7 +37,7 @@ class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase<
private final HsOfficePersonEntity givenInitialPerson = HsOfficePersonEntity.builder() private final HsOfficePersonEntity givenInitialPerson = HsOfficePersonEntity.builder()
.uuid(INITIAL_PERSON_UUID) .uuid(INITIAL_PERSON_UUID)
.build(); .build();
private final HsOfficeContactEntity givenInitialContact = HsOfficeContactEntity.builder() private final HsOfficeContactRbacEntity givenInitialContact = HsOfficeContactRbacEntity.builder()
.uuid(INITIAL_CONTACT_UUID) .uuid(INITIAL_CONTACT_UUID)
.build(); .build();

View File

@ -1,6 +1,6 @@
package net.hostsharing.hsadminng.hs.office.partner; package net.hostsharing.hsadminng.hs.office.partner;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity;
@ -23,7 +23,7 @@ class HsOfficePartnerEntityUnitTest {
.personType(HsOfficePersonType.LEGAL_PERSON) .personType(HsOfficePersonType.LEGAL_PERSON)
.tradeName("some trade name") .tradeName("some trade name")
.build()) .build())
.contact(HsOfficeContactEntity.builder().caption("some caption").build()) .contact(HsOfficeContactRbacEntity.builder().caption("some caption").build())
.build()) .build())
.build(); .build();

View File

@ -1,6 +1,6 @@
package net.hostsharing.hsadminng.hs.office.partner; package net.hostsharing.hsadminng.hs.office.partner;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity;
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType;
@ -25,7 +25,7 @@ public class TestHsOfficePartner {
.personType(LEGAL_PERSON) .personType(LEGAL_PERSON)
.tradeName(tradeName) .tradeName(tradeName)
.build()) .build())
.contact(HsOfficeContactEntity.builder() .contact(HsOfficeContactRbacEntity.builder()
.caption(tradeName) .caption(tradeName)
.build()) .build())
.build() .build()

View File

@ -1,6 +1,6 @@
package net.hostsharing.hsadminng.hs.office.relation; package net.hostsharing.hsadminng.hs.office.relation;
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationPatchResource;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase;
@ -34,8 +34,8 @@ class HsOfficeRelationEntityPatcherUnitTest extends PatchUnitTestBase<
@BeforeEach @BeforeEach
void initMocks() { void initMocks() {
lenient().when(em.getReference(eq(HsOfficeContactEntity.class), any())).thenAnswer(invocation -> lenient().when(em.getReference(eq(HsOfficeContactRbacEntity.class), any())).thenAnswer(invocation ->
HsOfficeContactEntity.builder().uuid(invocation.getArgument(1)).build()); HsOfficeContactRbacEntity.builder().uuid(invocation.getArgument(1)).build());
} }
final HsOfficePersonEntity givenInitialAnchorPerson = HsOfficePersonEntity.builder() final HsOfficePersonEntity givenInitialAnchorPerson = HsOfficePersonEntity.builder()
@ -44,7 +44,7 @@ class HsOfficeRelationEntityPatcherUnitTest extends PatchUnitTestBase<
final HsOfficePersonEntity givenInitialHolderPerson = HsOfficePersonEntity.builder() final HsOfficePersonEntity givenInitialHolderPerson = HsOfficePersonEntity.builder()
.uuid(UUID.randomUUID()) .uuid(UUID.randomUUID())
.build(); .build();
final HsOfficeContactEntity givenInitialContact = HsOfficeContactEntity.builder() final HsOfficeContactRbacEntity givenInitialContact = HsOfficeContactRbacEntity.builder()
.uuid(UUID.randomUUID()) .uuid(UUID.randomUUID())
.build(); .build();
@ -82,8 +82,8 @@ class HsOfficeRelationEntityPatcherUnitTest extends PatchUnitTestBase<
); );
} }
static HsOfficeContactEntity newContact(final UUID uuid) { static HsOfficeContactRbacEntity newContact(final UUID uuid) {
final var newContact = new HsOfficeContactEntity(); final var newContact = new HsOfficeContactRbacEntity();
newContact.setUuid(uuid); newContact.setUuid(uuid);
return newContact; return newContact;
} }