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

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

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

import de.ivu.elect.business.niederschrift.entity.Niederschrift;

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

  private static final long serialVersionUID = 1L;

  @Inject
  private transient GroupedConversation conversation;

  private List<Niederschrift> queuedEntities = new ArrayList<>();

  public NiederschriftListConversationStore() {
    super();
  }

  public List<Niederschrift> get() {
    return queuedEntities;
  }

  public void add(Niederschrift niederschrift) {
    get().add(niederschrift);
  }

  public void remove(Niederschrift niederschrift) {
    get().remove(niederschrift);
  }

  public void reset() {
    queuedEntities = new ArrayList<>();
  }

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