diff options
author | Ina Curdt | 2020-05-05 12:15:21 +0000 |
---|---|---|
committer | Ina Curdt | 2020-05-05 12:15:21 +0000 |
commit | f1f8152d480fd76c2f859b5b4a5cd151849c08e8 (patch) | |
tree | 4a71800824b330bccd49181fcf41c6aabad90ba1 | |
parent | 7d4378df41c656e59049014102830ccd10b66905 (diff) | |
download | backup.org.eclipse.openk-coremodules.contactBaseData.backend-f1f8152d480fd76c2f859b5b4a5cd151849c08e8.tar.gz backup.org.eclipse.openk-coremodules.contactBaseData.backend-f1f8152d480fd76c2f859b5b4a5cd151849c08e8.tar.xz backup.org.eclipse.openk-coremodules.contactBaseData.backend-f1f8152d480fd76c2f859b5b4a5cd151849c08e8.zip |
SI-875 Service contacts (UUID) angelegt
Signed-off-by: Ina Curdt <Ina.Curdt@pta.de>
3 files changed, 24 insertions, 0 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 54def44..06528cb 100644 --- a/src/main/java/org/eclipse/openk/contactbasedata/controller/ContactController.java +++ b/src/main/java/org/eclipse/openk/contactbasedata/controller/ContactController.java @@ -76,6 +76,17 @@ public class ContactController { filter, pageable); } + + @ApiOperation(value = "Anzeigen eines gespeicherten Kontaktes") + @ApiResponses(value = {@ApiResponse(code = 200, message = "Erfolgreich durchgeführt")}) + @ResponseStatus(HttpStatus.OK) + @Secured({"ROLE_KON-READER", "ROLE_KON-WRITER", "ROLE_KON-ADMIN"}) + @GetMapping("/{contactUuid}") + public VwDetailedContact findContact( + @PathVariable( "contactUuid") UUID contactUuid){ + return contactService.findDetailedContactByUuid(contactUuid); + } + @ApiOperation(value = "Anonymisieren eines Kontaktes") @ApiResponses(value = { @ApiResponse(code = 200, message = "Kontakt wurde anonymisiert"), 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 3634bb2..5978f7f 100644 --- a/src/main/java/org/eclipse/openk/contactbasedata/repository/DetailedContactRepository.java +++ b/src/main/java/org/eclipse/openk/contactbasedata/repository/DetailedContactRepository.java @@ -22,6 +22,7 @@ import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import java.util.Date; +import java.util.Optional; import java.util.UUID; public interface DetailedContactRepository extends PagingAndSortingRepository<VwDetailedContact, Long> { @@ -53,5 +54,9 @@ public interface DetailedContactRepository extends PagingAndSortingRepository<Vw @Param("filterDelLockExceeded") boolean filterDelLockExceeded, @Param("showAnonymized") boolean showAnonymized, 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 aa50605..fc24db2 100644 --- a/src/main/java/org/eclipse/openk/contactbasedata/service/ContactService.java +++ b/src/main/java/org/eclipse/openk/contactbasedata/service/ContactService.java @@ -62,4 +62,12 @@ public class ContactService { pageable); } + public VwDetailedContact findDetailedContactByUuid(UUID contactUuid){ + VwDetailedContact vwDetailedContact = detailedContactRepository + .findByUuid(contactUuid) + .orElseThrow(() -> new NotFoundException("contact.uuid.not.existing")); + + return vwDetailedContact; + } + } |