@Override
    public void run() {
      // Open connection with database
      JdbcDaoSupport jdbcDao = new JdbcDaoSupport();
      jdbcDao.getConnection();
      // Search results
      this.lstTaxonOccurence = new ArrayList<TaxonOccurrence>();
      if (SearchTaxonActivity.this.taxonManager != null) {
        Log.i(
            getResources().getString(R.string.app_name),
            "Search by: " + SearchTaxonActivity.this.criteria);

        if (SearchTaxonActivity.this.criteria.equalsIgnoreCase("Code")) {
          Log.i(getResources().getString(R.string.app_name), "Search by Code");
          lstTaxonOccurence =
              SearchTaxonActivity.this.taxonManager.findByCode(
                  SearchTaxonActivity.this.taxonomy, strSearch, 1000);
        } else if (SearchTaxonActivity.this.criteria.equalsIgnoreCase("SciName")) {
          Log.i(getResources().getString(R.string.app_name), "Search by Scientific name");
          lstTaxonOccurence =
              SearchTaxonActivity.this.taxonManager.findByScientificName(
                  SearchTaxonActivity.this.taxonomy, strSearch, 1000);
        } else if (SearchTaxonActivity.this.criteria.equalsIgnoreCase("VernacularName")) {
          Log.i(getResources().getString(R.string.app_name), "Search by VernacularName");
          lstTaxonOccurence =
              SearchTaxonActivity.this.taxonManager.findByVernacularName(
                  SearchTaxonActivity.this.taxonomy, strSearch, 1000);

        } else {
          Log.i(
              getResources().getString(R.string.app_name),
              "Undefined criteria is: " + SearchTaxonActivity.this.criteria);
        }
      } else {
        Log.i(getResources().getString(R.string.app_name), "Species Manager is NULL!");
      }

      // Close connection
      JdbcDaoSupport.close();
      handler.sendEmptyMessage(0);
    }
Ejemplo n.º 2
0
 @Autowired
 public void initDataSource(DataSource dataSource) {
   super.setDataSource(dataSource);
 }
Ejemplo n.º 3
0
 @Override
 protected void initDao() throws Exception {
   super.initDao();
   log.debug("statistics dao created");
 }