
package de.ivu.elect.business.personenpruefung.boundary;

import java.io.Serializable;

import javax.enterprise.event.Observes;
import javax.enterprise.event.Reception;
import javax.inject.Inject;

import org.apache.deltaspike.core.api.scope.GroupedConversation;
import org.apache.deltaspike.core.api.scope.ConversationGroup;
import org.apache.deltaspike.core.api.scope.GroupedConversationScoped;

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

@GroupedConversationScoped
@ConversationGroup(PersonenKonfliktWertenlistenAbgleichBerufConversationStore.class)
public class PersonenKonfliktWertenlistenAbgleichBerufConversationStore implements Serializable {

  private static final long serialVersionUID = 1L;

  @Inject
  protected GroupedConversation conversation;

  Beruf beruf;

  public boolean isSelected() {
    return getBeruf() != null;
  }

  public Beruf getBeruf() {
    return beruf;
  }

  public void setBeruf(Beruf beruf) {
    this.beruf = beruf;
  }

  public void close() {
    conversation.close();
  }

  public void onWahlSelectChangeEvent(
      @Observes(notifyObserver = Reception.IF_EXISTS) de.ivu.elect.business.wahl.boundary.WahlSelectChangeEvent event) {
    close();
  }

  public void onWahlterminSelectChangeEvent(
      @Observes(notifyObserver = Reception.IF_EXISTS) de.ivu.elect.business.wahl.boundary.WahlterminSelectChangeEvent event) {
    close();
  }
}
