diff options
author | dietricf | 2021-02-23 11:55:23 +0000 |
---|---|---|
committer | dietricf | 2021-02-23 11:55:23 +0000 |
commit | d8491a84ef2723f12fb95f73518d0a3f1a8988f5 (patch) | |
tree | 6fb86e45df8ece40fc008476071c7fe6d4d8fe41 | |
parent | 8eeb9f4b993f25aeaaeedab3f3410d8c9295628d (diff) | |
download | org.eclipse.openk-coremodules.contactBaseData.backend-d8491a84ef2723f12fb95f73518d0a3f1a8988f5.tar.gz org.eclipse.openk-coremodules.contactBaseData.backend-d8491a84ef2723f12fb95f73518d0a3f1a8988f5.tar.xz org.eclipse.openk-coremodules.contactBaseData.backend-d8491a84ef2723f12fb95f73518d0a3f1a8988f5.zip |
KON-706KON-706
6 files changed, 18 insertions, 6 deletions
diff --git a/src/main/java/org/eclipse/openk/contactbasedata/controller/ContactController.java b/src/main/java/org/eclipse/openk/contactbasedata/controller/ContactController.java index 06528cb..9715f37 100644 --- a/src/main/java/org/eclipse/openk/contactbasedata/controller/ContactController.java +++ b/src/main/java/org/eclipse/openk/contactbasedata/controller/ContactController.java @@ -29,7 +29,13 @@ import org.springframework.data.web.PageableDefault; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.annotation.Secured; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; import java.util.Optional; import java.util.UUID; @@ -60,6 +66,7 @@ public class ContactController { @RequestParam( "expiringDataInPast" ) Optional<Boolean> expiringDataInPast, @RequestParam( "deletionLockExceeded") Optional<Boolean> delLockExceeded, @RequestParam( "alsoShowAnonymized" ) Optional<Boolean> showAnonymized, + @RequestParam( "withSyncError") Optional<Boolean> showWithSyncError, @PageableDefault( sort = {"name"}, size = 20, direction = ASC) Pageable pageable ) { SearchContactsFilterParams filter = new SearchContactsFilterParams(); @@ -71,6 +78,7 @@ public class ContactController { filter.setExpiringDataInPast(expiringDataInPast.orElse(Boolean.FALSE)); filter.setDelLockExceeded(delLockExceeded.orElse(Boolean.FALSE)); filter.setShowAnonymized(showAnonymized.orElse(Boolean.FALSE)); + filter.setWithSyncError(showWithSyncError.orElse(Boolean.FALSE)); return contactService.findDetailedContacts( filter, pageable); diff --git a/src/main/java/org/eclipse/openk/contactbasedata/repository/DetailedContactRepository.java b/src/main/java/org/eclipse/openk/contactbasedata/repository/DetailedContactRepository.java index 5978f7f..06d73fa 100644 --- a/src/main/java/org/eclipse/openk/contactbasedata/repository/DetailedContactRepository.java +++ b/src/main/java/org/eclipse/openk/contactbasedata/repository/DetailedContactRepository.java @@ -42,6 +42,9 @@ public interface DetailedContactRepository extends PagingAndSortingRepository<Vw + " and (COALESCE(:filterDelLockExceeded) = false or COALESCE(:filterDelLockExceeded) = true and dc.fkContactId in " + " (select distinct amc.tblContact.id from TblAssignmentModulContact amc where " + " amc.deletionLockUntil is not null and amc.deletionLockUntil < :dateTimeNow ))" + + " and (COALESCE(:withSyncError) = false or COALESCE(:withSyncError) = true and dc.fkContactId in " + + " (select distinct intpers.contact.id from TblInternalPerson intpers where " + + " COALESCE(intpers.isSyncError, false) = true ))" + " and (COALESCE(:showAnonymized) = true or COALESCE(:showAnonymized) = false and COALESCE(dc.anonymized, false) = false)" ) Page<VwDetailedContact> findByFilter(@Param("contactType")String contactType, // NOSONAR _fd 07.02.2020 moving to a param object will not increase the readability here! @@ -53,6 +56,7 @@ public interface DetailedContactRepository extends PagingAndSortingRepository<Vw @Param("filterExpiringDate") boolean filterExpiringDate, @Param("filterDelLockExceeded") boolean filterDelLockExceeded, @Param("showAnonymized") boolean showAnonymized, + @Param("withSyncError" ) boolean withSyncError, Pageable pageable); Optional<VwDetailedContact> findByUuid(UUID contactUuid); diff --git a/src/main/java/org/eclipse/openk/contactbasedata/service/ContactService.java b/src/main/java/org/eclipse/openk/contactbasedata/service/ContactService.java index fc24db2..c22aa9f 100644 --- a/src/main/java/org/eclipse/openk/contactbasedata/service/ContactService.java +++ b/src/main/java/org/eclipse/openk/contactbasedata/service/ContactService.java @@ -59,15 +59,14 @@ public class ContactService { searchContactsFilterParams.isExpiringDataInPast(), searchContactsFilterParams.isDelLockExceeded(), searchContactsFilterParams.isShowAnonymized(), + searchContactsFilterParams.isWithSyncError(), pageable); } public VwDetailedContact findDetailedContactByUuid(UUID contactUuid){ - VwDetailedContact vwDetailedContact = detailedContactRepository + return detailedContactRepository .findByUuid(contactUuid) .orElseThrow(() -> new NotFoundException("contact.uuid.not.existing")); - - return vwDetailedContact; } } diff --git a/src/main/java/org/eclipse/openk/contactbasedata/service/util/SearchContactsFilterParams.java b/src/main/java/org/eclipse/openk/contactbasedata/service/util/SearchContactsFilterParams.java index a62ffe3..66a1e6b 100644 --- a/src/main/java/org/eclipse/openk/contactbasedata/service/util/SearchContactsFilterParams.java +++ b/src/main/java/org/eclipse/openk/contactbasedata/service/util/SearchContactsFilterParams.java @@ -30,4 +30,5 @@ public class SearchContactsFilterParams { private boolean expiringDataInPast; // NOSONAR _fd: 10.02.2020 definitly used via Lombok-Accessors private boolean delLockExceeded; // NOSONAR _fd: 10.02.2020 definitly used via Lombok-Accessors private boolean showAnonymized; // NOSONAR _fd: 10.02.2020 definitly used via Lombok-Accessors + private boolean withSyncError; // NOSONAR } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index abf177a..e3bf971 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -130,7 +130,7 @@ spring: jwt: tokenHeader: Authorization - useStaticJwt: false + useStaticJwt: true staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiI5MGI0NGFkOC1iYjlmLTQ1MzktYT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ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg diff --git a/src/test/java/org/eclipse/openk/contactbasedata/service/ContactServiceTest.java b/src/test/java/org/eclipse/openk/contactbasedata/service/ContactServiceTest.java index 65623b4..8570449 100644 --- a/src/test/java/org/eclipse/openk/contactbasedata/service/ContactServiceTest.java +++ b/src/test/java/org/eclipse/openk/contactbasedata/service/ContactServiceTest.java @@ -56,7 +56,7 @@ class ContactServiceTest { void shouldFindDetailedContactsProperly() { Page<VwDetailedContact> mockPaged = MockDataHelper.mockVDetailedContactPage(); when(detailedContactRepository.findByFilter(isNull(), isNull(), isNull(), isNull(), - anyBoolean(), any( Date.class), anyBoolean(), anyBoolean(), anyBoolean(), any(Pageable.class))).thenReturn(mockPaged); + anyBoolean(), any( Date.class), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), any(Pageable.class))).thenReturn(mockPaged); SearchContactsFilterParams filter = new SearchContactsFilterParams(); Page<VwDetailedContact> retPage = contactService.findDetailedContacts( filter, PageRequest.of(0, 20)); |