Style Intelligence v12.0

inetsoft.sree.schedule
Class ScheduleTask

java.lang.Object
  extended by inetsoft.sree.schedule.ScheduleTask
All Implemented Interfaces:
Serializable, Cloneable

public class ScheduleTask
extends Object
implements Serializable, Cloneable

ScheduleTask defines a scheduled task. Each task is consisted of one or more conditions, and one or more actions. The conditions are checked to see when and whehter a task will be started. When any condition is met, the task actions are executed in order. If a task is a repeated task, it will be rescheduled to run at the next cycle.

See Also:
Serialized Form

Constructor Summary
ScheduleTask(String name)
          Create a ScheduleTask.
 
Method Summary
 void addAction(ScheduleAction action)
          Add an action to the task.
 void addCondition(ScheduleCondition cond)
          Add a condition to the task.
 void cancel()
          Cancel the task.
 boolean check(long time)
          A task is complete when any its conditions are met.
 Object clone()
          Clone the object.
 void copyTo(ScheduleTask task)
          Copy to another task.
 boolean equals(Object val)
          Two tasks are equal if they have same names.
 ScheduleAction getAction(int idx)
          Get the specified action.
 int getActionCount()
          Get the number of actions.
 ScheduleCondition getCondition(int idx)
          Get the specified condition.
 int getConditionCount()
          Get the number of conditions.
 inetsoft.sree.internal.DataCycleManager.CycleInfo getCycleInfo()
          Get the cycle info.
 Enumeration getDependency()
          Get the dependency list.
 String getDescription()
          Get the task description.
 Date getEndDate()
          Get the stop date of this task.
 inetsoft.uql.util.Identity getIdentity()
          Get the identity to run this task.
 String getLocale()
          Get the locale used by this task.
 String getName()
          Get the task name.
 String getOwner()
          Get the owner name of this task.
 long getRetryTime(long time)
          Get the time to run the task.
 Date getStartDate()
          Get the start date of this task.
 String getUser()
          Deprecated.  
 boolean isDeleteIfNoMoreRun()
          Check if the task should be deleted if not scheduled tom run again.
 boolean isEditable()
          Check if this task is editable.
 boolean isEnabled()
          Check if this task is currently enabled.
 boolean isRemovable()
          Check if the task is removable.
 boolean isRunning()
          Determines if this task is currently running.
 void removeAction(int idx)
          Remove the specified action.
 void removeCondition(int idx)
          Remove the specified condition from the task.
 void run(Principal principal)
          Run the actions in this task.
 void setAction(int idx, ScheduleAction action)
          Set the specified action.
 void setComplete(String taskname, boolean complete)
          Set the complete condition status.
 void setCondition(int idx, ScheduleCondition cond)
          Set a condition.
 void setCycleInfo(inetsoft.sree.internal.DataCycleManager.CycleInfo cycleInfo)
          Set the cycle info.
 void setDeleteIfNoMoreRun(boolean delNotRun)
          Set the delete if not scheduled tom run again option.
 void setDescription(String description)
          Set the task description.
 void setEditable(boolean editable)
          Makes the task editable or uneditable.
 void setEnabled(boolean enabled)
          Enables or disables this task.
 void setEndDate(Date endDate)
          Set the stop date of this task.
 void setIdentity(inetsoft.uql.util.Identity identity)
          Set the identity(user, group) to run this task.
 void setLocale(String locale)
          Set the locale to be used by this task.
 void setName(String name)
          Set the task name.
 void setOwner(String owner)
          Set the owner of this task.
 void setRemovable(boolean removable)
          Set the removable option.
 void setStartDate(Date startDate)
          Set the start date of this task.
 void setUser(String user)
          Deprecated.  
 String toString()
          Get the string representation.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScheduleTask

public ScheduleTask(String name)
Create a ScheduleTask.

Parameters:
name - task name. It should be unique in each scheduler.
Method Detail

getName

public String getName()
Get the task name.


setName

public void setName(String name)
Set the task name.


isEnabled

public boolean isEnabled()
Check if this task is currently enabled.

Returns:
true if this task is enabled.

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this task.

Parameters:
enabled - true to enable and false to disable.

isEditable

public boolean isEditable()
Check if this task is editable.

Returns:
true if this task is editable.

setEditable

public void setEditable(boolean editable)
Makes the task editable or uneditable.

Parameters:
editable - true for editable and false for uneditable.

isRemovable

public boolean isRemovable()
Check if the task is removable.


setRemovable

public void setRemovable(boolean removable)
Set the removable option.


isDeleteIfNoMoreRun

public boolean isDeleteIfNoMoreRun()
Check if the task should be deleted if not scheduled tom run again.


setDeleteIfNoMoreRun

public void setDeleteIfNoMoreRun(boolean delNotRun)
Set the delete if not scheduled tom run again option.


check

public boolean check(long time)
A task is complete when any its conditions are met. Check all conditions of this task to see if any condition is met. The relationship between multiple conditions is a logical OR so the method returns true at the first occurrence of a fulfilled condition.

Parameters:
time - current time.
Returns:
true if any condition is met.

getRetryTime

public long getRetryTime(long time)
Get the time to run the task. Multiple conditions are Ored together. The earliest condition will trigger the task. The task may not run at this time because of other conditions. For example, if a task is repeatitive and is long running in. Second schedule will not run if the first invocation is still running.

Parameters:
time - current time.
Returns:
time to retry the conditions.

addCondition

public void addCondition(ScheduleCondition cond)
Add a condition to the task. This will add the condition to the internal Vectors that keep track of conditions associated with a task

Parameters:
cond - The ScheduleCondition we are adding.

addAction

public void addAction(ScheduleAction action)
Add an action to the task.


getConditionCount

public int getConditionCount()
Get the number of conditions.


getCondition

public ScheduleCondition getCondition(int idx)
Get the specified condition.

Parameters:
idx - condition index.

setCondition

public void setCondition(int idx,
                         ScheduleCondition cond)
Set a condition.

Parameters:
idx - condition index.
cond - new condition.

removeCondition

public void removeCondition(int idx)
Remove the specified condition from the task.


getActionCount

public int getActionCount()
Get the number of actions.


getAction

public ScheduleAction getAction(int idx)
Get the specified action.

Parameters:
idx - action index.
Returns:
schedule action.

setAction

public void setAction(int idx,
                      ScheduleAction action)
Set the specified action.

Parameters:
idx - action index.
action - new action.

removeAction

public void removeAction(int idx)
Remove the specified action.


setComplete

public void setComplete(String taskname,
                        boolean complete)
Set the complete condition status.


getDependency

public Enumeration getDependency()
Get the dependency list.


isRunning

public boolean isRunning()
Determines if this task is currently running.

Returns:
true if this task is running.

run

public void run(Principal principal)
         throws Throwable
Run the actions in this task.

Parameters:
principal - represents an entity.
Throws:
Throwable

toString

public String toString()
Get the string representation.

Overrides:
toString in class Object

setOwner

public void setOwner(String owner)
Set the owner of this task.


getOwner

public String getOwner()
Get the owner name of this task.

Returns:
the owner of this task, it may be null.

setStartDate

public void setStartDate(Date startDate)
Set the start date of this task.

Parameters:
startDate - the start date of this task.

getStartDate

public Date getStartDate()
Get the start date of this task.

Returns:
the start date of this task.

setEndDate

public void setEndDate(Date endDate)
Set the stop date of this task.

Parameters:
endDate - the stop date of this task.

getEndDate

public Date getEndDate()
Get the stop date of this task.

Returns:
the stop date of this task.

getLocale

public String getLocale()
Get the locale used by this task.

Returns:
Locale used by this task.

setLocale

public void setLocale(String locale)
Set the locale to be used by this task.

Parameters:
locale - to be used by this task.

getUser

public String getUser()
Deprecated. 

Get the user to run this task.

Returns:
the user to run this task.

setUser

public void setUser(String user)
Deprecated. 

Set the user to run this task.

Parameters:
user - the user to run this task.

getIdentity

public inetsoft.uql.util.Identity getIdentity()
Get the identity to run this task.

Returns:
the identity to run this task.

setIdentity

public void setIdentity(inetsoft.uql.util.Identity identity)
Set the identity(user, group) to run this task.

Parameters:
identity - the identity to run this task.

getDescription

public String getDescription()
Get the task description.

Returns:
the description of this task.

setDescription

public void setDescription(String description)
Set the task description.

Parameters:
description - the description.

setCycleInfo

public void setCycleInfo(inetsoft.sree.internal.DataCycleManager.CycleInfo cycleInfo)
Set the cycle info.


getCycleInfo

public inetsoft.sree.internal.DataCycleManager.CycleInfo getCycleInfo()
Get the cycle info.


equals

public boolean equals(Object val)
Two tasks are equal if they have same names.

Overrides:
equals in class Object

clone

public Object clone()
Clone the object.

Overrides:
clone in class Object

copyTo

public void copyTo(ScheduleTask task)
Copy to another task.


cancel

public void cancel()
Cancel the task.


Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.