Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/poc' into feature/poc
Browse files Browse the repository at this point in the history
  • Loading branch information
noemil12 committed Nov 27, 2023
2 parents 5a80ae6 + 24c07d9 commit a3d24b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Mono<ConsumerEService> getConsumerEservice(String eserviceId, String cons
.doOnNext(cache -> log.info("[{}-{}] ConsumerEService in cache", consumerId, eserviceId))
.flatMap(eServiceCache -> {
if(eServiceCache.getState().equalsIgnoreCase(Const.STATE_ACTIVE)) return Mono.just(eServiceCache);
return Mono.error(new PDNDGenericException(UNAUTHORIZED, UNAUTHORIZED.getMessage().concat(eserviceId), HttpStatus.FORBIDDEN));
return Mono.error(new PDNDGenericException(UNAUTHORIZED, UNAUTHORIZED.getMessage().concat(" ").concat(eserviceId), HttpStatus.FORBIDDEN));
})
.switchIfEmpty(Mono.defer(() -> {
log.info("[{}-{}] ConsumerEService no in cache", consumerId, eserviceId);
Expand All @@ -47,7 +47,7 @@ private Mono<ConsumerEService> getFromDbAndSaveOnCache(String eserviceId, String
return this.consumerEServiceRepository.findByConsumerIdAndEServiceIdAndState(eserviceId,consumerId, Const.STATE_ACTIVE)
.switchIfEmpty(Mono.defer(()-> {
log.info("[{}-{}] ConsumerEService not founded into DB", consumerId, eserviceId);
return Mono.error(new PDNDGenericException(UNAUTHORIZED, UNAUTHORIZED.getMessage().concat(eserviceId), HttpStatus.FORBIDDEN));
return Mono.error(new PDNDGenericException(UNAUTHORIZED, UNAUTHORIZED.getMessage().concat(" ").concat(eserviceId), HttpStatus.FORBIDDEN));
}))
.doOnNext(entity ->
log.info("[{}-{}] ConsumerEService founded into DB", consumerId, eserviceId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Mono<EService> getEService(String eserviceId, String descriptorId) {
.doOnNext(cache -> log.info("[{}-{}] EService in cache", eserviceId, descriptorId))
.flatMap(eServiceCache -> {
if(eServiceCache.getState().equalsIgnoreCase(Const.STATE_PUBLISHED)) return Mono.just(eServiceCache);
return Mono.error(new PDNDGenericException(UNAUTHORIZED, UNAUTHORIZED.getMessage().concat(eserviceId), HttpStatus.FORBIDDEN));
return Mono.error(new PDNDGenericException(UNAUTHORIZED, UNAUTHORIZED.getMessage().concat(" ").concat(eserviceId), HttpStatus.FORBIDDEN));
})
.switchIfEmpty(Mono.defer(() -> {
log.info("[{}-{}] EService no in cache", eserviceId, descriptorId);
Expand All @@ -53,7 +53,7 @@ private Mono<EService> getFromDbAndSaveOnCache(String eserviceId, String descrip
return this.eServiceRepository.checkEServiceStatus(eserviceId, descriptorId, Const.STATE_PUBLISHED)
.switchIfEmpty(Mono.defer(()-> {
log.info("[{}-{}] EService not founded into DB", eserviceId, descriptorId);
return Mono.error(new PDNDGenericException(UNAUTHORIZED, UNAUTHORIZED.getMessage().concat(eserviceId), HttpStatus.FORBIDDEN));
return Mono.error(new PDNDGenericException(UNAUTHORIZED, UNAUTHORIZED.getMessage().concat(" ").concat(eserviceId), HttpStatus.FORBIDDEN));
}))
.doOnNext(entity ->
log.info("[{}-{}] EService founded into DB", eserviceId, descriptorId)
Expand Down

0 comments on commit a3d24b2

Please sign in to comment.