wt.scheduler
Class ScheduleItemUtil

java.lang.Object
  extended bywt.scheduler.ScheduleItemUtil

public class ScheduleItemUtil
extends Object


Field Summary
private  boolean bSchedHistory
           
private  int iTotalRecords
           
private  QueryResult queryResult
           
private  ScheduleHistory schedHistory
           
private  ScheduleItem schedItem
           
 
Constructor Summary
ScheduleItemUtil()
           
ScheduleItemUtil(boolean bSchedHist)
          This constructor is used to set the query so as to not return the schedule history result set.
 
Method Summary
 Timestamp computeStartDate(String sStartDate, String sStartTime, boolean bSchedule)
          Create start date timestamp.
 void deleteScheduledItem()
          Delete the scheduled item
 MethodArgument[] getArgs()
          This method retrieves all of the schedule method arguments for the current record.
 ScheduleHistory getHistoryRecord()
          This method gets the ScheduleHistory object for the current record.
 ScheduleItem getItemRecord()
          This method gets the ScheduleItem object for the current record.
static ScheduleHistory getLatestSchedHistory(ScheduleItem schedItem)
          Return the ScheduleHistory for the item
 int getTotalRecords()
          Return the total number of records retrieved by the query.
 boolean hasMoreElements()
          This method tests if there are any more records in the result set.
 boolean nextRecord()
          This method gets the next record in the result set an off loads the ScheduleItem and ScheduleHistory objects for that record.
 void querySchedItem(String sClassName, String sMethodName, Vector vArgs)
          This method will query the ScheduleItem table retrieving a result set.
 void resumeScheduledItem()
          Resume the scheduled item
 void setScheduleItem(ScheduleItem sItem)
          Set the schedItem member
 void suspendScheduledItem()
          Suspend the scheduled item
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schedItem

private ScheduleItem schedItem

schedHistory

private ScheduleHistory schedHistory

queryResult

private QueryResult queryResult

bSchedHistory

private boolean bSchedHistory

iTotalRecords

private int iTotalRecords
Constructor Detail

ScheduleItemUtil

public ScheduleItemUtil()

ScheduleItemUtil

public ScheduleItemUtil(boolean bSchedHist)
This constructor is used to set the query so as to not return the schedule history result set. ScheduleItemUtil schedIU = new ScheduleItemUtil(false);

Method Detail

querySchedItem

public void querySchedItem(String sClassName,
                           String sMethodName,
                           Vector vArgs)
                    throws QueryException,
                           WTException
This method will query the ScheduleItem table retrieving a result set. Where clauses will be constructed based on the target class name, target method and a list of object references for the persistant arguments. The result set will contain values for both the ScheduleItem table and the ScheduleHistory table. Below is a code segment that retrieves references to the object within the result set. ScheduleItem schedItem = null; ScheduleHistory schedHistory = null; Vector vArgs = new Vector(); vArgs.addElement(ObjRef); ScheduleItemUtil schedIU = new ScheduleItemUtil(); schedIU.querySchedItem( "wt.fv.local.StandardLocalService", "doContentReplication", vArgs ); if ( schedIU.hasMoreRecords() ) { schedIU.nextRecord(); schedItem = schedIU.getItemRecord(); schedHistory = schedIU.getHistoryRecord(); if (schedItem != null) { schedItem.getItemName(); } }

Parameters:
sClassName - A String which is the fully qualified class name.
sMethodName - A String which is the target method name.
Throws:
QueryException
WTException

hasMoreElements

public boolean hasMoreElements()
This method tests if there are any more records in the result set.


nextRecord

public boolean nextRecord()
This method gets the next record in the result set an off loads the ScheduleItem and ScheduleHistory objects for that record.


getHistoryRecord

public ScheduleHistory getHistoryRecord()
This method gets the ScheduleHistory object for the current record.


getItemRecord

public ScheduleItem getItemRecord()
This method gets the ScheduleItem object for the current record.


getArgs

public MethodArgument[] getArgs()
                         throws WTException
This method retrieves all of the schedule method arguments for the current record. Code example below: Vector vArgs = new Vector(); vArgs.addElement(ObjRef); ScheduleItemUtil schedIU = new ScheduleItemUtil(); schedIU.querySchedItem( "wt.fv.local.StandardLocalService", "doContentReplication", vArgs ); MethodArgument [] args = schedIU.getArgs(); if (args != null) { for( int i = 0; i < args.length; i++) { System.out.println("Arg object -> " + args[i].getArgType().toString()); } }

Throws:
WTException

computeStartDate

public Timestamp computeStartDate(String sStartDate,
                                  String sStartTime,
                                  boolean bSchedule)
                           throws ParseException
Create start date timestamp. Lifted from GenericSchedTimeFrame.

Throws:
ParseException

getTotalRecords

public int getTotalRecords()
Return the total number of records retrieved by the query.


setScheduleItem

public void setScheduleItem(ScheduleItem sItem)
Set the schedItem member


suspendScheduledItem

public void suspendScheduledItem()
                          throws WTException
Suspend the scheduled item

Throws:
WTException

resumeScheduledItem

public void resumeScheduledItem()
                         throws WTException
Resume the scheduled item

Throws:
WTException

deleteScheduledItem

public void deleteScheduledItem()
                         throws WTException
Delete the scheduled item

Throws:
WTException

getLatestSchedHistory

public static ScheduleHistory getLatestSchedHistory(ScheduleItem schedItem)
                                             throws WTException
Return the ScheduleHistory for the item

Throws:
WTException