add micrometer @Timing annotations to Controllers+Repositories + ArchTest #128
@ -1,5 +1,6 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.contact;
|
package net.hostsharing.hsadminng.hs.office.contact;
|
||||||
|
|
||||||
|
import io.micrometer.core.annotation.Timed;
|
||||||
import net.hostsharing.hsadminng.mapper.StandardMapper;
|
import net.hostsharing.hsadminng.mapper.StandardMapper;
|
||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeContactsApi;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeContactsApi;
|
||||||
@ -33,7 +34,8 @@ public class HsOfficeContactController implements HsOfficeContactsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public ResponseEntity<List<HsOfficeContactResource>> listContacts(
|
@Timed("app.contacts.api.getListOfContacts")
|
||||||
|
public ResponseEntity<List<HsOfficeContactResource>> getListOfContacts(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
final String caption) {
|
final String caption) {
|
||||||
@ -47,7 +49,8 @@ public class HsOfficeContactController implements HsOfficeContactsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResponseEntity<HsOfficeContactResource> addContact(
|
@Timed("app.contacts.api.postNewContact")
|
||||||
|
public ResponseEntity<HsOfficeContactResource> postNewContact(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
final HsOfficeContactInsertResource body) {
|
final HsOfficeContactInsertResource body) {
|
||||||
@ -69,7 +72,8 @@ public class HsOfficeContactController implements HsOfficeContactsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public ResponseEntity<HsOfficeContactResource> getContactByUuid(
|
@Timed("app.contacts.api.getSingleContactByUuid")
|
||||||
|
public ResponseEntity<HsOfficeContactResource> getSingleContactByUuid(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
final UUID contactUuid) {
|
final UUID contactUuid) {
|
||||||
@ -85,6 +89,7 @@ public class HsOfficeContactController implements HsOfficeContactsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@Timed("app.contacts.api.deleteContactByUuid")
|
||||||
public ResponseEntity<Void> deleteContactByUuid(
|
public ResponseEntity<Void> deleteContactByUuid(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
@ -101,6 +106,7 @@ public class HsOfficeContactController implements HsOfficeContactsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@Timed("app.contacts.api.patchContact")
|
||||||
public ResponseEntity<HsOfficeContactResource> patchContact(
|
public ResponseEntity<HsOfficeContactResource> patchContact(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.contact;
|
package net.hostsharing.hsadminng.hs.office.contact;
|
||||||
|
|
||||||
|
import io.micrometer.core.annotation.Timed;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.Repository;
|
import org.springframework.data.repository.Repository;
|
||||||
|
|
||||||
@ -9,18 +10,23 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public interface HsOfficeContactRbacRepository extends Repository<HsOfficeContactRbacEntity, UUID> {
|
public interface HsOfficeContactRbacRepository extends Repository<HsOfficeContactRbacEntity, UUID> {
|
||||||
|
|
||||||
|
@Timed("app.contacts.repo.findByUuid.rbac")
|
||||||
Optional<HsOfficeContactRbacEntity> findByUuid(UUID id);
|
Optional<HsOfficeContactRbacEntity> findByUuid(UUID id);
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT c FROM HsOfficeContactRbacEntity 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), '%')
|
||||||
""")
|
""")
|
||||||
|
@Timed("app.contacts.repo.findContactByOptionalCaptionLike.rbac")
|
||||||
List<HsOfficeContactRbacEntity> findContactByOptionalCaptionLike(String caption);
|
List<HsOfficeContactRbacEntity> findContactByOptionalCaptionLike(String caption);
|
||||||
|
|
||||||
|
@Timed("app.contacts.repo.save.rbac")
|
||||||
HsOfficeContactRbacEntity save(final HsOfficeContactRbacEntity entity);
|
HsOfficeContactRbacEntity save(final HsOfficeContactRbacEntity entity);
|
||||||
|
|
||||||
|
@Timed("app.contacts.repo.deleteByUuid.rbac")
|
||||||
int deleteByUuid(final UUID uuid);
|
int deleteByUuid(final UUID uuid);
|
||||||
|
|
||||||
|
@Timed("app.contacts.repo.count.rbac")
|
||||||
long count();
|
long count();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.contact;
|
package net.hostsharing.hsadminng.hs.office.contact;
|
||||||
|
|
||||||
|
import io.micrometer.core.annotation.Timed;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.Repository;
|
import org.springframework.data.repository.Repository;
|
||||||
|
|
||||||
@ -9,18 +10,23 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public interface HsOfficeContactRealRepository extends Repository<HsOfficeContactRealEntity, UUID> {
|
public interface HsOfficeContactRealRepository extends Repository<HsOfficeContactRealEntity, UUID> {
|
||||||
|
|
||||||
|
@Timed("app.repo.contacts.findByUuid.real")
|
||||||
Optional<HsOfficeContactRealEntity> findByUuid(UUID id);
|
Optional<HsOfficeContactRealEntity> findByUuid(UUID id);
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT c FROM HsOfficeContactRealEntity c
|
SELECT c FROM HsOfficeContactRealEntity 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), '%')
|
||||||
""")
|
""")
|
||||||
|
@Timed("app.repo.contacts.findContactByOptionalCaptionLike.real")
|
||||||
List<HsOfficeContactRealEntity> findContactByOptionalCaptionLike(String caption);
|
List<HsOfficeContactRealEntity> findContactByOptionalCaptionLike(String caption);
|
||||||
|
|
||||||
|
@Timed("app.repo.contacts.save.real")
|
||||||
HsOfficeContactRealEntity save(final HsOfficeContactRealEntity entity);
|
HsOfficeContactRealEntity save(final HsOfficeContactRealEntity entity);
|
||||||
|
|
||||||
|
@Timed("app.repo.contacts.deleteByUuid.real")
|
||||||
int deleteByUuid(final UUID uuid);
|
int deleteByUuid(final UUID uuid);
|
||||||
|
|
||||||
|
@Timed("app.repo.contacts.count.real")
|
||||||
long count();
|
long count();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.person;
|
package net.hostsharing.hsadminng.hs.office.person;
|
||||||
|
|
||||||
|
import io.micrometer.core.annotation.Timed;
|
||||||
import net.hostsharing.hsadminng.mapper.StandardMapper;
|
import net.hostsharing.hsadminng.mapper.StandardMapper;
|
||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficePersonsApi;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficePersonsApi;
|
||||||
@ -30,7 +31,8 @@ public class HsOfficePersonController implements HsOfficePersonsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public ResponseEntity<List<HsOfficePersonResource>> listPersons(
|
@Timed("app.persons.api.getListOfPersons")
|
||||||
|
public ResponseEntity<List<HsOfficePersonResource>> getListOfPersons(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
final String caption) {
|
final String caption) {
|
||||||
@ -44,7 +46,8 @@ public class HsOfficePersonController implements HsOfficePersonsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResponseEntity<HsOfficePersonResource> addPerson(
|
@Timed("app.persons.api.postNewPerson")
|
||||||
|
public ResponseEntity<HsOfficePersonResource> postNewPerson(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
final HsOfficePersonInsertResource body) {
|
final HsOfficePersonInsertResource body) {
|
||||||
@ -66,7 +69,8 @@ public class HsOfficePersonController implements HsOfficePersonsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public ResponseEntity<HsOfficePersonResource> getPersonByUuid(
|
@Timed("app.persons.api.getSinglePersonByUuid")
|
||||||
|
public ResponseEntity<HsOfficePersonResource> getSinglePersonByUuid(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
final UUID personUuid) {
|
final UUID personUuid) {
|
||||||
@ -82,6 +86,7 @@ public class HsOfficePersonController implements HsOfficePersonsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@Timed("app.persons.api.deletePersonByUuid")
|
||||||
public ResponseEntity<Void> deletePersonByUuid(
|
public ResponseEntity<Void> deletePersonByUuid(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
@ -98,6 +103,7 @@ public class HsOfficePersonController implements HsOfficePersonsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@Timed("app.persons.api.patchPerson")
|
||||||
public ResponseEntity<HsOfficePersonResource> patchPerson(
|
public ResponseEntity<HsOfficePersonResource> patchPerson(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.person;
|
package net.hostsharing.hsadminng.hs.office.person;
|
||||||
|
|
||||||
|
import io.micrometer.core.annotation.Timed;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.Repository;
|
import org.springframework.data.repository.Repository;
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public interface HsOfficePersonRepository extends Repository<HsOfficePersonEntity, UUID> {
|
public interface HsOfficePersonRepository extends Repository<HsOfficePersonEntity, UUID> {
|
||||||
|
|
||||||
|
@Timed("app.persons.repo.findByUuid.rbac")
|
||||||
Optional<HsOfficePersonEntity> findByUuid(UUID personUuid);
|
Optional<HsOfficePersonEntity> findByUuid(UUID personUuid);
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
@ -17,12 +19,16 @@ public interface HsOfficePersonRepository extends Repository<HsOfficePersonEntit
|
|||||||
OR p.tradeName like concat(cast(:name as text), '%')
|
OR p.tradeName like concat(cast(:name as text), '%')
|
||||||
OR p.givenName like concat(cast(:name as text), '%')
|
OR p.givenName like concat(cast(:name as text), '%')
|
||||||
OR p.familyName like concat(cast(:name as text), '%')
|
OR p.familyName like concat(cast(:name as text), '%')
|
||||||
""")
|
""")
|
||||||
|
@Timed("app.persons.repo.findPersonByOptionalNameLike.rbac")
|
||||||
List<HsOfficePersonEntity> findPersonByOptionalNameLike(String name);
|
List<HsOfficePersonEntity> findPersonByOptionalNameLike(String name);
|
||||||
|
|
||||||
|
@Timed("app.persons.repo.save.rbac")
|
||||||
HsOfficePersonEntity save(final HsOfficePersonEntity entity);
|
HsOfficePersonEntity save(final HsOfficePersonEntity entity);
|
||||||
|
|
||||||
|
@Timed("app.persons.repo.deleteByUuid.rbac")
|
||||||
int deleteByUuid(final UUID personUuid);
|
int deleteByUuid(final UUID personUuid);
|
||||||
|
|
||||||
|
@Timed("app.persons.repo.count.rbac")
|
||||||
long count();
|
long count();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.relation;
|
package net.hostsharing.hsadminng.hs.office.relation;
|
||||||
|
|
||||||
|
import io.micrometer.core.annotation.Timed;
|
||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeRelationsApi;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeRelationsApi;
|
||||||
@ -21,7 +22,6 @@ import java.util.function.BiConsumer;
|
|||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
|
||||||
public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -44,7 +44,8 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public ResponseEntity<List<HsOfficeRelationResource>> listRelations(
|
@Timed("app.relations.api.getListOfRelations")
|
||||||
|
public ResponseEntity<List<HsOfficeRelationResource>> getListOfRelations(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
final UUID personUuid,
|
final UUID personUuid,
|
||||||
@ -66,7 +67,8 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResponseEntity<HsOfficeRelationResource> addRelation(
|
@Timed("app.relations.api.postNewRelation")
|
||||||
|
public ResponseEntity<HsOfficeRelationResource> postNewRelation(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
final HsOfficeRelationInsertResource body) {
|
final HsOfficeRelationInsertResource body) {
|
||||||
@ -100,7 +102,8 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public ResponseEntity<HsOfficeRelationResource> getRelationByUuid(
|
@Timed("app.relations.api.getSingleRelationByUuid")
|
||||||
|
public ResponseEntity<HsOfficeRelationResource> getSingleRelationByUuid(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
final UUID relationUuid) {
|
final UUID relationUuid) {
|
||||||
@ -116,6 +119,7 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@Timed("apprelations.api..deleteRelationByUuid")
|
||||||
public ResponseEntity<Void> deleteRelationByUuid(
|
public ResponseEntity<Void> deleteRelationByUuid(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
@ -132,6 +136,7 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@Timed("app.relations.api.patchRelation")
|
||||||
public ResponseEntity<HsOfficeRelationResource> patchRelation(
|
public ResponseEntity<HsOfficeRelationResource> patchRelation(
|
||||||
final String currentSubject,
|
final String currentSubject,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.relation;
|
package net.hostsharing.hsadminng.hs.office.relation;
|
||||||
|
|
||||||
|
import io.micrometer.core.annotation.Timed;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.Repository;
|
import org.springframework.data.repository.Repository;
|
||||||
|
|
||||||
@ -10,12 +11,14 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public interface HsOfficeRelationRbacRepository extends Repository<HsOfficeRelationRbacEntity, UUID> {
|
public interface HsOfficeRelationRbacRepository extends Repository<HsOfficeRelationRbacEntity, UUID> {
|
||||||
|
|
||||||
|
@Timed("app.relations.repo.findByUuid.rbac")
|
||||||
Optional<HsOfficeRelationRbacEntity> findByUuid(UUID id);
|
Optional<HsOfficeRelationRbacEntity> findByUuid(UUID id);
|
||||||
|
|
||||||
@Query(value = """
|
@Query(value = """
|
||||||
SELECT p.* FROM hs_office.relation_rv AS p
|
SELECT p.* FROM hs_office.relation_rv AS p
|
||||||
WHERE p.anchorUuid = :personUuid OR p.holderUuid = :personUuid
|
WHERE p.anchorUuid = :personUuid OR p.holderUuid = :personUuid
|
||||||
""", nativeQuery = true)
|
""", nativeQuery = true)
|
||||||
|
@Timed("app.relations.repo.findRelationRelatedToPersonUuid.rbac")
|
||||||
List<HsOfficeRelationRbacEntity> findRelationRelatedToPersonUuid(@NotNull UUID personUuid);
|
List<HsOfficeRelationRbacEntity> findRelationRelatedToPersonUuid(@NotNull UUID personUuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,16 +54,20 @@ public interface HsOfficeRelationRbacRepository extends Repository<HsOfficeRelat
|
|||||||
OR lower(CAST(rel.contact.emailAddresses AS String)) LIKE :contactData
|
OR lower(CAST(rel.contact.emailAddresses AS String)) LIKE :contactData
|
||||||
OR lower(CAST(rel.contact.phoneNumbers AS String)) LIKE :contactData )
|
OR lower(CAST(rel.contact.phoneNumbers AS String)) LIKE :contactData )
|
||||||
""")
|
""")
|
||||||
|
@Timed("app.relations.repo.findRelationRelatedToPersonUuidRelationTypePersonAndContactDataImpl.rbac")
|
||||||
List<HsOfficeRelationRbacEntity> findRelationRelatedToPersonUuidRelationTypePersonAndContactDataImpl(
|
List<HsOfficeRelationRbacEntity> findRelationRelatedToPersonUuidRelationTypePersonAndContactDataImpl(
|
||||||
final UUID personUuid,
|
final UUID personUuid,
|
||||||
final String relationType,
|
final String relationType,
|
||||||
final String personData,
|
final String personData,
|
||||||
final String contactData);
|
final String contactData);
|
||||||
|
|
||||||
|
@Timed("app.relations.repo.save.rbac")
|
||||||
HsOfficeRelationRbacEntity save(final HsOfficeRelationRbacEntity entity);
|
HsOfficeRelationRbacEntity save(final HsOfficeRelationRbacEntity entity);
|
||||||
|
|
||||||
|
@Timed("app.relations.repo.count.rbac")
|
||||||
long count();
|
long count();
|
||||||
|
|
||||||
|
@Timed("app.relations.repo.deleteByUuid.rbac")
|
||||||
int deleteByUuid(UUID uuid);
|
int deleteByUuid(UUID uuid);
|
||||||
|
|
||||||
private static String toSqlLikeOperand(final String text) {
|
private static String toSqlLikeOperand(final String text) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.relation;
|
package net.hostsharing.hsadminng.hs.office.relation;
|
||||||
|
|
||||||
|
import io.micrometer.core.annotation.Timed;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.Repository;
|
import org.springframework.data.repository.Repository;
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public interface HsOfficeRelationRealRepository extends Repository<HsOfficeRelationRealEntity, UUID> {
|
public interface HsOfficeRelationRealRepository extends Repository<HsOfficeRelationRealEntity, UUID> {
|
||||||
|
|
||||||
|
@Timed("app.repo.relations.findByUuid.real")
|
||||||
Optional<HsOfficeRelationRealEntity> findByUuid(UUID id);
|
Optional<HsOfficeRelationRealEntity> findByUuid(UUID id);
|
||||||
|
|
||||||
default List<HsOfficeRelationRealEntity> findRelationRelatedToPersonUuidAndRelationType(@NotNull UUID personUuid, HsOfficeRelationType relationType) {
|
default List<HsOfficeRelationRealEntity> findRelationRelatedToPersonUuidAndRelationType(@NotNull UUID personUuid, HsOfficeRelationType relationType) {
|
||||||
@ -20,6 +22,7 @@ public interface HsOfficeRelationRealRepository extends Repository<HsOfficeRelat
|
|||||||
SELECT p.* FROM hs_office.relation AS p
|
SELECT p.* FROM hs_office.relation AS p
|
||||||
WHERE p.anchorUuid = :personUuid OR p.holderUuid = :personUuid
|
WHERE p.anchorUuid = :personUuid OR p.holderUuid = :personUuid
|
||||||
""", nativeQuery = true)
|
""", nativeQuery = true)
|
||||||
|
@Timed("app.repo.relations.findRelationRelatedToPersonUuid.real")
|
||||||
List<HsOfficeRelationRealEntity> findRelationRelatedToPersonUuid(@NotNull UUID personUuid);
|
List<HsOfficeRelationRealEntity> findRelationRelatedToPersonUuid(@NotNull UUID personUuid);
|
||||||
|
|
||||||
@Query(value = """
|
@Query(value = """
|
||||||
@ -27,11 +30,15 @@ public interface HsOfficeRelationRealRepository extends Repository<HsOfficeRelat
|
|||||||
WHERE (:relationType IS NULL OR p.type = cast(:relationType AS hs_office.RelationType))
|
WHERE (:relationType IS NULL OR p.type = cast(:relationType AS hs_office.RelationType))
|
||||||
AND ( p.anchorUuid = :personUuid OR p.holderUuid = :personUuid)
|
AND ( p.anchorUuid = :personUuid OR p.holderUuid = :personUuid)
|
||||||
""", nativeQuery = true)
|
""", nativeQuery = true)
|
||||||
|
@Timed("app.repo.relations.findRelationRelatedToPersonUuidAndRelationTypeString.real")
|
||||||
List<HsOfficeRelationRealEntity> findRelationRelatedToPersonUuidAndRelationTypeString(@NotNull UUID personUuid, String relationType);
|
List<HsOfficeRelationRealEntity> findRelationRelatedToPersonUuidAndRelationTypeString(@NotNull UUID personUuid, String relationType);
|
||||||
|
|
||||||
|
@Timed("app.repo.relations.save.real")
|
||||||
HsOfficeRelationRealEntity save(final HsOfficeRelationRealEntity entity);
|
HsOfficeRelationRealEntity save(final HsOfficeRelationRealEntity entity);
|
||||||
|
|
||||||
|
@Timed("app.repo.relations.count.real")
|
||||||
long count();
|
long count();
|
||||||
|
|
||||||
|
@Timed("app.repo.relations.deleteByUuid.real")
|
||||||
int deleteByUuid(UUID uuid);
|
int deleteByUuid(UUID uuid);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ get:
|
|||||||
tags:
|
tags:
|
||||||
- hs-office-contacts
|
- hs-office-contacts
|
||||||
description: 'Fetch a single business contact by its uuid, if visible for the current subject.'
|
description: 'Fetch a single business contact by its uuid, if visible for the current subject.'
|
||||||
operationId: getContactByUuid
|
operationId: getSingleContactByUuid
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
||||||
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
||||||
|
@ -3,7 +3,7 @@ get:
|
|||||||
description: Returns the list of (optionally filtered) contacts which are visible to the current subject or any of it's assumed roles.
|
description: Returns the list of (optionally filtered) contacts which are visible to the current subject or any of it's assumed roles.
|
||||||
tags:
|
tags:
|
||||||
- hs-office-contacts
|
- hs-office-contacts
|
||||||
operationId: listContacts
|
operationId: getListOfContacts
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
||||||
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
||||||
@ -31,7 +31,7 @@ post:
|
|||||||
summary: Adds a new contact.
|
summary: Adds a new contact.
|
||||||
tags:
|
tags:
|
||||||
- hs-office-contacts
|
- hs-office-contacts
|
||||||
operationId: addContact
|
operationId: postNewContact
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
||||||
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
||||||
|
@ -2,7 +2,7 @@ get:
|
|||||||
tags:
|
tags:
|
||||||
- hs-office-persons
|
- hs-office-persons
|
||||||
description: 'Fetch a single business person by its uuid, if visible for the current subject.'
|
description: 'Fetch a single business person by its uuid, if visible for the current subject.'
|
||||||
operationId: getPersonByUuid
|
operationId: getSinglePersonByUuid
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
||||||
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
||||||
|
@ -3,7 +3,7 @@ get:
|
|||||||
description: Returns the list of (optionally filtered) persons which are visible to the current subject or any of it's assumed roles.
|
description: Returns the list of (optionally filtered) persons which are visible to the current subject or any of it's assumed roles.
|
||||||
tags:
|
tags:
|
||||||
- hs-office-persons
|
- hs-office-persons
|
||||||
operationId: listPersons
|
operationId: getListOfPersons
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
||||||
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
||||||
@ -31,7 +31,7 @@ post:
|
|||||||
summary: Adds a new person.
|
summary: Adds a new person.
|
||||||
tags:
|
tags:
|
||||||
- hs-office-persons
|
- hs-office-persons
|
||||||
operationId: addPerson
|
operationId: postNewPerson
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
||||||
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
||||||
|
@ -2,7 +2,7 @@ get:
|
|||||||
tags:
|
tags:
|
||||||
- hs-office-relations
|
- hs-office-relations
|
||||||
description: 'Fetch a single person relation by its uuid, if visible for the current subject.'
|
description: 'Fetch a single person relation by its uuid, if visible for the current subject.'
|
||||||
operationId: getRelationByUuid
|
operationId: getSingleRelationByUuid
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
||||||
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
||||||
|
@ -5,7 +5,7 @@ get:
|
|||||||
To match data, all given query parameters must be fulfilled ('and' / logical conjunction).
|
To match data, all given query parameters must be fulfilled ('and' / logical conjunction).
|
||||||
tags:
|
tags:
|
||||||
- hs-office-relations
|
- hs-office-relations
|
||||||
operationId: listRelations
|
operationId: getListOfRelations
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
||||||
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
||||||
@ -52,7 +52,7 @@ post:
|
|||||||
summary: Adds a new person relation.
|
summary: Adds a new person relation.
|
||||||
tags:
|
tags:
|
||||||
- hs-office-relations
|
- hs-office-relations
|
||||||
operationId: addRelation
|
operationId: postNewRelation
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
- $ref: 'auth.yaml#/components/parameters/currentSubject'
|
||||||
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
|
||||||
|
@ -9,9 +9,11 @@ management:
|
|||||||
web:
|
web:
|
||||||
exposure:
|
exposure:
|
||||||
include: info, health, metrics
|
include: info, health, metrics
|
||||||
|
observations:
|
||||||
|
annotations:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: org.postgresql.Driver
|
driver-class-name: org.postgresql.Driver
|
||||||
password: password
|
password: password
|
||||||
@ -33,3 +35,11 @@ liquibase:
|
|||||||
hsadminng:
|
hsadminng:
|
||||||
postgres:
|
postgres:
|
||||||
leakproof:
|
leakproof:
|
||||||
|
|
||||||
|
metrics:
|
||||||
|
distribution:
|
||||||
|
percentiles-histogram:
|
||||||
|
http:
|
||||||
|
server:
|
||||||
|
requests: true
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class HsOfficePersonControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
|||||||
EntityManager em;
|
EntityManager em;
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class ListPersons {
|
class GetListOfPersons {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void globalAdmin_withoutAssumedRoles_canViewAllPersons_ifNoCriteriaGiven() {
|
void globalAdmin_withoutAssumedRoles_canViewAllPersons_ifNoCriteriaGiven() {
|
||||||
|
@ -54,7 +54,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
|||||||
JpaAttempt jpaAttempt;
|
JpaAttempt jpaAttempt;
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class ListRelations {
|
class GetListOfRelations {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void globalAdmin_withoutAssumedRoles_canViewAllRelationsOfGivenPersonAndType() {
|
void globalAdmin_withoutAssumedRoles_canViewAllRelationsOfGivenPersonAndType() {
|
||||||
|
Loading…
Reference in New Issue
Block a user