Пример #1
0
 @Before("((update(tenantResource) || create(tenantResource)) && @annotation(auditable) )")
 public void doSimpleAdvice(
     final JoinPoint jp, final TenantResource tenantResource, final Auditable auditable) {
   if (TenantContextHolder.isEnabled()) {
     final String currentTenant = TenantUtils.getCurrentTenant();
     switch (auditable.actionType()) {
       case CREATE:
         addTenantFields(tenantResource, currentTenant);
         break;
       case UPDATE:
         keepTenantFields(tenantResource);
         break;
       default:
         break;
     }
   }
   return;
 }
Пример #2
0
  @Before("((updateAll(entityResources) || insertAll(entityResources)) && @annotation(auditable) )")
  public void doCollectionAdvice(
      final JoinPoint jp,
      final Collection<EntityResource> entityResources,
      final Auditable auditable) {
    if (TenantContextHolder.isEnabled()) {
      switch (auditable.actionType()) {
        case CREATE:
          addTenantFields(entityResources);
          break;
        case UPDATE:
          keepTenantFields(entityResources);
          break;
        default:
          break;
      }
    }

    return;
  }