private void populateAllergenQmb(String value) throws DomainInterfaceException { form.qmbAllergy().clear(); AllergenVoCollection listAllergen = domain.listAllergens(value,getAllergensAddedToIgnore()); if (listAllergen == null || listAllergen.size() == 0) { form.qmbAllergy().showOpened(); return; } for (int i = 0 ; i < listAllergen.size() ; i++) { form.qmbAllergy().newRow(listAllergen.get(i), listAllergen.get(i).getAllergenName()); } form.qmbAllergy().showOpened(); }
private AllergenVoCollection getUsedAllergens() { AllergenVoCollection usedAllergens = new AllergenVoCollection(); for (int i = 0; i < form.grdAlergies().getRows().size(); i++) { usedAllergens.add((AllergenVo) form.grdAlergies().getRows().get(i).getAllergy().getValue()); } if (usedAllergens.size() > 0) { return usedAllergens; } else { return null; } }
public AllergenVoCollection listActiveAllergies(String filter) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from "); hql.append("Allergen x "); hql.append(" join x.keywords as kw"); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" where x.isActive = :isActive"); names.add("isActive"); values.add(Boolean.TRUE); List resultsList = Keywords.searchByKeywords(factory, filter, hql.toString(), names, values); if (resultsList.size() > 0) return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(resultsList).sort(); else return null; }
@SuppressWarnings("unchecked") public AllergenVoCollection getAllergies(String text) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from "); hql.append("Allergen x "); hql.append(" join x.keywords as kw"); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" where x.isActive = :isActive"); names.add("isActive"); values.add(Boolean.TRUE); List resultsList = Keywords.searchByKeywords(factory, text, hql.toString(), names, values); if (resultsList.size() > 0) return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(resultsList).sort(); else return null; }
public AllergenVoCollection listAllergens(String strAllergen) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from Allergen a join a.keywords as kw "); ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" where a.isActive = :isActive"); names.add("isActive"); values.add(Boolean.TRUE); return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(Keywords.searchByKeywords(factory, strAllergen, hql.toString(), names, values)); }
/** * @param szSearchCriteria */ private void listAllergies(String szSearchCriteria) { form.grdAllergen().getRows().clear(); clearInstanceControls(); AllergenVoCollection rcColl; try { rcColl = domain.listAllAllergen(szSearchCriteria); } catch (DomainInterfaceException e) { engine.showMessage(e.getMessage()); return; } if (rcColl.size() == 0) { engine.showMessage("No matching Allergies found"); return; } for (int i = 0; i< rcColl.size(); i++) { newInstanceRow(rcColl.get(i)); } if (rcColl.size() == 1) { form.grdAllergen().setValue(rcColl.get(0)); onGrdAllergenSelectionChanged(); } }
protected void onAllergyGridComboBoxTextSubmited(int column, grdAlergiesRow row, String text) throws PresentationLogicException { if(text.replaceAll("[^a-zA-Z0-9% ]", "").length() == 0) { engine.showMessage("Please remove the non-alphanumeric character from your search text"); return; } row.getAllergy().clear(); AllergenVoCollection allergens; try { allergens = domain.getAllergies(text); AllergenVoCollection temp = new AllergenVoCollection(); AllergenVoCollection usedAllergens = getUsedAllergens(); if (usedAllergens != null) { int alSize = allergens.size(); for (int i = 0; i < alSize; i++) { if (!(usedAllergens.contains(allergens.get(i)))) { temp.add(allergens.get(i)); } } } else temp = allergens; if (temp != null) { for (int i = 0; i < temp.size(); i++) { row.getAllergy().newRow(temp.get(i), temp.get(i).getAllergenName()); } row.showOpened(column); return; } engine.showMessage("No data found for search value " + text); row.getAllergy().setEditedText(""); } catch (DomainInterfaceException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public AllergenVoCollection listAllergens(String filter,String ignored) throws DomainInterfaceException { if(filter == null) return null; filter = filter.trim().toUpperCase(); if(filter == null || filter.length() == 0) return null; DomainFactory factory = getDomainFactory(); Connection conection = factory.getJdbcConnection(); StringBuffer sql = new StringBuffer(); sql.append("select a.id, a.allergenna, type.id , type.text from core_allergen a LEFT OUTER JOIN core_allergen_keywords k ON a.id = k.id LEFT OUTER JOIN applookup_instance type ON a.lkp_allergenty = type.id where (k.keyword like ? or a.allergenna like ?) and a.isactive = 1 "); if (ignored != null && ignored.trim().length() > 0) { sql.append(" and a.id not in ("+ignored+")"); } sql.append(" order by upper(a.allergenna)"); AllergenVoCollection allergenColl = new AllergenVoCollection(); PreparedStatement ps; try { ps = conection.prepareCall(sql.toString()); ps.setString(1, filter + "%"); ps.setString(2, filter + "%"); ResultSet rs = ps.executeQuery(); while( rs.next() ) { AllergenVo vo = new AllergenVo(); vo.setID_Allergen(Integer.valueOf(rs.getString(1))); vo.setAllergenName(rs.getString(2)); vo.setAllergenType((rs.getString(3) != null && rs.getString(4) != null) ? new AllergenType(Integer.valueOf(rs.getString(3)), rs.getString(4), true) : null); allergenColl.add(vo); } } catch (SQLException e) { e.printStackTrace(); } return allergenColl; }
private AllergenVoCollection listAllergen(String filter, boolean activeOnly) throws DomainInterfaceException { return AllergenVoAssembler.createAllergenVoCollectionFromAllergen(listDomAllergen(filter, activeOnly)).sort(); }
public AllergenVoCollection listAllAllergen(String filter) throws DomainInterfaceException { return listAllergen(filter, false); }
public AllergenVoCollection listActiveAllergen(String filter) throws DomainInterfaceException { return listAllergen(filter, true); }