예제 #1
0
 @AfterReturning(
     pointcut = "aspects.pointcuts.PointcutDefinitions.allControllerMethods()",
     returning = "returnedValue")
 public void afterReturning(ResponseSerializer returnedValue) {
   if (isCorrectResult(returnedValue)) {
     if (returnedValue.getResult() instanceof Collection) {
       returnedValue.setStatus(
           ((Collection) returnedValue.getResult()).isEmpty()
               ? ResponseStatus.ZERO_RESULTS
               : ResponseStatus.OK);
     } else {
       returnedValue.setStatus(ResponseStatus.OK);
     }
   }
 }
예제 #2
0
 private boolean isCorrectResult(ResponseSerializer rs) {
   return !resultErrorStatuses.contains(rs.getStatus());
 }