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

import static java.util.Objects.nonNull;

import org.primefaces.event.SelectEvent;

import de.ivu.elect.business.person.entity.Personendaten;

public abstract class AbstractPersonendatenEditActionResolver extends AbstractPersonendatenActionResolver {

  private static final long serialVersionUID = 1L;

  public AbstractPersonendatenEditActionResolver() {
    super();
  }

  public <E extends Personendaten> String doEdit(E personendaten) {
    // castTo() notwendig, da sonst ClassCastExceptions in Actions
    return getAction(personendaten).action((E) personendaten.castTo(Personendaten.class).getEntity());
  }

  public void doRowDblselect(SelectEvent event) {
    if (nonNull(event) && nonNull(event.getObject()) && event.getObject() instanceof Personendaten) {
      Personendaten personendaten = (Personendaten) event.getObject();

      getAction(personendaten).onRowDblselect(event);
    }
  }
}
