public class JobListRefiner
extends java.lang.Object
HttpServletRequest
.
Only the following HTTP-GET parameters will generate a job filter:
Note:Several PHASE
parameters
with different execution phases may be provided. Their
effect will be joint with a logical OR (so, all jobs of
one of the given phases will pass the filter).
Note: If several AFTER
parameters are provided, only the one with the most recent
date will be taken into account. For instance:
?AFTER=2015-01-01T12:00:00Z&AFTER=2014-01-01T12:00:00Z
will be interpreted as just 1 AFTER filter with the date
2015-01-01T12:00:00Z
.
Note: If several LAST
parameters are provided, only the smallest positive (and
not null) value will be taken into account.
IMPORTANT Note: If no PHASE filter is specified, a default one rejecting ARCHIVED filter is set by default. This is specified in UWS 1.1 standard so that being backward compatible with the version 1.0 of the standard in which no ARCHIVED phase existed.
Modifier and Type | Class and Description |
---|---|
static class |
JobListRefiner.JobComparator
Compare the 2 given
UWSJob instances by using only their creation
date/time. |
protected static class |
JobListRefiner.TopIterator
This iterator is designed to return just the N first items of the given
list.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.List<JobFilter> |
filters
List of all job filters to apply.
|
protected java.util.List<UWSJob> |
jobList
List of retained jobs after filtering.
|
protected boolean |
reverseOrder
Indicate if the jobs of the
jobList list must be returned from
the beginning to the end (false ) or from the end to the
beginning (true ). |
protected java.util.Comparator<UWSJob> |
sortComp
Indicate how jobs must be sorted in the
jobList list. |
protected int |
topSize
Indicate how many of the first jobs of the list
jobList must be
really retained. |
Modifier | Constructor and Description |
---|---|
protected |
JobListRefiner()
Empty constructor.
|
|
JobListRefiner(javax.servlet.http.HttpServletRequest request)
Build a filter for a whole list of jobs.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addJob(UWSJob job)
Add the given job in the temporary internal list of filtered jobs by
preserving the specified sorting.
|
protected boolean |
match(UWSJob job)
Tell whether the given job matches all the job filters.
|
java.util.Iterator<UWSJob> |
refine(java.util.Iterator<UWSJob> jobList)
Filter (and eventually sort and/or limit in size) the given list of jobs.
|
protected final java.util.List<JobFilter> filters
protected java.util.List<UWSJob> jobList
protected java.util.Comparator<UWSJob> sortComp
jobList
list.
Note: If NULL, jobs are merely added at the end of the list: no order.
protected int topSize
jobList
must be
really retained.
Note: If negative or null, all jobs are of the filtered list are returned.
protected boolean reverseOrder
jobList
list must be returned from
the beginning to the end (false
) or from the end to the
beginning (true
).
Note:
If topSize
have a positive and not null value, this attribute
will then apply on the topSize
first jobs: if false
jobs from 0 to topSize
are returned, otherwise they are
returned from topSize
to 0.
protected JobListRefiner()
refine(Iterator)
function will then be
allowed.public JobListRefiner(javax.servlet.http.HttpServletRequest request) throws UWSException
This filter will actually be composed of several Job filters, in function of the HTTP-GET parameters specified in the given HTTP request.
Only the following HTTP-GET parameters will generate a job filter:
Note:Several PHASE
parameters with different execution phases may be
provided. Their effect will be joint with a logical OR
(so, all jobs of one of the given phases will pass the
filter).
Note: If several AFTER
parameters are provided, only the one with the most
recent date will be taken into account. For instance:
?AFTER=2015-01-01T12:00:00Z&AFTER=2014-01-01T12:00:00Z
will be interpreted as just 1 AFTER filter with the
date 2015-01-01T12:00:00Z
.
Note: If several LAST
parameters are provided, only the smallest positive
(and not null) value will be taken into account.
IMPORTANT Note: If no PHASE filter is specified, a default one rejecting ARCHIVED filter is set by default. This is specified in UWS 1.1 standard so that being backward compatible with the version 1.0 of the standard in which no ARCHIVED phase existed.
request
- An HTTP request in which HTTP-GET parameters correspond
to Job filters to create.UWSException
- If the value of at least one AFTER, PHASE or LAST
parameter is incorrect.protected final void addJob(UWSJob job)
This function added the job at the end of the list IF no sort is required. Otherwise, a binary search is performed and the job is added at the right place in the list so that keeping the list sorted.
job
- The job to keep in the display-able job list.public java.util.Iterator<UWSJob> refine(java.util.Iterator<UWSJob> jobList)
jobList
- Job list to filter.protected final boolean match(UWSJob job)
In other words, this function operates a logical AND between all listed filters.
Note:
If the given job is NULL, false
will be returned.
In case of error while evaluating one of the filters on the given job,
false
will be returned as well.
job
- A job to filter.true
if the job matches all the filters,
false
otherwise.