Class HarvestStatus
- java.lang.Object
-
- dk.netarkivet.harvester.webinterface.HarvestStatus
-
public class HarvestStatus extends Object
This page provides support for the HarvestStatus pages of the web interface.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
log
The logger to use.
-
Constructor Summary
Constructors Constructor Description HarvestStatus(long fullResultsCount, List<JobStatusInfo> jobs)
Constructor for the HarvestStatus class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getFullResultsCount()
List<JobStatusInfo>
getJobStatusInfo()
static HarvestStatus
getjobStatusList(HarvestStatusQuery query)
Calculate list of job information to be shown.static boolean
isNextLinkActive(long pageSize, long totalResultsCount, long endIndex)
Check if next link is active.static boolean
isPreviousLinkActive(long pageSize, long totalResultsCount, long startIndex)
Check if previous link is active.static String
makeHarvestRunLink(long harvestID, int harvestRun)
Create a link to the harvest-run page for a given run.static void
processRequest(javax.servlet.jsp.PageContext context, I18n i18n)
Process a request from Harveststatus-alljobs.static void
rejectFailedJob(javax.servlet.jsp.PageContext context, I18n i18n, Long jobID)
Marks a failed job as rejected for resubmission.static void
unrejectRejectedJob(javax.servlet.jsp.PageContext context, I18n i18n, Long jobID)
Marks as failed.
-
-
-
Constructor Detail
-
HarvestStatus
public HarvestStatus(long fullResultsCount, List<JobStatusInfo> jobs)
Constructor for the HarvestStatus class.- Parameters:
fullResultsCount
- The total number of entries in the full resultsetjobs
- The list of jobs
-
-
Method Detail
-
getFullResultsCount
public long getFullResultsCount()
- Returns:
- The total number in the full resultset
-
getJobStatusInfo
public List<JobStatusInfo> getJobStatusInfo()
- Returns:
- The list of jobs in this HarvestStatus object.
-
processRequest
public static void processRequest(javax.servlet.jsp.PageContext context, I18n i18n) throws ForwardedToErrorPage
Process a request from Harveststatus-alljobs.Will resubmit a job if requested, otherwise do nothing.
- Parameters:
context
- The web context used for processingi18n
- The resource i18n context.- Throws:
ForwardedToErrorPage
- If an error occurs that stops processing and forwards the user to an error page.
-
rejectFailedJob
public static void rejectFailedJob(javax.servlet.jsp.PageContext context, I18n i18n, Long jobID)
Marks a failed job as rejected for resubmission. Throws a ForwardedToErrorPage if jobID is null or if it refers to a job that is not in the state FAILED to start with.- Parameters:
context
- the context for forwarding errorsi18n
- the internationalisation to usejobID
- the job to reject
-
unrejectRejectedJob
public static void unrejectRejectedJob(javax.servlet.jsp.PageContext context, I18n i18n, Long jobID)
Marks as failed. Throws a ForwardedToErrorPage if the job is not in the state FAILED_REJECTED to start with.- Parameters:
context
- the context for forwarding errorsi18n
- the internationalisation to usejobID
- the job to unreject
-
makeHarvestRunLink
public static String makeHarvestRunLink(long harvestID, int harvestRun)
Create a link to the harvest-run page for a given run.- Parameters:
harvestID
- The ID of the harvestharvestRun
- The run # of the harvest (always 0 for snapshots)- Returns:
- A properly encoded HTML string with a link and the harvest run as the text. Select all jobs to be shown.
-
getjobStatusList
public static HarvestStatus getjobStatusList(HarvestStatusQuery query)
Calculate list of job information to be shown.- Parameters:
query
- the query with its filters.- Returns:
- a list of job status info objects
-
isNextLinkActive
public static boolean isNextLinkActive(long pageSize, long totalResultsCount, long endIndex)
Check if next link is active.- Parameters:
pageSize
- the size of the pagetotalResultsCount
- the number of results.endIndex
- the index of the last result shown on this page- Returns:
- true, if link to next page is active
-
isPreviousLinkActive
public static boolean isPreviousLinkActive(long pageSize, long totalResultsCount, long startIndex)
Check if previous link is active.- Parameters:
pageSize
- the size of the pagetotalResultsCount
- the number of results.startIndex
- the index of the first result shown on this page- Returns:
- true, if link to previous page is active
-
-