SalesPoint Framework v3.1

sale
Interface ProcessContext

All Superinterfaces:
Serializable
All Known Implementing Classes:
SalesPoint, Shop.ProcessHandle

public interface ProcessContext
extends Serializable

A context that allows processes to run and access certain functionality.

A ProcessContext provides processes with an environment in which they can work. Although some of the functionality could be accessed directly at the Shop, some can't, and for the rest the usage of ProcessContexts provides an extra level of flexibility. It is therefore explicitly recommended that your processes access all of the needed functionality through their context, except in cases where you want to make sure that a special service is carried out at Shop level.

The methods comprising the ProcessContext interface fall into three categories:

  1. Display related methods:
  2. Data and service related methods:
  3. Process management methods: These methods will not be called directly, but rather the Framework will call them as appropriate.

Since:
v2.0
Author:
Steffen Zschaler

Method Summary
 Catalog getCatalog(String sName)
          Get a Catalog by its name.
 User getCurrentUser(SaleProcess p)
          Get the user currently associated with the given process.
 Object getProcessData(String sKey)
          Get an object from the ProcessContext.
 Stock getStock(String sName)
          Get a Stock by its name.
 boolean hasUseableDisplay(SaleProcess p)
          True if the ProcessContext has a useable display for the given process.
 void log(SaleProcess p, Loggable la)
          Put an entry into the ProcessContext's log stream for a process.
 void popUpFormSheet(SaleProcess p, FormSheet fs)
          Pop up a FormSheet for a process.
 void processFinished(SaleProcess p)
          Notification that a process was finished in this ProcessContext.
 void processStarted(SaleProcess p)
          Notification that a process was started in this ProcessContext.
 void setFormSheet(SaleProcess p, FormSheet fs)
          Set a FormSheet for a process.
 void setMenuSheet(SaleProcess p, MenuSheet ms)
          Set a MenuSheet for a process.
 void setProcessData(String sKey, Object oData)
          Put an object into the ProcessContext.
 

Method Detail

setFormSheet

public void setFormSheet(SaleProcess p,
                         FormSheet fs)
                  throws InterruptedException
Set a FormSheet for a process.

The FormSheet will be displayed on the ProcessContext's display for the given process, if there is one and it is useable. Setting a null FormSheet will remove any FormSheet currently being displayed.

Parameters:
p - the process that wishes to set a FormSheet
fs - the FormSheet that is to be set.
Throws:
InterruptedException - if an interrupt occurred while waiting for the FormSheet to be closed. See Display.setFormSheet for details.
See Also:
Display.setFormSheet(sale.FormSheet)
Override:
Always

popUpFormSheet

public void popUpFormSheet(SaleProcess p,
                           FormSheet fs)
                    throws InterruptedException
Pop up a FormSheet for a process.

The FormSheet will be popped up on the ProcessContext's display for the given process, if there is one and it is useable.

Parameters:
p - the process that wishes to pop up a FormSheet
fs - the FormSheet that is to be set.
Throws:
InterruptedException - if an interrupt occurred while waiting for the FormSheet to be closed. See Display.popUpFormSheet for details.
See Also:
Display.popUpFormSheet(sale.FormSheet)
Override:
Always

setMenuSheet

public void setMenuSheet(SaleProcess p,
                         MenuSheet ms)
Set a MenuSheet for a process.

The MenuSheet will be displayed on the ProcessContext's display for the given process, if there is one and it is useable. Setting a null MenuSheet will remove any MenuSheet currently being displayed.

Parameters:
p - the process that wishes to set a MenuSheet
ms - the MenuSheet that is to be set.
See Also:
Display.setMenuSheet(sale.MenuSheet)
Override:
Always

hasUseableDisplay

public boolean hasUseableDisplay(SaleProcess p)
True if the ProcessContext has a useable display for the given process.

Parameters:
p - the process whose display is to be checked.
See Also:
Display.isUseableDisplay()
Override:
Always

setProcessData

public void setProcessData(String sKey,
                           Object oData)
Put an object into the ProcessContext.

Parameters:
sKey - object's identifier
oData - the data object
Override:
Never

getProcessData

public Object getProcessData(String sKey)
Get an object from the ProcessContext.

Parameters:
sKey - object's key
Returns:
the object from ProcessContext
Override:
Never

log

public void log(SaleProcess p,
                Loggable la)
         throws IOException
Put an entry into the ProcessContext's log stream for a process.

Parameters:
p - the process that wishes to put data into the log stream.
la - the information that is to be logged.
Throws:
IOException - if any problems occurred while writing to the log stream.
Override:
Always

getCurrentUser

public User getCurrentUser(SaleProcess p)
Get the user currently associated with the given process.

Parameters:
p - the process that wishes to know its current user.
Returns:
the current user for the given process.
Override:
Always

getStock

public Stock getStock(String sName)
Get a Stock by its name.

The Stock's name is resolved relative to the ProcessContext, so that the same call can result in different Stocks in different ProcessContexts.

Parameters:
sName - the name of the Stock to be returned.
Returns:
the Stock that was found for the given name, if any.
Override:
Always

getCatalog

public Catalog getCatalog(String sName)
Get a Catalog by its name.

The Catalog's name is resolved relative to the ProcessContext, so that the same call can result in different Catalogs in different ProcessContexts.

Parameters:
sName - the name of the Catalog to be returned.
Returns:
the Catalog that was found for the given name, if any.
Override:
Always

processStarted

public void processStarted(SaleProcess p)
Notification that a process was started in this ProcessContext.

This method is usually not called directly, but rather the Framework calls it as appropriate.

Parameters:
p - the process that was started.
Override:
Always

processFinished

public void processFinished(SaleProcess p)
Notification that a process was finished in this ProcessContext.

This method is usually not called directly, but rather the Framework calls it as appropriate.

Parameters:
p - the process that was finished.
Override:
Always

SalesPoint Framework v3.1