コード例 #1
0
 @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>();
   }
 }
コード例 #2
0
  @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>();
    }
  }