Revision 59584
Added by Antonis Lempesis over 3 years ago
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java | ||
---|---|---|
565 | 565 |
|
566 | 566 |
HttpEntity<String> httpEntity = new HttpEntity <> (json_interface,httpHeaders); |
567 | 567 |
|
568 |
restTemplate.postForObject(uriComponents.toUri(),httpEntity, String.class); |
|
568 | 569 |
|
569 |
ResponseEntity responseEntity = restTemplate.postForObject(uriComponents.toUri(),httpEntity,ResponseEntity.class); |
|
570 |
emailUtils.sendAdminRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication()); |
|
571 |
emailUtils.sendUserRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication()); |
|
570 | 572 |
|
571 |
if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { |
|
572 |
emailUtils.sendAdminRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication()); |
|
573 |
emailUtils.sendUserRegisterInterfaceEmail(e, comment, repositoryInterface, SecurityContextHolder.getContext().getAuthentication()); |
|
573 |
submitInterfaceValidation(e, registeredBy, repositoryInterface, false); |
|
574 | 574 |
|
575 |
submitInterfaceValidation(e, registeredBy, repositoryInterface, false); |
|
576 |
return repositoryInterface; |
|
577 |
} else { |
|
578 |
LOGGER.debug(responseEntity.getBody().toString()); |
|
579 |
throw new Exception("Registering" + baseAddress + " returned " + responseEntity.getStatusCode()); |
|
580 |
} |
|
575 |
return repositoryInterface; |
|
581 | 576 |
|
582 |
} catch (JSONException | ValidatorServiceException e) {
|
|
583 |
LOGGER.debug("Exception on addRepositoryInterface" , e);
|
|
577 |
} catch (Exception e) { |
|
578 |
LOGGER.error("Exception on addRepositoryInterface" , e);
|
|
584 | 579 |
emailUtils.reportException(e); |
585 | 580 |
throw e; |
586 | 581 |
} |
Also available in: Unified diff
Correctly checking return type of POST method