Object controllerAudit()

in src/main/java/com/epam/digital/data/platform/excerpt/api/audit/ControllerAuditAspect.java [78:95]


  Object controllerAudit(ProceedingJoinPoint joinPoint, Object object) throws Throwable {

    var auditableControllerAnnotation = ((MethodSignature) joinPoint.getSignature())
            .getMethod()
            .getAnnotation(AuditableController.class);
    var httpAnnotation = getAnnotation(joinPoint);

    if (httpAnnotation.equals(GetMapping.class) && object instanceof UUID) {
      return prepareAndSendRestAudit(
          joinPoint, auditableControllerAnnotation.action(), (UUID) object);
    } else if (httpAnnotation.equals(PostMapping.class)) {
      return prepareAndSendRestAudit(
          joinPoint, auditableControllerAnnotation.action(), null);
    } else {
      throw new AuditException("Cannot save audit for this HTTP method. Not supported annotation: @"
          + httpAnnotation.getSimpleName());
    }
  }