
package de.ivu.elect.business.kandidatur.control;

import javax.inject.Inject;
import javax.enterprise.event.Event;

import de.ivu.elect.business.kandidatur.entity.Kandidatur;
import de.ivu.elect.business.kandidatur.boundary.KandidaturDAO;
import de.ivu.elect.business.kandidatur.boundary.KandidaturCreateEvent;

// abgeleitete Klasse NICHT mit "@javax.ejb.Stateless" annotieren!
public abstract class AbstractKandidaturCreate {

  @Inject
  protected KandidaturDAO dao;

    @Inject
    transient Event<KandidaturCreateEvent> createEvent;



    @Inject
  de.ivu.elect.business.person.control.PersonendatenCreate superCreate;
  


public void save(Kandidatur entity) {
    dao.persist(entity);
    sendCreateEvent(entity);
  }

  public void sendCreateEvent(Kandidatur entity) {
        superCreate.sendCreateEvent(entity);
        createEvent.fire(new KandidaturCreateEvent(entity));
  }

}
