Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.jharks.workflow;
  
  import java.util.HashMap;


Object representing the current workflow context.

Author(s):
Michael J. Rizzo
 
 public class WorkFlowContext {
    
    
Map that allows for persistence of scoped history objects.
  
     protected HashMap<StringSessionHistoryscopeHistoryMap;

    
Map that tracks snapsots of SessionHistory for workFlow, used to support backward web navigations.
 
 	private HashMap<StringSessionHistorysessionHistorySnapshots = new HashMap<StringSessionHistory>();
    
    
Tracks the current active state within the workflow.
 
 	private State activeState;
    
    
A key identifying the current workflow type.
 
     private WorkFlowKey workFlowKey;

    
Indicator for whether autoPersist should be on.
 
     private boolean autoPersist = false;
    
    
Indicator for whether SessionHistory snapshots for a workfow will be saved, support backwards navigation.
  
     private boolean workFlowHistorySnapshot = false;
    
    
Public default constructor that initializes scoped map and session history scoped object.
 
 	public WorkFlowContext() {
          = new HashMap<StringSessionHistory>();
         
         SessionHistory sessionHistory = new SessionHistory(); 
         	this..put(.sessionHistory);
 	}

    
Constructor that allows for passing of history object that will session scoped.

Parameters:
history The History object to set at session scope.
 
 	public WorkFlowContext(SessionHistory history) {
         .put(.history); 
 	}
    
    
Constructor that allows for passing of history object that will be scoped according to scope parameter.

Parameters:
history The History object to set at session scope.
 
     protected WorkFlowContext(SessionHistory historyString scope) {
         .put(scopehistory); 
     }

Return the session scoped history.

Returns:
the history
 
 	public SessionHistory getHistory() {
 		return (SessionHistory
 	}

Set the session history scoped object.

Parameters:
history The history to set.
 
 	public void setHistory(SessionHistory history) {
 	}	

    
Return a specified scoped history.

Parameters:
scope The scope of the variable to return.
Returns:
the specified scoped history object or null is specified scope is not present in Map.
 
     public SessionHistory getHistory(String scope) {
         return (SessionHistory
           .get(scope);
     }

    
Set the history object at the specified scope.

Parameters:
history The history to set.
scope The scope at witch to set the history object.
    public void setHistory(SessionHistory historyString scope) {
        .put(scopehistory);
    }   
    
 
Retrieve the active state instance.

Returns:
the active state instance.
    public State getActiveState() {
        return ;
    }

    
Set the active state.

Parameters:
activeState the state to set as active.
    protected void setActiveState(State activeState) {
        this. = activeState;
    }
    
    
Returns the currently active view according to the workflow component.

Returns:
the name of the currently active view or null if an there is no current active state.
    public String getActiveView() {
        if (this. != null
            return this..getViewName();
        
        return null;
    }
    
    
Return whether the view controller should build out back navigation for the currently active view within the workflow context. Returns false if there is not an active view and state within the context.

Returns:
true is backwards navigation should be built out by view controller.
    public boolean isBackNavAllowedForActiveView() {
    	if (this. != null)
    		return this..isAllowBackNavigation();
    	
    	return false;
    }
    
    
Return whether the view controller should apply a view filter on the view. Returns null if there was not view controller specified in the workflow configuration for the view. The actual functionality of the view filter is comtrolled by the view controller being used.

Returns:
    	if (this. != null)
    		 return this..getViewFilterClassname();
    	
    	return null;
    }

    
The work flow key representing the register implementation.

Returns:
the work flow key.
    public WorkFlowKey getWorkFlowKey() {
        return ;
    }

    
Set the key for the workflow implementation.

Parameters:
workFlowKey The work flow key to set.
    public void setWorkFlowKey(WorkFlowKey workFlowKey) {
        this. = workFlowKey;
    }

    
Check whether auto persist is currently set for workflow context.

Returns:
true if auto persist is on.
	public boolean isAutoPersist() {
		return ;
	}

Change the auto persist indicator on the workflow context.

Parameters:
autoPersist boolean parameter to turn on or off auto persist indicator.
	public void setAutoPersist(boolean autoPersist) {
		this. = autoPersist;
	}

Check whether the workflow history snapshot mode is on.

Returns:
true if history snaspshots whould be stored in memory for the workflow.
	public boolean isWorkFlowHistorySnapshots() {
	}

Change the workflow history snapshot mode.

Parameters:
workFlowHistorySnapshot boolean parameter to turn on or off workflow history snapshot mode.
	public void setWorkFlowHistorySnapshot(boolean workFlowHistorySnapshot) {
		this. = workFlowHistorySnapshot;
	}

Method used to add a workflow SessionHistory snapshot to the snapshot memory store.

Parameters:
viewName the view name to be used as the key within the snapshot memory store.
snapshot the snapshot SessionHistory instance to store.
	public void storeWorkFlowSnaphot(String viewNameSessionHistory snapshot) {
		this..put(viewNamesnapshot);
	}

Return the snapshot SessionHistory from the memory persistent store.

Parameters:
viewName the view name, key for the store to return a saved snapshot.
Returns:
		return this..get(viewName);
	}
New to GrepCode? Check out our FAQ X