public class JobList
extends java.lang.Object
implements java.io.Serializable
addJobSelectionCriteria() method.Job, 
Serialized Form| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | ALLDeprecated. 
 Use the selection constant that corresponds to the particular job selection criteria you are filtering.  For example, to select jobs for all job names, do:
      
     JobList list = new JobList(system);
     list.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, JobList.SELECTION_JOB_NAME_ALL);
     For backwards compatibility, this has the same effect:
     JobList list = new JobList(system);
     list.setName(JobList.SELECTION_JOB_NAME_ALL);
      | 
| static int | SELECTION_ACTIVE_JOB_STATUSSelection type used for job selection based on active job status. | 
| static int | SELECTION_INITIAL_USERSelection type used for job selection based on the user name for a job's initial thread. | 
| static int | SELECTION_JOB_NAMESelection type used for job selection based on job name. | 
| static java.lang.String | SELECTION_JOB_NAME_ALLSelection value indicating all jobs will be selected regardless of the job name. | 
| static java.lang.String | SELECTION_JOB_NAME_CURRENTSelection value indicating all jobs with the current job's name will be selected. | 
| static java.lang.String | SELECTION_JOB_NAME_ONLYSelection value indicating only the job in which this program is running will be selected. | 
| static int | SELECTION_JOB_NUMBERSelection type used for job selection based on job number. | 
| static java.lang.String | SELECTION_JOB_NUMBER_ALLSelection value indicating all jobs with the specified job name and user name will be selected, regardless of the job number. | 
| static int | SELECTION_JOB_QUEUESelection type used for job selection based on job queue. | 
| static int | SELECTION_JOB_QUEUE_STATUS_HELDSelection type used for job selection based on a job's status on the job queue. | 
| static int | SELECTION_JOB_QUEUE_STATUS_READYSelection type used for job selection based on a job's status on the job queue. | 
| static int | SELECTION_JOB_QUEUE_STATUS_SCHEDULESelection type used for job selection based on a job's status on the job queue. | 
| static int | SELECTION_JOB_TYPESelection type used for job selection based on job type. | 
| static java.lang.String | SELECTION_JOB_TYPE_ALLSelection value indicating all job types will be selected. | 
| static int | SELECTION_JOB_TYPE_ENHANCEDSelection type used for job selection based on the enhanced job type. | 
| static java.lang.Integer | SELECTION_JOB_TYPE_ENHANCED_ALL_BATCHSelection value indicating all the batch job types will be selected. | 
| static java.lang.Integer | SELECTION_JOB_TYPE_ENHANCED_ALL_INTERACTIVESelection value indicating all the interactive job types will be selected. | 
| static java.lang.Integer | SELECTION_JOB_TYPE_ENHANCED_ALL_PRESTARTSelection value indicating all the prestart job types will be selected. | 
| static int | SELECTION_PRIMARY_JOB_STATUS_ACTIVESelection type used for job selection based on primary job status. | 
| static int | SELECTION_PRIMARY_JOB_STATUS_JOBQSelection type used for job selection based on primary job status. | 
| static int | SELECTION_PRIMARY_JOB_STATUS_OUTQSelection type used for job selection based on primary job status. | 
| static int | SELECTION_SERVER_TYPESelection type used for job selection based on the server type. | 
| static java.lang.String | SELECTION_SERVER_TYPE_ALLSelection value indicating all jobs with a server type will be selected. | 
| static java.lang.String | SELECTION_SERVER_TYPE_BLANKSelection value indicating all jobs without a server type will be selected. | 
| static int | SELECTION_USER_NAMESelection type used for job selection based on user name. | 
| static java.lang.String | SELECTION_USER_NAME_ALLSelection value indicating all jobs that use the specified job name will be selected, regardless of the user name. | 
| static java.lang.String | SELECTION_USER_NAME_CURRENTSelection value indicating all jobs that use the current job's user profile will be selected. | 
| Constructor and Description | 
|---|
| JobList()Constructs a JobList object. | 
| JobList(AS400 system)Constructs a JobList object. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addJobAttributeToRetrieve(int attribute)Adds a job attribute that will be retrieved for each job in this job list. | 
| void | addJobAttributeToSortOn(int attribute,
                       boolean sortOrder)Adds a job attribute used to sort the list. | 
| void | addJobSelectionCriteria(int selectionType,
                       java.lang.Object selectionValue)Adds a selection type and value to be used to filter the list of jobs. | 
| void | addPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds a PropertyChangeListener. | 
| void | addVetoableChangeListener(java.beans.VetoableChangeListener listener)Adds a VetoableChangeListener. | 
| void | clearJobAttributesToRetrieve()Clears the job attributes to be retrieved. | 
| void | clearJobAttributesToSortOn()Clears the job attributes used to sort the list. | 
| void | clearJobSelectionCriteria()Clears the selection types and values used to filter the list of jobs. | 
| void | close()Closes the job list on the system. | 
| protected void | finalize()Closes the list on the system when this object is garbage collected. | 
| java.util.Enumeration | getJobs()Returns an Enumeration that wraps the list of jobs on the system. | 
| Job[] | getJobs(int listOffset,
       int number)Returns a subset of the list of jobs in the job list. | 
| int | getLength()Returns the number of jobs in the list. | 
| java.lang.String | getName()Returns the job name that describes which jobs are returned. | 
| java.lang.String | getNumber()Returns the job number that describes which jobs are returned. | 
| AS400 | getSystem()Returns the system object representing the system on which the jobs exist. | 
| java.lang.String | getUser()Returns the user name that describes which jobs are returned. | 
| void | load()Loads the list of jobs on the system. | 
| void | removePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes the PropertyChangeListener. | 
| void | removeVetoableChangeListener(java.beans.VetoableChangeListener listener)Removes the VetoableChangeListener. | 
| void | setName(java.lang.String name)Sets the job name that describes which jobs are returned. | 
| void | setNumber(java.lang.String number)Sets the job number that describes which jobs are returned. | 
| void | setSystem(AS400 system)Sets the system object representing the system on which the jobs exist. | 
| void | setUser(java.lang.String user)Sets the user name value that describes which jobs are returned. | 
public static final java.lang.String ALL
     JobList list = new JobList(system);
     list.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, JobList.SELECTION_JOB_NAME_ALL);
     
     For backwards compatibility, this has the same effect:
     
     JobList list = new JobList(system);
     list.setName(JobList.SELECTION_JOB_NAME_ALL);
     public static final int SELECTION_JOB_NAME
SELECTION_JOB_NAME_ALL
     SELECTION_JOB_NAME_CURRENT
     SELECTION_JOB_NAME_ONLY
     SELECTION_JOB_NAME_ALL.public static final java.lang.String SELECTION_JOB_NAME_ALL
SELECTION_JOB_NAME, 
Constant Field Valuespublic static final java.lang.String SELECTION_JOB_NAME_CURRENT
SELECTION_JOB_NAME, 
Constant Field Valuespublic static final java.lang.String SELECTION_JOB_NAME_ONLY
SELECTION_JOB_NAME, 
Constant Field Valuespublic static final int SELECTION_USER_NAME
SELECTION_USER_NAME_ALL
     SELECTION_USER_NAME_CURRENT
     SELECTION_USER_NAME_ALL.public static final java.lang.String SELECTION_USER_NAME_ALL
SELECTION_USER_NAME, 
Constant Field Valuespublic static final java.lang.String SELECTION_USER_NAME_CURRENT
SELECTION_USER_NAME, 
Constant Field Valuespublic static final int SELECTION_JOB_NUMBER
SELECTION_JOB_NUMBER_ALL
     SELECTION_JOB_NUMBER_ALL.public static final java.lang.String SELECTION_JOB_NUMBER_ALL
SELECTION_JOB_NUMBER, 
Constant Field Valuespublic static final int SELECTION_JOB_TYPE
SELECTION_JOB_TYPE_ALL
     SELECTION_JOB_TYPE_ALL.Job.JOB_TYPE, 
Constant Field Valuespublic static final java.lang.String SELECTION_JOB_TYPE_ALL
SELECTION_JOB_TYPE, 
Constant Field Valuespublic static final int SELECTION_PRIMARY_JOB_STATUS_ACTIVE
Job.JOB_STATUS, 
Constant Field Valuespublic static final int SELECTION_PRIMARY_JOB_STATUS_JOBQ
Job.JOB_STATUS, 
Constant Field Valuespublic static final int SELECTION_PRIMARY_JOB_STATUS_OUTQ
Job.JOB_STATUS, 
Constant Field Valuespublic static final int SELECTION_ACTIVE_JOB_STATUS
Job.ACTIVE_JOB_STATUS for allowed values.  By default no selection values are specified for this selection type.  This value is only used when the value for SELECTION_PRIMARY_JOB_STATUS_ACTIVE is true.public static final int SELECTION_JOB_QUEUE_STATUS_SCHEDULE
public static final int SELECTION_JOB_QUEUE_STATUS_HELD
public static final int SELECTION_JOB_QUEUE_STATUS_READY
public static final int SELECTION_JOB_QUEUE
public static final int SELECTION_INITIAL_USER
public static final int SELECTION_SERVER_TYPE
Job.SERVER_TYPE.
     SELECTION_SERVER_TYPE_ALL
     SELECTION_SERVER_TYPE_BLANK
     Job.SERVER_TYPE, 
Constant Field Valuespublic static final java.lang.String SELECTION_SERVER_TYPE_ALL
SELECTION_SERVER_TYPE, 
Constant Field Valuespublic static final java.lang.String SELECTION_SERVER_TYPE_BLANK
SELECTION_SERVER_TYPE, 
Constant Field Valuespublic static final int SELECTION_JOB_TYPE_ENHANCED
SELECTION_JOB_TYPE_ENHANCED_ALL_BATCH
     SELECTION_JOB_TYPE_ENHANCED_ALL_INTERACTIVE
     SELECTION_JOB_TYPE_ENHANCED_ALL_PRESTART
     Job.JOB_TYPE_ENHANCED_AUTOSTART
     Job.JOB_TYPE_ENHANCED_BATCH
     Job.JOB_TYPE_ENHANCED_BATCH_IMMEDIATE
     Job.JOB_TYPE_ENHANCED_BATCH_MRT
     Job.JOB_TYPE_ENHANCED_BATCH_ALTERNATE_SPOOL_USER
     Job.JOB_TYPE_ENHANCED_COMM_PROCEDURE_START_REQUEST
     Job.JOB_TYPE_ENHANCED_INTERACTIVE
     Job.JOB_TYPE_ENHANCED_INTERACTIVE_GROUP
     Job.JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ
     Job.JOB_TYPE_ENHANCED_INTERACTIVE_SYSREQ_AND_GROUP
     Job.JOB_TYPE_ENHANCED_PRESTART
     Job.JOB_TYPE_ENHANCED_PRESTART_BATCH
     Job.JOB_TYPE_ENHANCED_PRESTART_COMM
     Job.JOB_TYPE_ENHANCED_READER
     Job.JOB_TYPE_ENHANCED_SUBSYSTEM
     Job.JOB_TYPE_ENHANCED_SYSTEM
     Job.JOB_TYPE_ENHANCED_WRITER
     Job.JOB_TYPE_ENHANCED, 
Constant Field Valuespublic static final java.lang.Integer SELECTION_JOB_TYPE_ENHANCED_ALL_BATCH
public static final java.lang.Integer SELECTION_JOB_TYPE_ENHANCED_ALL_INTERACTIVE
public static final java.lang.Integer SELECTION_JOB_TYPE_ENHANCED_ALL_PRESTART
public JobList()
public JobList(AS400 system)
system - The system object representing the system on which the jobs exist.public void addJobAttributeToRetrieve(int attribute)
Job.getValue() does not result in another API call back to the system for each job in the list.
     The list of job attributes is maintained internally even when this JobList is closed and re-used.  To start over with a new set of job attributes to retrieve, call clearJobAttributesToRetrieve().
attribute - The job attribute to retrieve.  Possible values are all job attributes contained in the Job class, excluding the following:
     Job.resetStatistics() and Job.loadStatistics() methods.clearJobAttributesToRetrieve(), 
Jobpublic void addJobAttributeToSortOn(int attribute,
                           boolean sortOrder)
The list of job attributes to sort on is maintained internally even when this JobList is closed and re-used.  To start over with a new set of job attributes to sort on, call clearJobAttributesToSortOn().
attribute - The job attribute on which to sort.  Possible values are all job attributes contained in the Job class, excluding the following:
     sortOrder - true to sort ascending; false to sort descending.clearJobAttributesToSortOn(), 
Jobpublic void addJobSelectionCriteria(int selectionType,
                           java.lang.Object selectionValue)
                             throws java.beans.PropertyVetoException
By default, all jobs are selected, because most of the filter criteria settings default to true. To filter the list further, the job selection criteria should be set to false. For example, to retrieve a list of only active jobs, you would do:
     JobList list = new JobList(system);
     list.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE);
     list.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_JOBQ, Boolean.FALSE);
     list.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE);
     Enumeration jobs = list.getJobs();
     
     The list of job selection criteria is maintained internally even when this JobList is closed and re-used.  To start over with a new set of job selection criteria, call clearJobSelectionCriteria().
selectionType - The constant indicating which selection type used to filter the list.  Possible values are:
     SELECTION_JOB_NAME
     SELECTION_USER_NAME
     SELECTION_JOB_NUMBER
     SELECTION_JOB_TYPE
     SELECTION_PRIMARY_JOB_STATUS_ACTIVE
     SELECTION_PRIMARY_JOB_STATUS_JOBQ
     SELECTION_PRIMARY_JOB_STATUS_OUTQ
     SELECTION_ACTIVE_JOB_STATUS
     SELECTION_JOB_QUEUE_STATUS_SCHEDULE
     SELECTION_JOB_QUEUE_STATUS_READY
     SELECTION_JOB_QUEUE_STATUS_HELD
     SELECTION_JOB_QUEUE
     SELECTION_INITIAL_USER
     SELECTION_SERVER_TYPE
     SELECTION_JOB_TYPE_ENHANCED
     selectionValue - The value for the selection type. See the individual selection type constants for the appropriate object or constant to use. Some selection types allow multiple selection values to be added.java.beans.PropertyVetoException - If the recipient wishes the property change to be rolled back.clearJobSelectionCriteria(), 
Jobpublic void clearJobAttributesToRetrieve()
addJobAttributeToRetrieve(int)public void clearJobAttributesToSortOn()
public void clearJobSelectionCriteria()
                               throws java.beans.PropertyVetoException
java.beans.PropertyVetoException - If the recipient wishes the property change to be rolled back.addJobSelectionCriteria(int, java.lang.Object)public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The listener.removePropertyChangeListener(java.beans.PropertyChangeListener)public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener - The listener.removeVetoableChangeListener(java.beans.VetoableChangeListener)public void close()
           throws AS400SecurityException,
                  ErrorCompletingRequestException,
                  java.lang.InterruptedException,
                  java.io.IOException,
                  ObjectDoesNotExistException
AS400SecurityException - If a security or authority error occurs.ErrorCompletingRequestException - If an error occurs before the request is completed.java.lang.InterruptedException - If this thread is interrupted.java.io.IOException - If an error occurs while communicating with the system.ObjectDoesNotExistException - If the object does not exist on the system.load()protected void finalize()
                 throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic java.util.Enumeration getJobs()
                              throws AS400SecurityException,
                                     ErrorCompletingRequestException,
                                     java.lang.InterruptedException,
                                     java.io.IOException,
                                     ObjectDoesNotExistException
load() implicitly if needed.  The Enumeration retrieves jobs from the system in blocks as needed when nextElement() is called.  This JobList should not be closed until the program is done processing elements out of the Enumeration.  That is, this method does not retrieve all of the jobs from the system up front -- it retrieves them as needed, which allows for a lower memory footprint versus more calls to the system.  The block size used internally by the Enumeration is set to 1000 jobs.Job objects.AS400SecurityException - If a security or authority error occurs.ErrorCompletingRequestException - If an error occurs before the request is completed.java.lang.InterruptedException - If this thread is interrupted.java.io.IOException - If an error occurs while communicating with the system.ObjectDoesNotExistException - If the object does not exist on the system.Jobpublic Job[] getJobs(int listOffset, int number) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
load() is made (either implicitly or explicitly), then the jobs at a given list offset will change, so a subsequent call to getJobs() with the same listOffset and number will most likely not return the same Jobs as the previous call.listOffset - The offset in the list of jobs (0-based).  This value must be greater than or equal to 0 and less than the list length; or specify -1 to retrieve all of the jobs.
        Note: Prior to JTOpen 7.2, this parameter was incorrectly described.number - The number of jobs to retrieve out of the list, starting at the specified listOffset.  This value must be greater than or equal to 0 and less than or equal to the list length.  If the listOffset is -1, this parameter is ignored.Job objects.  The length of this array may not necessarily be equal to number, depending upon the size of the list on the system, and the specified listOffset.AS400Exception - If an error occurs.AS400SecurityException - If a security or authority error occurs.ErrorCompletingRequestException - If an error occurs before the request is completed.java.lang.InterruptedException - If this thread is interrupted.java.io.IOException - If an error occurs while communicating with the system.ObjectDoesNotExistException - If the object does not exist on the system.Jobpublic int getLength()
load() if it has not already been called.load()public java.lang.String getName()
setName(java.lang.String)public java.lang.String getNumber()
setNumber(java.lang.String)public AS400 getSystem()
public java.lang.String getUser()
setUser(java.lang.String)public void load()
          throws AS400SecurityException,
                 ErrorCompletingRequestException,
                 java.lang.InterruptedException,
                 java.io.IOException,
                 ObjectDoesNotExistException
getJobs() will retrieve the actual job information and attributes for each job in the list from the system.
     This method updates the list length.
AS400SecurityException - If a security or authority error occurs.ErrorCompletingRequestException - If an error occurs before the request is completed.java.lang.InterruptedException - If this thread is interrupted.java.io.IOException - If an error occurs while communicating with the system.ObjectDoesNotExistException - If the object does not exist on the system.getLength()public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The listener object.public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener - The listener object.public void setName(java.lang.String name)
             throws java.beans.PropertyVetoException
name - The job name, or SELECTION_JOB_NAME_ALL for all job names.java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.addJobSelectionCriteria(int, java.lang.Object), 
getName()public void setNumber(java.lang.String number)
               throws java.beans.PropertyVetoException
number - The job number, or SELECTION_JOB_NUMBER_ALL for all job numbers.java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.addJobSelectionCriteria(int, java.lang.Object), 
getNumber()public void setSystem(AS400 system) throws java.beans.PropertyVetoException
system - The system object representing the system on which the jobs exists.java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.public void setUser(java.lang.String user)
             throws java.beans.PropertyVetoException
user - The user name, or SELECTION_USER_NAME_ALL for all user names.java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.addJobSelectionCriteria(int, java.lang.Object), 
getUser()