/** Lists the entities of type Intrant for the CSV export */
  @Transactional(readOnly = true)
  public List<Intrant> listForCsv(
      String sortProperty, boolean sortOrder, String identifiant, String nom) {

    ImogActor actor = HttpSessionUtil.getCurrentUser();
    ImogJunction junction = createFilterJuntion(actor);

    if (identifiant != null && !identifiant.isEmpty()) {
      BasicCriteria criteria = new BasicCriteria();
      criteria.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
      criteria.setField("identifiant");
      criteria.setValue(identifiant);
      junction.add(criteria);
    }
    if (nom != null && !nom.isEmpty()) {
      BasicCriteria criteria = new BasicCriteria();
      criteria.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
      criteria.setField("nom");
      criteria.setValue(nom);
      junction.add(criteria);
    }

    List<Intrant> beans = dao.load(sortProperty, sortOrder, junction);
    List<Intrant> securedBeans = filter.<Intrant>toSecure(beans);
    return securedBeans;
  }
  /**
   * Lists the entities of type Intrant
   *
   * @param sortProperty the property used to sort the collection
   * @param sortOrder true for an ascendant sort
   * @return list of intrant
   */
  @Transactional(readOnly = true)
  public List<Intrant> listIntrant(String sortProperty, boolean sortOrder, ImogJunction junction) {

    List<Intrant> beans = dao.load(sortProperty, sortOrder, junction);

    return beans;
  }
  /**
   * Counts the number of non affected intrant entities in the database
   *
   * @param property the property which is not affected
   * @param criterion request criteria
   * @return the count
   */
  @Transactional(readOnly = true)
  public Long countNonAffectedIntrantReverse(String property, ImogJunction criterions) {

    ImogActor actor = HttpSessionUtil.getCurrentUser();
    ImogJunction junction = createFilterJuntion(actor);
    if (criterions != null) junction.add(criterions);
    return dao.countNonAffectedReverse(property, junction);
  }
  /**
   * Counts the number of intrant in the database, that match the criteria
   *
   * @return the count
   */
  @Transactional(readOnly = true)
  public Long countIntrant(ImogJunction criterions) {

    ImogActor actor = HttpSessionUtil.getCurrentUser();
    ImogJunction junction = createFilterJuntion(actor);
    if (criterions != null) junction.add(criterions);

    return dao.count(junction);
  }
  /**
   * Lists the entities of type Intrant
   *
   * @param sortProperty the property used to sort the collection
   * @param sortOrder true for an ascendant sort
   * @return list of intrant
   */
  @Transactional(readOnly = true)
  public List<Intrant> listIntrant(String sortProperty, boolean sortOrder) {

    ImogActor actor = HttpSessionUtil.getCurrentUser();
    ImogJunction junction = createFilterJuntion(actor);

    List<Intrant> beans = dao.load(sortProperty, sortOrder, junction);

    return beans;
  }
  /**
   * Lists the entities of type Intrant
   *
   * @param i first index to retrieve
   * @param j nb of items to retrieve
   * @param sortProperty the property used to sort the collection
   * @param sortOrder true for an ascendant sort
   * @param criterions request criteria
   * @return list of intrant
   */
  @Transactional(readOnly = true)
  public List<Intrant> listIntrant(
      int i, int j, String sortProperty, boolean sortOrder, ImogJunction criterions) {

    ImogActor actor = HttpSessionUtil.getCurrentUser();
    ImogJunction junction = createFilterJuntion(actor);
    if (criterions != null) junction.add(criterions);

    List<Intrant> beans = dao.load(i, j, sortProperty, sortOrder, junction);

    return beans;
  }
  /**
   * Saves or updates the entity
   *
   * @param entity the entity to be saved or updated
   * @param isNew true if it is a new entity added for the first time.
   */
  @Transactional
  public void save(Intrant entity, boolean isNew) {

    ImogActor actor = HttpSessionUtil.getCurrentUser();

    if (entity != null) {

      handlerHelper.prepare(entity);
      if (entity.getDeleted() != null) entity.setDeleted(null);

      dao.saveOrUpdate(entity, isNew);
    }
  }
 /**
  * Loads the entity with the specified id
  *
  * @param entityId the entity id
  * @return the entity or null
  */
 @Transactional(readOnly = true)
 public Intrant getById(String entityId) {
   return dao.getById(entityId);
 }
 /**
  * Loads the entity with the specified id
  *
  * @param entityId the entity id
  * @return the entity or null
  */
 @Transactional(readOnly = true)
 public Intrant findById(String entityId) {
   return dao.load(entityId);
 }
  /**
   * Removes the specified entity from the database
   *
   * @param entity The entity to be deleted
   */
  @Transactional
  public void delete(Intrant entity) {

    handlerHelper.prepareForDelete(entity);
    dao.saveOrUpdate(entity, false);
  }