
package de.ivu.elect.presentation.personenpruefung.action;

import de.ivu.elect.business.personenpruefung.boundary.PersonPruefungKonfigurationChangeEvent;
import de.ivu.elect.business.personenpruefung.entity.PersonPruefungKonfiguration;
import de.ivu.elect.business.personenpruefung.entity.PersonPruefungKonfigurationMeta;
import de.ivu.elect.presentation.menu.AbstractActionEntry;
import de.ivu.elect.presentation.security.AbstractGebietSecurity;

import javax.annotation.Nonnull;
import javax.inject.Inject;

public abstract class AbstractPersonPruefungKonfigurationAction extends AbstractActionEntry<PersonPruefungKonfiguration> {

  private static final long serialVersionUID = 1L;

  public AbstractPersonPruefungKonfigurationAction() {
    super();
  }

  @Inject
  protected transient PersonPruefungKonfigurationMeta entityMeta;

  @Inject
  private transient PersonPruefungKonfigurationChangeEvent changeEvent;

  @Override
  protected AbstractGebietSecurity getGebietSecurity() {
    return KEINE_GEBIET_SECURITY;
  }

  @Override
  protected boolean isDisabledInternal(@Nonnull PersonPruefungKonfiguration personPruefungKonfiguration) {
    return !personPruefungKonfiguration.isPersistent();
  }

  @Override
  protected void fireChangeEvent() {
    changeEvent.sendChangeEvent();
  }

  @Override
  protected boolean isFireChangeEvent() {
    return false;
  }
}
