public class OpenListOfJobs extends java.lang.Object implements OpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
Example:
CommandConnection conn = CommandConnection.getConnection(...); OpenListOfJobsFormatOLJB0200 jobFormat = new OpenListOfJobsFormatOLJB0200(); // Use the OLJB0200 format to get key info back. int receiverSize = 100; // This should be large enough for the initial call. int numRecordsToReturn = 1; // Need to return at least one record to get the key definition back. int[] fieldsToReturn = new int[] { 1906 }; // Subsystem information. OpenListOfJobs jobList = new OpenListOfJobs(jobFormat, receiverSize, numRecordsToReturn, fieldsToReturn); OpenListOfJobsSelectionListener jobSelector = ...; // Define your own. Optional. jobList.setSelectionListener(jobSelector, OpenListOfJobs.SELECTION_OLJS0100); OpenListOfJobsSortListener jobSorter = ...; // Define your own. Optional. jobList.setSortListener(jobSorter); CommandResult result = conn.call(jobList); // Assuming it succeeded... OpenListOfJobsKeyField[] keyDefinitions = jobList.getKeyFields(); ListInformation listInfo = jobList.getListInformation(); byte[] requestHandle = listInfo.getRequestHandle(); int recordLength = listInfo.getRecordLength(); // Now, the list is building on the server. // Call GetListEntries once to wait for the list to finish building, for example. receiverSize = 100; // Should be good enough for the first call. numRecordsToReturn = 0; int startingRecord = -1; // Wait until whole list is built before returning. Optional. GetListEntries getJobs = new GetListEntries(receiverSize, requestHandle, recordLength, numRecordsToReturn, startingRecord, jobFormat); result = conn.call(getJobs); // Assuming it succeeded... listInfo = getJobs.getListInformation(); int totalRecords = listInfo.getTotalRecords(); // Now retrieve the job records in chunks of, for example, 300 at a time. numRecordsToReturn = 300; receiverSize = recordLength * numRecordsToReturn; startingRecord = 1; getJobs.setLengthOfReceiverVariable(receiverSize); getJobs.setNumberOfRecordsToReturn(numRecordsToReturn); getJobs.setStartingRecord(startingRecord); jobFormat.setKeyFields(keyDefinitions); OpenListOfJobsFormatOLJB0200Listener callback = ...; // Define your own. jobFormat.setListener(callback); // Ready to process. while (startingRecord <= totalRecords) { result = conn.call(getJobs); // Assuming it succeeded... listInfo = getJobs.getListInformation(); startingRecord += listInfo.getRecordsReturned(); getJobs.setStartingRecord(startingRecord); } // All done. CloseList close = new CloseList(requestHandle); result = conn.call(close); conn.close();
Modifier and Type | Field and Description |
---|---|
static int |
SELECTION_OLJS0100 |
static int |
SELECTION_OLJS0200 |
Constructor and Description |
---|
OpenListOfJobs() |
OpenListOfJobs(OpenListOfJobsFormat format,
int lengthOfReceiverVariable,
int numberOfRecordsToReturn,
int[] fieldsToReturn) |
Modifier and Type | Method and Description |
---|---|
long |
getElapsedTime() |
int[] |
getFieldsToReturn() |
OpenListOfJobsFormatListener |
getFormatListener()
The format listener gets called by the formatter once the output data has been formatted.
|
OpenListOfJobsFormat |
getFormatter()
The formatter is the class that handles formatting the output data for each entry in the list.
|
OpenListOfJobsKeyField[] |
getKeyFields() |
int |
getLengthOfReceiverVariable() |
ListInformation |
getListInformation() |
int |
getNumberOfParameters()
Returns the number of parameters for this program.
|
int |
getNumberOfRecordsToReturn() |
byte[] |
getParameterInputData(int parmIndex)
Returns the input data of the parameter at the specified index.
|
int |
getParameterInputLength(int parmIndex)
Returns the input length of the parameter at the specified index.
|
int |
getParameterOutputLength(int parmIndex)
Returns the output length of the parameter at the specified index.
|
int |
getParameterType(int parmIndex)
Returns the type of parameter at the specified index.
|
java.lang.String |
getProgramLibrary()
Returns the library of the program object.
|
java.lang.String |
getProgramName()
Returns the name of the program object.
|
boolean |
getResetStatusStatistics() |
OpenListOfJobsSelectionListener |
getSelectionListener() |
OpenListOfJobsSortListener |
getSortListener() |
byte[] |
getTempDataBuffer()
The implementor can create their own temp byte array for the output parameter size and reuse it each time a call is performed,
or for more than one parameter on the same call.
|
void |
newCall()
Invoked before any other methods on this interface by CommandConnection whenever this Program is called.
|
void |
setFieldsToReturn(int[] fieldsToReturn) |
void |
setFormatListener(OpenListOfJobsFormatListener listener) |
void |
setFormatter(OpenListOfJobsFormat formatter) |
void |
setLengthOfReceiverVariable(int length) |
void |
setNumberOfRecordsToReturn(int numberOfRecordsToReturn) |
void |
setParameterOutputData(int parmIndex,
byte[] data,
int maxLength)
Sets the output data for the parameter at the specified index.
|
void |
setResetStatusStatistics(boolean resetStatusStatistics) |
void |
setSelectionListener(OpenListOfJobsSelectionListener selectionListener,
int selectionFormat) |
void |
setSortListener(OpenListOfJobsSortListener sortListener) |
public static final int SELECTION_OLJS0100
public static final int SELECTION_OLJS0200
public OpenListOfJobs()
public OpenListOfJobs(OpenListOfJobsFormat format, int lengthOfReceiverVariable, int numberOfRecordsToReturn, int[] fieldsToReturn)
public final byte[] getTempDataBuffer()
Program
getTempDataBuffer
in interface Program
public OpenListOfJobsFormat getFormatter()
OpenListProgram
getFormatter
in interface OpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
public void setFormatter(OpenListOfJobsFormat formatter)
setFormatter
in interface OpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
public OpenListOfJobsFormatListener getFormatListener()
OpenListProgram
getFormatListener
in interface OpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
public void setFormatListener(OpenListOfJobsFormatListener listener)
setFormatListener
in interface OpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
public java.lang.String getProgramName()
Program
getProgramName
in interface Program
public java.lang.String getProgramLibrary()
Program
getProgramLibrary
in interface Program
public void newCall()
Program
public OpenListOfJobsKeyField[] getKeyFields()
public ListInformation getListInformation()
getListInformation
in interface OpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
public int getNumberOfParameters()
Program
getNumberOfParameters
in interface Program
public OpenListOfJobsSortListener getSortListener()
public void setSortListener(OpenListOfJobsSortListener sortListener)
public boolean getResetStatusStatistics()
public void setResetStatusStatistics(boolean resetStatusStatistics)
public long getElapsedTime()
public int getLengthOfReceiverVariable()
public void setLengthOfReceiverVariable(int length)
public int getNumberOfRecordsToReturn()
public void setNumberOfRecordsToReturn(int numberOfRecordsToReturn)
public int[] getFieldsToReturn()
public void setFieldsToReturn(int[] fieldsToReturn)
public OpenListOfJobsSelectionListener getSelectionListener()
public void setSelectionListener(OpenListOfJobsSelectionListener selectionListener, int selectionFormat)
public int getParameterInputLength(int parmIndex)
Program
getParameterInputLength
in interface Program
public int getParameterOutputLength(int parmIndex)
Program
getParameterOutputLength
in interface Program
public int getParameterType(int parmIndex)
Program
getParameterType
in interface Program
Parameter
public byte[] getParameterInputData(int parmIndex)
Program
getParameterInputData
in interface Program
public void setParameterOutputData(int parmIndex, byte[] data, int maxLength)
Program
setParameterOutputData
in interface Program