All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.tech.hermes.management.infrastructure.audit.CompositeAuditor Maven / Gradle / Ivy

There is a newer version: 2.8.0
Show newest version
package pl.allegro.tech.hermes.management.infrastructure.audit;

import static com.google.common.base.Preconditions.checkNotNull;

import java.util.Collection;
import pl.allegro.tech.hermes.api.PatchData;
import pl.allegro.tech.hermes.management.domain.Auditor;

public class CompositeAuditor implements Auditor {

  private final Collection auditors;

  public CompositeAuditor(Collection auditors) {
    this.auditors = checkNotNull(auditors);
  }

  @Override
  public void beforeObjectCreation(String username, Object createdObject) {
    auditors.forEach(auditor -> auditor.beforeObjectCreation(username, createdObject));
  }

  @Override
  public void beforeObjectRemoval(
      String username, String removedObjectType, String removedObjectName) {
    auditors.forEach(
        auditor -> auditor.beforeObjectRemoval(username, removedObjectType, removedObjectName));
  }

  @Override
  public void beforeObjectUpdate(
      String username, String objectClassName, Object objectName, PatchData patchData) {
    auditors.forEach(
        auditor -> auditor.beforeObjectUpdate(username, objectClassName, objectName, patchData));
  }

  @Override
  public void objectCreated(String username, Object createdObject) {
    auditors.forEach(auditor -> auditor.objectCreated(username, createdObject));
  }

  @Override
  public void objectRemoved(String username, Object removedObject) {
    auditors.forEach(auditor -> auditor.objectRemoved(username, removedObject));
  }

  @Override
  public void objectUpdated(String username, Object oldObject, Object newObject) {
    auditors.forEach(auditor -> auditor.objectUpdated(username, oldObject, newObject));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy