Class PrintJobDao
- java.lang.Object
-
- org.mapfish.print.servlet.job.impl.hibernate.PrintJobDao
-
public class PrintJobDao extends java.lang.Object
JobEntryDao.
-
-
Constructor Summary
Constructors Constructor Description PrintJobDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancelOld(long starttimeThreshold, long checkTimeThreshold, java.lang.String message)
Cancel old waiting jobs.long
count(PrintJobStatus.Status... statuses)
void
delete(java.lang.String referenceId)
Delete a record.int
deleteOld(long checkTimeThreshold)
Delete old jobs.PrintJobStatusExtImpl
get(java.lang.String id)
Get Job Record.PrintJobStatusExtImpl
get(java.lang.String id, boolean lock)
Get Job Record.java.util.List<PrintJobStatusExtImpl>
get(PrintJobStatus.Status... statuses)
PrintJobResultExtImpl
getResult(java.net.URI reportURI)
Get result report.long
getTotalTimeSpentPrinting()
java.lang.Object
getValue(java.lang.String id, java.lang.String property)
get specific property value of job.void
init()
Initialize db manager.java.util.List<PrintJobStatusExtImpl>
poll(int size)
Poll for the next N waiting jobs in line.void
save(PrintJobStatusExtImpl entry)
Save Job Record.void
updateLastCheckTime(java.lang.String id, long lastCheckTime)
Update the lastCheckTime of the given record.
-
-
-
Method Detail
-
init
@PostConstruct public final void init()
Initialize db manager.
-
save
public final void save(PrintJobStatusExtImpl entry)
Save Job Record.- Parameters:
entry
- the entry
-
get
@Nullable public final PrintJobStatusExtImpl get(java.lang.String id)
Get Job Record.- Parameters:
id
- the id- Returns:
- the job
-
get
@Nullable public final PrintJobStatusExtImpl get(java.lang.String id, boolean lock)
Get Job Record.- Parameters:
id
- the idlock
- whether record should be locked for transaction- Returns:
- the job status or null.
-
getValue
public final java.lang.Object getValue(java.lang.String id, java.lang.String property)
get specific property value of job.- Parameters:
id
- the idproperty
- the property name/path- Returns:
- the property value
-
count
public final long count(PrintJobStatus.Status... statuses)
- Parameters:
statuses
- the statuses to include (or none if all)- Returns:
- the total amount of jobs
-
get
public final java.util.List<PrintJobStatusExtImpl> get(PrintJobStatus.Status... statuses)
- Parameters:
statuses
- the statuses to include (or none if all)- Returns:
- the jobs
-
getTotalTimeSpentPrinting
public final long getTotalTimeSpentPrinting()
- Returns:
- total time spent printing
-
cancelOld
public final void cancelOld(long starttimeThreshold, long checkTimeThreshold, java.lang.String message)
Cancel old waiting jobs.- Parameters:
starttimeThreshold
- threshold for start timecheckTimeThreshold
- threshold for last check timemessage
- the error message
-
updateLastCheckTime
public final void updateLastCheckTime(java.lang.String id, long lastCheckTime)
Update the lastCheckTime of the given record.- Parameters:
id
- the idlastCheckTime
- the new value
-
deleteOld
public final int deleteOld(long checkTimeThreshold)
Delete old jobs.- Parameters:
checkTimeThreshold
- threshold for last check time- Returns:
- the number of jobs deleted
-
poll
public final java.util.List<PrintJobStatusExtImpl> poll(int size)
Poll for the next N waiting jobs in line.- Parameters:
size
- maximum amount of jobs to poll for- Returns:
- up to "size" jobs
-
getResult
public final PrintJobResultExtImpl getResult(java.net.URI reportURI)
Get result report.- Parameters:
reportURI
- the URI of the report- Returns:
- the result report.
-
delete
public void delete(java.lang.String referenceId)
Delete a record.- Parameters:
referenceId
- the reference ID.
-
-