public List<RedmineWiki> fetchAll(int connection) throws SQLException {
   List<RedmineWiki> item = dao.queryForEq(RedmineWiki.CONNECTION, connection);
   if (item == null) {
     item = new ArrayList<RedmineWiki>();
   }
   return item;
 }
  @DefaultHandler
  public Resolution defaultResolution() throws AjaxException {
    log.info("FiltersDataAction");
    try {
      conn = EntityManager.getConnection();
      Dao<Filter, String> dao = DaoManager.createDao(conn, Filter.class);

      String string =
          new ObjectMapper()
              .configure(Feature.DEFAULT_VIEW_INCLUSION, false)
              .writerWithView(JsonViews.Filters.class)
              .writeValueAsString(dao.queryForEq("views_id", getView().getId()));

      log.info(string);
      return new StreamingResolution("text/json", string);
    } catch (Exception e) {
      e.printStackTrace();
      getContext()
          .getValidationErrors()
          .add("entity", new SimpleError("unknown exception [" + e.getMessage() + "]"));
      throw new AjaxException(this, "filters", "data error");
    } finally {
      try {
        conn.close();
      } catch (SQLException e) {
      }
    }
  }
 /**
  * 查询没有上传成功的专辑集合
  *
  * @return
  */
 public ArrayList<DiggerAlbum> queryNotUpload() {
   List albums = new ArrayList();
   try {
     albums = mDiggerAlbumDao.queryForEq(COLUMN_IS_UPLOADED, "0");
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return new ArrayList<>(albums);
 }
 @Override
 public List<Movement> getAccountsDetails(Date startDate, Date endDate, Client client) {
   List<Movement> movements = new ArrayList<Movement>();
   try {
     List<OrmLiteMovement> localQuery = movementDao.queryForEq(OrmLiteMovement.CLIENT, client);
     for (OrmLiteMovement ormLiteMovement : localQuery) {
       movements.add(OrmLiteMovement.to(ormLiteMovement));
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     return movements;
   }
 }
 @Override
 public List<Movement> getMovements(Account account) {
   List<Movement> movements = new ArrayList<Movement>();
   try {
     List<OrmLiteMovement> localQuery =
         movementDao.queryForEq(OrmLiteMovement.ACCOUNT, account.getNumber());
     for (OrmLiteMovement ormLiteMovement : localQuery) {
       movements.add(OrmLiteMovement.to(ormLiteMovement));
     }
   } catch (Exception e) {
   } finally {
     return movements;
   }
 }
 public String getProviderForProject(String projectID) {
   String provider = null;
   try {
     Integer providerId =
         projectProviderMappingDao
             .queryForEq("projectID", Integer.parseInt(projectID))
             .get(0)
             .getProviderID();
     provider = ProviderDAOManager.getInstance().providerDao.queryForId(providerId).getName();
   } catch (NumberFormatException e) {
     logger.error("Error in finding provider for project :" + e.getMessage());
   } catch (SQLException e) {
     logger.error("Error in sql to finding provider for project :" + e.getMessage());
   }
   return provider;
 }
Example #7
-1
  public CarInfo query(int id) {
    try {
      List<CarInfo> list = carInfoDao.queryForEq("id", id);
      if (list != null && list.size() > 0) {
        return list.get(0);
      }
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return null;
  }