@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; }
@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(); SortieLotRequest request = (SortieLotRequest) 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 Numero BasicCriteriaProxy lot_numeroCrit = request.create(BasicCriteriaProxy.class); lot_numeroCrit.setField("lot.numero"); lot_numeroCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS); lot_numeroCrit.setValue(text); buffer.append( "(" + NLS.constants().lot_field_numero() + ": " + text + ") " + SYMBOL_OR + " "); criterionList.add(lot_numeroCrit); // Search field Identifiant BasicCriteriaProxy lot_intrant_identifiantCrit = request.create(BasicCriteriaProxy.class); lot_intrant_identifiantCrit.setField("lot.intrant.identifiant"); lot_intrant_identifiantCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS); lot_intrant_identifiantCrit.setValue(text); buffer.append( "(" + NLS.constants().intrant_field_identifiant() + ": " + text + ") " + SYMBOL_OR + " "); criterionList.add(lot_intrant_identifiantCrit); // Search field Designation BasicCriteriaProxy lot_medicament_designationCrit = request.create(BasicCriteriaProxy.class); lot_medicament_designationCrit.setField("lot.medicament.designation"); lot_medicament_designationCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS); lot_medicament_designationCrit.setValue(text); buffer.append( "(" + NLS.constants().medicament_field_designation() + ": " + text + ") " + SYMBOL_OR + " "); criterionList.add(lot_medicament_designationCrit); // Search field Quantite try { Integer.valueOf(text); BasicCriteriaProxy lot_quantiteCrit = request.create(BasicCriteriaProxy.class); lot_quantiteCrit.setField("lot.quantite"); lot_quantiteCrit.setOperation(CriteriaConstants.INT_OPERATOR_EQUAL); lot_quantiteCrit.setValue(text); buffer.append( "(" + NLS.constants().lot_field_quantite() + ": " + text + ") " + SYMBOL_OR + " "); criterionList.add(lot_quantiteCrit); } catch (Exception ex) { /*criteria not added*/ } // Search field Quantite try { Integer.valueOf(text); BasicCriteriaProxy quantiteCrit = request.create(BasicCriteriaProxy.class); quantiteCrit.setField("quantite"); quantiteCrit.setOperation(CriteriaConstants.INT_OPERATOR_EQUAL); quantiteCrit.setValue(text); buffer.append( "(" + NLS.constants().sortieLot_field_quantite() + ": " + text + ") " + SYMBOL_OR + " "); criterionList.add(quantiteCrit); } catch (Exception ex) { /*criteria not added*/ } 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; }