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

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

import de.ivu.elect.business.email.entity.Email;
import de.ivu.elect.business.email.boundary.EmailDAO;
import de.ivu.elect.business.email.boundary.EmailCreateEvent;

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

  @Inject
  protected EmailDAO dao;

    @Inject
    transient Event<EmailCreateEvent> createEvent;



  


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

  public void sendCreateEvent(Email entity) {
        createEvent.fire(new EmailCreateEvent(entity));
  }

}
