@Override public List<Localisation> findLocalisationByCriteres( LocalisationFormFilter localisationFormFilter) { try { String query = null; if (localisationFormFilter.getdT().equalsIgnoreCase(TableConfig.DTYPE_LOCALITE)) { query = " SELECT l FROM ObjetLocalite l where l.nomLocalisable LIKE '%" + localisationFormFilter.getNom() + "%'"; query += " AND l.description LIKE '%" + localisationFormFilter.getDescription() + "%'"; if (!localisationFormFilter.getType().equalsIgnoreCase("ALL")) { query += " AND l.type = '" + localisationFormFilter.getType() + "'"; } log.info("=======> " + query); } if (localisationFormFilter.getdT().equalsIgnoreCase(TableConfig.DTYPE_INCIDENT)) { query = " SELECT l FROM ObjetIncident l where l.nomLocalisable LIKE '%" + localisationFormFilter.getNom() + "%'"; query += " AND l.description LIKE '%" + localisationFormFilter.getDescription() + "%'"; if (!localisationFormFilter.getType().equalsIgnoreCase("ALL")) { query += " AND l.type = '" + localisationFormFilter.getType() + "'"; } log.info("=======> " + query); } return em.createQuery(query).getResultList(); } catch (Exception e) { return new ArrayList<Localisation>(); } }
@Override public List<BatimentLocalite> findLocaliteByCriteres( LocalisationFormFilter localisationFormFilter) { try { String query = " SELECT l FROM ObjetLocalite l where l.nomLocalisable LIKE '%" + localisationFormFilter.getNom() + "%'"; query += " AND l.description LIKE '%" + localisationFormFilter.getDescription() + "%'"; if (!localisationFormFilter.getType().equalsIgnoreCase("ALL")) { query += " AND l.type = '" + localisationFormFilter.getType() + "'"; } log.info("=======> " + query); return em.createQuery(query).getResultList(); } catch (Exception e) { return new ArrayList<BatimentLocalite>(); } }