Class PrintJobDao


  • public class PrintJobDao
    extends java.lang.Object
    JobEntryDao.
    • Constructor Detail

      • PrintJobDao

        public PrintJobDao()
    • 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 id
        lock - 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 id
        property - 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
      • 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 time
        checkTimeThreshold - threshold for last check time
        message - the error message
      • updateLastCheckTime

        public final void updateLastCheckTime​(java.lang.String id,
                                              long lastCheckTime)
        Update the lastCheckTime of the given record.
        Parameters:
        id - the id
        lastCheckTime - 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.