@Override
  public String fullTextSearch(String text) {

    boolean fullTextSearch = false;
    StringBuffer buffer = new StringBuffer(BaseNLS.constants().label_filtered() + " ");

    if (text == null || (text != null && text.equals(""))) {
      setSearchCriterions(null);
    } else {

      String locale = NLS.constants().locale();

      PriseMedicamentRegimeRequest request = (PriseMedicamentRegimeRequest) getContext();
      newRequest = false;

      ImogJunctionProxy junction = request.create(ImogConjunctionProxy.class);
      List<ImogCriterionProxy> criterias = new ArrayList<ImogCriterionProxy>();

      ImogJunctionProxy disJunction = request.create(ImogDisjunctionProxy.class);
      List<ImogCriterionProxy> criterionList = new ArrayList<ImogCriterionProxy>();

      // Search field Designation
      BasicCriteriaProxy medicament_designationCrit = request.create(BasicCriteriaProxy.class);
      medicament_designationCrit.setField("medicament.designation");
      medicament_designationCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
      medicament_designationCrit.setValue(text);
      buffer.append(
          "("
              + NLS.constants().medicament_field_designation()
              + ": "
              + text
              + ") "
              + SYMBOL_OR
              + " ");
      criterionList.add(medicament_designationCrit);

      disJunction.setCriterions(criterionList);
      criterias.add(disJunction);
      fullTextSearch = true;

      if (ProfileUtil.isAdmin()) {
        BasicCriteriaProxy isDeletedCrit = request.create(BasicCriteriaProxy.class);
        isDeletedCrit.setField("deleted");
        isDeletedCrit.setOperation(CriteriaConstants.OPERATOR_ISNULL);
        isDeletedCrit.setValue(text);
        criterias.add(isDeletedCrit);
      }
      junction.setCriterions(criterias);

      // add FilterCriteria if exists
      if (isFiltered && filterCriteria != null)
        setSearchCriterions(mergeFilterCriteriaAndFullTextSearchCriterion(request, junction));
      else setSearchCriterions(junction);
    }
    if (fullTextSearch) {
      String message = buffer.toString();
      int lastSymbolIndex = message.lastIndexOf(SYMBOL_OR);
      return message.substring(0, lastSymbolIndex);
    } else return null;
  }
  /** Called by Dynatable */
  @Override
  public Request<List<PriseMedicamentRegimeProxy>> getList(
      String property, int start, int numRows, boolean asc) {

    PriseMedicamentRegimeRequest request = (PriseMedicamentRegimeRequest) getContext();
    Request<List<PriseMedicamentRegimeProxy>> result = null;

    if (isFiltered) {
      /* permanently filtered - hierarchical lists */
      if (filterCriteria != null) {

        if (searchCriterions != null)
          /* permanent filter added to search criterion */
          result =
              request.listPriseMedicamentRegime(start, numRows, property, asc, searchCriterions);
        else
          /* permanent filter only */
          result = request.listPriseMedicamentRegime(start, numRows, property, asc, filterCriteria);

      } else result = request.getPriseMedicamentRegimeEmptyList();
    } else {
      if (searchCriterions != null)
        result = request.listPriseMedicamentRegime(start, numRows, property, asc, searchCriterions);
      else result = request.listPriseMedicamentRegime(start, numRows, property, asc);
    }

    result.with("medicament");

    return result;
  }
  /** Called by Relation Boxes */
  @Override
  public Request<List<PriseMedicamentRegimeProxy>> getList(int start, int numRows) {

    PriseMedicamentRegimeRequest request = (PriseMedicamentRegimeRequest) getContext();
    Request<List<PriseMedicamentRegimeProxy>> result = null;

    if (isFiltered) {
      /* permanently filtered - hierarchical lists */
      if (filterCriteria != null) {

        if (searchCriterions != null) {
          /* permanent filter added to search criterion */
          if (nonAffected) {
            if (!searchInReverse)
              result =
                  request.listNonAffectedPriseMedicamentRegime(
                      start, numRows, "medicament", true, searchCriterions, property);
            else
              result =
                  request.listNonAffectedPriseMedicamentRegimeReverse(
                      start, numRows, "medicament", true, searchCriterions, property);
          } else
            result =
                request.listPriseMedicamentRegime(
                    start, numRows, "medicament", true, searchCriterions);
        } else {
          /* permanent filter only */
          if (nonAffected) {
            if (!searchInReverse)
              result =
                  request.listNonAffectedPriseMedicamentRegime(
                      start, numRows, "medicament", true, filterCriteria, property);
            else
              result =
                  request.listNonAffectedPriseMedicamentRegimeReverse(
                      start, numRows, "medicament", true, filterCriteria, property);
          } else
            result =
                request.listPriseMedicamentRegime(
                    start, numRows, "medicament", true, filterCriteria);
        }

      } else result = request.getPriseMedicamentRegimeEmptyList();
    } else {
      if (searchCriterions != null) {

        if (nonAffected) {
          if (!searchInReverse)
            result =
                request.listNonAffectedPriseMedicamentRegime(
                    start, numRows, "medicament", true, searchCriterions, property);
          else
            result =
                request.listNonAffectedPriseMedicamentRegimeReverse(
                    start, numRows, "medicament", true, searchCriterions, property);
        } else
          result =
              request.listPriseMedicamentRegime(
                  start, numRows, "medicament", true, searchCriterions);
      } else {

        if (nonAffected) {
          if (!searchInReverse)
            result =
                request.listNonAffectedPriseMedicamentRegime(
                    start, numRows, "medicament", true, property);
          else
            result =
                request.listNonAffectedPriseMedicamentRegimeReverse(
                    start, numRows, "medicament", true, property);
        } else result = request.listPriseMedicamentRegime(start, numRows, "medicament", true);
      }
    }

    if (isFiltered) {
      result.with("medicament");
    } else {
      result.with("medicament");
    }

    return result;
  }
  @Override
  public Request<Long> getTotalRowCount() {
    PriseMedicamentRegimeRequest request = (PriseMedicamentRegimeRequest) getContext();

    if (isFiltered) {
      /* permanently filtered - hierarchical lists */
      if (filterCriteria != null) {

        if (searchCriterions != null) {
          /* permanent filter added to search criterion */
          if (nonAffected) {
            if (!searchInReverse)
              return request.countNonAffectedPriseMedicamentRegime(property, searchCriterions);
            else
              return request.countNonAffectedPriseMedicamentRegimeReverse(
                  property, searchCriterions);
          } else return request.countPriseMedicamentRegime(searchCriterions);
        } else {
          /* permanent filter only */
          if (nonAffected) {
            if (!searchInReverse)
              return request.countNonAffectedPriseMedicamentRegime(property, filterCriteria);
            else
              return request.countNonAffectedPriseMedicamentRegimeReverse(property, filterCriteria);
          } else return request.countPriseMedicamentRegime(filterCriteria);
        }

      } else return request.countNonAffectedPriseMedicamentRegime("id");
    } else {

      if (searchCriterions != null) {
        if (nonAffected) {
          if (!searchInReverse)
            return request.countNonAffectedPriseMedicamentRegime(property, searchCriterions);
          else
            return request.countNonAffectedPriseMedicamentRegimeReverse(property, searchCriterions);
        } else return request.countPriseMedicamentRegime(searchCriterions);
      } else {

        if (nonAffected) {
          if (!searchInReverse) return request.countNonAffectedPriseMedicamentRegime(property);
          else return request.countNonAffectedPriseMedicamentRegimeReverse(property);
        } else return request.countPriseMedicamentRegime();
      }
    }
  }