Package com.logicaldoc.core.ticket

# Interface TicketDAO

All Superinterfaces:
  `PersistentObjectDAO<Ticket>`

All Known Implementing Classes:
  `HibernateTicketDAO`

public interface TicketDAO extends PersistentObjectDAO<Ticket>
DAO for `Ticket`s handling.

Author:
  Michael Scholz, Marco Meschieri

## Field Summary

### Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO

`ENTITY`

## Method Summary

Modifier and Type
Method
Description
`long`
`countViewOrDownloadTickets(Long tenantId)`
Counts the DOWNLOAD or VIEW tickets
`boolean`
`deleteByDocId(long docId)`
This method deletes all tickets of the specified document.
`boolean`
`deleteByTicketId(String ticketId)`
This method deletes a download ticket.
`void`
`deleteExpired()`
Deletes all expired tickets
`Ticket`
`findByTicketId(String ticketId)`
This finds a ticket by its identifier and runs the validation
`static TicketDAO`
`get()`
Gets the object available in the application context
`void`
`store(Ticket ticket, DocumentHistory transaction)`
This method persists the download ticket object and insert a new document history entry

### Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO

`bulkUpdate, count, count, count, delete, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, initialize, isMariaDB, isMySQL, isOracle, isPostgreSQL, isSQLServer, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, store`

## Method Details

### get

static TicketDAO get()
Gets the object available in the application context

Returns:
  the instance of this object in the application context

### deleteByTicketId

boolean deleteByTicketId(String ticketId)
This method deletes a download ticket.

Parameters:
  `ticketId` - ID of the ticket which should be delete.
Returns:
  if the tickets have been deleted

### deleteByDocId

boolean deleteByDocId(long docId)
This method deletes all tickets of the specified document.

Parameters:
  `docId` - ID of the document
Returns:
  if the ticket has been deleted

### deleteExpired

void deleteExpired()
Deletes all expired tickets

### findByTicketId

Ticket findByTicketId(String ticketId) throws PersistenceException
This finds a ticket by its identifier and runs the validation

Parameters:
  `ticketId` - The ticket id
Returns:
  Ticket with given ticket id
Throws:
  `PersistenceException` - error at database level

### store

void store(Ticket ticket, DocumentHistory transaction) throws PersistenceException
This method persists the download ticket object and insert a new document history entry

Parameters:
  `ticket` - the ticket to store
  `transaction` - entry to log the event
Throws:
  `PersistenceException` - error at database level

### countViewOrDownloadTickets

long countViewOrDownloadTickets(Long tenantId) throws PersistenceException
Counts the DOWNLOAD or VIEW tickets

Parameters:
  `tenantId` - optional tenant specification
Returns:
  Total count
Throws:
  `PersistenceException` - error in the database