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

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

import de.ivu.elect.business.email.entity.EmailVorlage;
import de.ivu.elect.business.email.boundary.EmailVorlageDAO;
import de.ivu.elect.business.email.boundary.EmailVorlageCreateEvent;

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

  @Inject
  protected EmailVorlageDAO dao;

    @Inject
    transient Event<EmailVorlageCreateEvent> createEvent;



  


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

  public void sendCreateEvent(EmailVorlage entity) {
        createEvent.fire(new EmailVorlageCreateEvent(entity));
  }

}
