package de.ivu.elect.presentation.dokumente;

import java.util.List;

import javax.inject.Named;

import org.apache.deltaspike.core.api.scope.ViewAccessScoped;

import de.ivu.elect.business.dokumente.entity.DokumentVorlage;
import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.jee.presentation.dynamicform.FormBuilder;
import de.ivu.elect.presentation.View;

@ViewAccessScoped
@View(viewId = DokumentVorlageLeerformularSearchView.VIEW_ID, useCase = UseCasePermission.DOKUMENT_VORLAGE_LEERFORMULAR_SEARCH)
@Named(DokumentVorlageLeerformularSearchView.COMPONENT_NAME)
public class DokumentVorlageLeerformularSearchView extends AbstractElectDokumentVorlageSearchView {

  public static final String COMPONENT_NAME = "dokumentVorlageLeerformularSearchView";

  public static final String VIEW_ID = "/dokumente/dokument-vorlage-leerformular-search.xhtml";

  private static final long serialVersionUID = 1L;

  @Override
  protected String getViewId() {
    return VIEW_ID;
  }

  @Override
  public void addProperties(FormBuilder formBuilder) {
    // ohne, damit SearchParameters nicht verändert wird
  }

  @Override
  protected List<DokumentVorlage> performSearch() {
    return search.getSearchResultLeerformulare(getSearchParameters(), getEagerLoadingCollector());
  }

}
