Commit adcc65d4 authored by Labros Papadopoulos's avatar Labros Papadopoulos
Browse files

Fix get operation bug

parent 6c6711c1
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -65,14 +65,14 @@ public class GeographicSiteManagementApiController implements GeographicSiteMana
                Individual ind = individualRepoService.findByUsername(principal.getName());

                GeographicSite gs= geographicSiteManagementService.findGeographicSiteByRelatedPartyId(ind.getId());
                return new ResponseEntity<>(gs,HttpStatus.OK);
                return new ResponseEntity<GeographicSite>(gs,HttpStatus.OK);

            } else if ( authentication.getAuthorities().contains( new SimpleGrantedAuthority( UserRoleType.ROLE_ADMIN.getValue()  ) ) ){
                return new ResponseEntity<GeographicSite>(geographicSiteManagementService.findGeographicSiteByUUID(id), HttpStatus.OK);

            }else {
                return new ResponseEntity< GeographicSite >(HttpStatus.FORBIDDEN );
            }
            return new ResponseEntity<>(geographicSiteManagementService.findGeographicSiteByUUID(id), HttpStatus.OK);

        } catch (Exception e) {
            log.error(COULD_NOT_SERIALIZE, e);
+5 −0
Original line number Diff line number Diff line
@@ -39,6 +39,11 @@ public class GeographicSiteManagementService {

    public GeographicSite findGeographicSiteByRelatedPartyId(String uuid){
        Optional<GeographicSite> gs=geographicSiteManagementRepository.findByRelatedPartyId(uuid);
        try {
            log.info("Found geographic site from related party:{} , geographic site info: {}", uuid, gs.orElse(null).toString());
        }catch(Exception e){
            log.error("Error during fetch of geographic site info: {}", e.getMessage());
        }
        return gs.orElse(null);

    }