/** * Returns the number of visits for the item. * Depending on the visitType it can either be item, bitstream, total, ... * * @param visitType the type of visits we want, from the item, bitstream, total * @param item the item from which we need our visits * @return the number of visits * @throws SolrServerException .... */ public long getNumberOfVisits(int visitType, Item item) throws SolrServerException { switch (visitType){ case ITEM_VISITS: return SolrLogger.queryTotal("type: " + Constants.ITEM + " AND id: " + item.getID(), resolveFilterQueries()).getCount(); case BITSTREAM_VISITS: return SolrLogger.queryTotal("type: " + Constants.BITSTREAM + " AND owningItem: " + item.getID(), resolveFilterQueries()).getCount(); case TOTAL_VISITS: return getNumberOfVisits(ITEM_VISITS, item) + getNumberOfVisits(BITSTREAM_VISITS, item); } return -1; }
/** * Returns the number of visits for the item. * Depending on the visitType it can either be item, bitstream, total, ... * * @param visitType the type of visits we want, from the item, bitstream, total * @param item the item from which we need our visits * @return the number of visits * @throws SolrServerException Exception from the Solr server to the solrj Java client. */ public long getNumberOfVisits(int visitType, Item item) throws SolrServerException { switch (visitType) { case ITEM_VISITS: return solrLoggerService .queryTotal("type: " + Constants.ITEM + " AND id: " + item.getID(), resolveFilterQueries()) .getCount(); case BITSTREAM_VISITS: return solrLoggerService.queryTotal("type: " + Constants.BITSTREAM + " AND owningItem: " + item.getID(), resolveFilterQueries()).getCount(); case TOTAL_VISITS: return getNumberOfVisits(ITEM_VISITS, item) + getNumberOfVisits(BITSTREAM_VISITS, item); default: return -1; } }