org.apache.oodt.cas.workflow.lifecycle
Class WorkflowLifecycleManager

java.lang.Object
  extended by org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycleManager

public class WorkflowLifecycleManager
extends Object

Version:
$Revision$

A Manager interface for the WorkflowLifecycles used by the webapp to determine status for a WorkflowInstance.

.
Author:
mattmann

Constructor Summary
WorkflowLifecycleManager(String lifecyclesFilePath)
          Constructs a new WorkflowLifecycleManager with the WorkflowLifecycles identified in the provided file path.
 
Method Summary
static String formatPct(double pct)
          Formats a double percent number to a 2 decimal place String.
 WorkflowLifecycle getDefaultLifecycle()
           
 int getLastCompletedStageNum(WorkflowInstance inst)
          Gets the last completed stage for the given WorkflowInstance.
 WorkflowLifecycle getLifecycleForWorkflow(Workflow workflow)
          Gets the WorkflowLifecycle associated with the provided Workflow model.
 int getNumStages(Workflow workflow)
          Gets the total number of WorkflowLifecycleStages for the provided Workflow model.
 double getPercentageComplete(WorkflowInstance inst)
          Gets the percentage complete that this WorkflowInstance is based on its WorkflowLifecycle.
 WorkflowLifecycleStage getStage(WorkflowInstance inst)
          Gets the current WorkflowLifecycleStage for the provided WorkflowInstance based on its WorkflowInstance.getStatus() value.
 int getStageNum(WorkflowInstance inst)
          Gets the number of the current WorkflowLifecycleStage for the provided WorkflowInstance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkflowLifecycleManager

public WorkflowLifecycleManager(String lifecyclesFilePath)
                         throws InstantiationException
Constructs a new WorkflowLifecycleManager with the WorkflowLifecycles identified in the provided file path.

Parameters:
lifecyclesFilePath -
Throws:
InstantiationException
Method Detail

getStageNum

public int getStageNum(WorkflowInstance inst)
Gets the number of the current WorkflowLifecycleStage for the provided WorkflowInstance.

Parameters:
inst - The WorkflowInstance to get the current stage num for.
Returns:
The int number representing the current WorkflowLifecycleStage for the provided WorkflowInstance.

getNumStages

public int getNumStages(Workflow workflow)
Gets the total number of WorkflowLifecycleStages for the provided Workflow model.

Parameters:
workflow - The Workflow model to get the number of WorkflowLifecycleStages for. Only the identifier parameter from
Returns:
The total number of WorkflowLifecycleStages for the provided Workflow model.

getStage

public WorkflowLifecycleStage getStage(WorkflowInstance inst)
Gets the current WorkflowLifecycleStage for the provided WorkflowInstance based on its WorkflowInstance.getStatus() value.

Parameters:
inst - The WorkflowInstance to get the current stage for.
Returns:
The current WorkflowLifecycleStage for the provided WorkflowInstance based on its WorkflowInstance.getStatus() value.

getPercentageComplete

public double getPercentageComplete(WorkflowInstance inst)
Gets the percentage complete that this WorkflowInstance is based on its WorkflowLifecycle.

Parameters:
inst - The WorkflowInstance to get the completion percentage for.
Returns:
The double value representing the completion percentage for this WorkflowInstance.

formatPct

public static String formatPct(double pct)
Formats a double percent number to a 2 decimal place String.

Parameters:
pct - The double percent number to format.
Returns:
A String formatted 2 decimal place String.

getDefaultLifecycle

public WorkflowLifecycle getDefaultLifecycle()
Returns:
The default WorkflowLifecycle managed by this WorkflowLifecycleManager.

getLifecycleForWorkflow

public WorkflowLifecycle getLifecycleForWorkflow(Workflow workflow)
Gets the WorkflowLifecycle associated with the provided Workflow model.

Parameters:
workflow - The Workflow to obtain the WorkflowLifecycle for.
Returns:
The WorkflowLifecycle associated with the provided Workflow model.

getLastCompletedStageNum

public int getLastCompletedStageNum(WorkflowInstance inst)
Gets the last completed stage for the given WorkflowInstance.

Parameters:
inst - The WorkflowInstance to obtain the last completed stage number for.
Returns:
The last completed stage for the given WorkflowInstance.


Copyright © 1999-2011 Apache OODT. All Rights Reserved.