Exemplo n.º 1
0
  /**
   * @param taxon
   * @return
   */
  private RecordSet createColObjRSFromTaxon(final Taxon taxonObj) {
    RecordSet recordSet = new RecordSet();
    recordSet.initialize();
    recordSet.set("TTV", CollectionObject.getClassTableId(), RecordSet.GLOBAL);

    fillRecordSet(taxonObj, recordSet);

    return recordSet;
  }
Exemplo n.º 2
0
  /**
   * Get all the CollectionObjectIDs that that use this Taxon as the Current determination and put
   * them into the RecordSet.
   *
   * @param taxon the Taxon
   * @param recordSet the RecordSet to be filled.
   */
  protected void fillRecordSet(final Taxon taxon, final RecordSet recordSet) {
    // The old way using Hibernate relationships was too slow,
    // so instead I am using straight SQL it is a lot faster.
    String sql =
        "SELECT DISTINCT co.CollectionObjectID FROM taxon as tx INNER JOIN determination as dt ON tx.TaxonID = "
            + (taxon.getIsAccepted() ? "dt.PreferredTaxonID " : "dt.TaxonID ")
            + "INNER JOIN collectionobject as co ON dt.CollectionObjectID = co.CollectionObjectID "
            + "WHERE tx.TaxonID = "
            + taxon.getId()
            + " AND co.CollectionMemberID = COLMEMID";

    Vector<Integer> list = new Vector<Integer>();

    fillListWithIds(sql, list);

    for (Integer id : list) {
      recordSet.addItem(id);
    }
  }