class TicketAdminServiceImpl extends AbstractTicketService implements TicketAdminService {

	@Override
	public List<Ticket> listAllTicketsForGivenCollection(final String irodsAbsolutePath, final int partialStartIndex)
			throws FileNotFoundException, JargonException {

		log.info("listAllTicketsForGivenCollection()");

		if (irodsAbsolutePath == null || irodsAbsolutePath.isEmpty()) {
			throw new IllegalArgumentException("null or empty irodsAbsolutePath");
		}

		if (partialStartIndex < 0) {
			throw new IllegalArgumentException(PARTIAL_START_INDEX_MUST_BE_0);
		}

		log.info("irodsAbsolutePath:{}", irodsAbsolutePath);
		log.info("partialStartIndex:{}", partialStartIndex);

		log.info("getting objStat...");

		ObjStat objStat = irodsAccessObjectFactory.getCollectionAndDataObjectListAndSearchAO(getIrodsAccount())
				.retrieveObjectStatForPath(irodsAbsolutePath);

		if (!objStat.isSomeTypeOfCollection()) {
			log.error("ObjStat indicates that this is not some type of collection:{}", objStat);
			throw new JargonException("path is not a collection");
		}

		List<Ticket> tickets = new ArrayList<Ticket>();

		AbstractIRODSQueryResultSet resultSet = null;

		try {
			IRODSGenQueryBuilder builder = new IRODSGenQueryBuilder(true, null);
			addSelectsForTicketsCommonToQueryBuilder(builder);
			addQuerySelectsForListAllTicketsForCollections(builder);
			builder.addConditionAsGenQueryField(RodsGenQueryEnum.COL_TICKET_COLL_NAME, QueryConditionOperators.EQUAL,
					irodsAbsolutePath);

			IRODSGenQueryExecutor irodsGenQueryExecutor = irodsAccessObjectFactory
					.getIRODSGenQueryExecutor(irodsAccount);

			resultSet = irodsGenQueryExecutor.executeIRODSQueryAndCloseResult(
					builder.exportIRODSQueryFromBuilder(
							getIrodsAccessObjectFactory().getJargonProperties().getMaxFilesAndDirsQueryMax()),
					partialStartIndex);
			Ticket ticket = null;
			for (IRODSQueryResultRow row : resultSet.getResults()) {
				ticket = new Ticket();
				putResultDataIntoTicketCommonValues(ticket, row);
				ticket.setIrodsAbsolutePath(row.getColumn(13));
				// add info to track position in records for possible requery
				ticket.setLastResult(row.isLastResult());
				ticket.setCount(row.getRecordCount());
				log.info("adding ticket to results:{}", ticket);
				tickets.add(ticket);
			}

		} catch (JargonQueryException e) {
			log.error("query exception for ticket query", e);
			throw new JargonException(ERROR_IN_TICKET_QUERY, e);
		} catch (GenQueryBuilderException e) {
			log.error("query exception for ticket query", e);
			throw new JargonException(ERROR_IN_TICKET_QUERY, e);
		}

		return tickets;

	}

	  TicketAdminServiceImpl(final IRODSAccessObjectFactory irodsAccessObjectFactory, final IRODSAccount irodsAccount);

}