Object auditGetPostDeletePutUpsert()

in src/main/java/com/epam/digital/data/platform/restapi/core/audit/ControllerAuditAspect.java [102:121]


  Object auditGetPostDeletePutUpsert(ProceedingJoinPoint joinPoint, Object object, RequestContext context,
      SecurityContext securityContext) throws Throwable {

    var annotation = getAnnotation(joinPoint);

    if (annotation.equals(GetMapping.class) && object instanceof UUID) {
      return prepareAndSendRestAudit(joinPoint, READ, (UUID) object, securityContext);
    } else if (annotation.equals(GetMapping.class)) {
      return prepareAndSendRestAudit(joinPoint, SEARCH, null, securityContext);
    } else if (annotation.equals(PostMapping.class)) {
      return prepareAndSendRestAudit(joinPoint, CREATE, null, securityContext);
    } else if (annotation.equals(DeleteMapping.class) && object instanceof UUID) {
      return prepareAndSendRestAudit(joinPoint, DELETE, (UUID) object, securityContext);
    } else if (annotation.equals(PutMapping.class)) {
      return prepareAndSendRestAudit(joinPoint, UPSERT, null, securityContext);
    } else {
      throw new AuditException("Cannot save audit for this HTTP method. Not supported annotation: @"
          + annotation.getSimpleName());
    }
  }