public class InvoiceManager extends GenericService
In all cases, pipeline chains executed by the InvoiceManager will
be passed an
object as the pipeline processor argument.
InvoicePipelineArgs
InvoicePipelineArgs
provides convenience functions for
obtaining the Invoice repository item being operated upon and the
InvoiceManager that is performance the operation.
InvoiceManager subclasses can replace the InvoicePipelineArgs
with subclasses that provide additional API's by overriding the
method
on InvoiceManager.createPipelineArgs
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
protected static java.util.ResourceBundle |
sDefaultResources |
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
InvoiceManager() |
Modifier and Type | Method and Description |
---|---|
RepositoryItem |
addInvoice(MutableRepositoryItem pInvoice)
Add the invoice represented by pInvoice to the invoice repository,
and execute the pipeline chain whose name is specified by
addInvoiceChainName
|
MutableRepositoryItem |
createInvoice()
Create a new invoice repository item whose invoice number is generated
automatically and execute the pipeline chain whose name is specified by
the property createInvoiceChainName.
|
RepositoryItem |
createInvoice(InvoiceRequestInfo pInfo)
Create a new invoice repository item whose invoice number is generated
automatically, initialize it from the supplied invoice request info, and
add it to the repository.
|
MutableRepositoryItem |
createInvoice(java.lang.String pInvoiceNumber)
Create a new invoice repository item and execute the pipeline chain
whose name is specified by the property createInvoiceChainName.
|
RepositoryItem |
createInvoice(java.lang.String pInvoiceNumber,
InvoiceRequestInfo pInfo)
Create a new invoice repository item, initialize it from the supplied
invoice request info, and add it to the repository.
|
protected InvoicePipelineArgs |
createPipelineArgs(RepositoryItem pItem)
Create an instance of InvoicePipelineArgs containing a reference to
this pipeline manager and to the specified repository item.
|
protected InvoicePipelineArgs |
createPipelineArgs(RepositoryItem pItem,
InvoiceRequestInfo pInfo)
Create an instance of InvoicePipelineArgs containing a reference to
this pipeline manager, to a specified repository item, and to a
specified InvoiceRequestInfo that should be used to initialize the
repository item.
|
java.lang.String |
getAddInvoiceChainName()
Return the name of the pipeline chain to run when a new invoice is added to the repository.
|
java.lang.String |
getCreateInvoiceChainName()
Return the name of the pipeline chain to run when an invoice is created.
|
IdGenerator |
getIdGenerator()
Return the id generated used to generate unique invoice numbers.
|
java.lang.String |
getInitializeInvoiceChainName()
Return the name of the pipeline chain to run when initializing an invoice
repository item from an InvoiceRequestInfo object.
|
java.lang.String |
getInvoiceNumberIdSpace()
Return the id generator namespace used to generate unique invoice numbers.
|
RepositoryItem[] |
getInvoicesForInvoiceNumber(java.lang.String pInvoiceNumber)
Return all of the invoices having the given invoice number.
|
InvoiceTools |
getInvoiceTools()
Get the invoice tools component this InvoiceManager uses to
access the invoice repository.
|
java.lang.String |
getLoadInvoiceChainName()
Return the name of the pipeline chain to run when an invoice is loaded
from the repository.
|
java.lang.String |
getNextInvoiceNumber()
Return a unique invoice number.
|
PipelineManager |
getPipelineManager()
Return the pipeline manager this InvoiceManager uses to run pipeline chains.
|
java.lang.String |
getRemoveInvoiceChainName()
Return the name of the pipeline chain to run when an invoice is removed
from the repository.
|
javax.transaction.TransactionManager |
getTransactionManager()
Return the transaction manager used by this InvoiceManager.
|
java.lang.String |
getUpdateInvoiceChainName()
Return the name of the pipeline chain to run when an invoice is saved to
the repository.
|
RepositoryItem |
loadInvoice(java.lang.String pRepositoryId)
Load the invoice identified by the given repository id and execute the
pipeline chain whose name is specified by loadInvoiceChainName.
|
MutableRepositoryItem |
loadInvoiceForUpdate(java.lang.String pRepositoryId)
Load a mutable version of the invoice identified by the given
repository id and execute the pipeline chain whose name is specified by
loadInvoiceChainName.
|
void |
removeInvoice(RepositoryItem pInvoice)
Remove the specified invoice repository item and execute a pipeline
chain.
|
void |
removeInvoice(java.lang.String pRepositoryId)
Remove the specified invoice repository item and execute a pipeline
chain.
|
protected PipelineResult |
runPipelineChain(java.lang.String pChainName,
RepositoryItem pItem)
Run the named pipeline chain, passing this invoice manager and the
specified repository item to each pipeline processor.
|
protected PipelineResult |
runPipelineChain(java.lang.String pChainName,
RepositoryItem pItem,
InvoiceRequestInfo pInfo)
Run the named pipeline chain, passing this invoice manager, the
specified repository item, and the specified invoice request info object
(which may be omitted) to each pipeline processor.
|
void |
setAddInvoiceChainName(java.lang.String pAddInvoiceChainName)
Set the name of the pipeline chain to run when a new invoice is added to the repository.
|
void |
setCreateInvoiceChainName(java.lang.String pCreateInvoiceChainName)
Set the name of the pipeline chain to run when an invoice is created.
|
void |
setIdGenerator(IdGenerator pIdGenerator)
Set the id generated used to generate unique invoice numbers.
|
void |
setInitializeInvoiceChainName(java.lang.String pInitializeInvoiceChainName)
Set the name of the pipeline chain to run when initializing an invoice
repository item from an InvoiceRequestInfo object.
|
void |
setInvoiceNumberIdSpace(java.lang.String pInvoiceNumberIdSpace)
Set the id generator namespace used to generate unique invoice numbers.
|
void |
setInvoiceTools(InvoiceTools pInvoiceTools)
Set the invoice tools component this InvoiceManager uses to
access the invoice repository.
|
void |
setLoadInvoiceChainName(java.lang.String pLoadInvoiceChainName)
Set the name of the pipeline chain to run when an invoice is loaded from
the repository.
|
void |
setPipelineManager(PipelineManager pPipelineManager)
Set the pipeline manager this InvoiceManager uses to run pipeline chains.
|
void |
setRemoveInvoiceChainName(java.lang.String pRemoveInvoiceChainName)
Set the name of the pipeline chain to run when an invoice is removed
from the repository.
|
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Set the transaction manager used by this InvoiceManager.
|
void |
setUpdateInvoiceChainName(java.lang.String pUpdateInvoiceChainName)
Set the name of the pipeline chain to run when an invoice is saved to
the repository.
|
protected void |
throwPipelineException(java.lang.String pChainName,
PipelineResult pResult)
Throw an InvoicePipelineException with an appropriate error message
for the given pipeline chain and pipeline result object.
|
void |
updateInvoice(MutableRepositoryItem pInvoice)
Update invoice properties in the invoice repository, setting the
repository item's last-modified-time to the current time and date,
then execute the pipeline chain specified by
updateInvoiceChainName.
|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static java.lang.String CLASS_VERSION
protected static java.util.ResourceBundle sDefaultResources
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
public javax.transaction.TransactionManager getTransactionManager()
public void setPipelineManager(PipelineManager pPipelineManager)
public PipelineManager getPipelineManager()
public void setCreateInvoiceChainName(java.lang.String pCreateInvoiceChainName)
public java.lang.String getCreateInvoiceChainName()
public void setInitializeInvoiceChainName(java.lang.String pInitializeInvoiceChainName)
public java.lang.String getInitializeInvoiceChainName()
public void setAddInvoiceChainName(java.lang.String pAddInvoiceChainName)
public java.lang.String getAddInvoiceChainName()
public void setLoadInvoiceChainName(java.lang.String pLoadInvoiceChainName)
public java.lang.String getLoadInvoiceChainName()
public void setUpdateInvoiceChainName(java.lang.String pUpdateInvoiceChainName)
public java.lang.String getUpdateInvoiceChainName()
public void setRemoveInvoiceChainName(java.lang.String pRemoveInvoiceChainName)
public java.lang.String getRemoveInvoiceChainName()
public void setInvoiceTools(InvoiceTools pInvoiceTools)
public InvoiceTools getInvoiceTools()
public void setIdGenerator(IdGenerator pIdGenerator)
public IdGenerator getIdGenerator()
public void setInvoiceNumberIdSpace(java.lang.String pInvoiceNumberIdSpace)
public java.lang.String getInvoiceNumberIdSpace()
public java.lang.String getNextInvoiceNumber() throws InvoiceException
InvoiceException
public MutableRepositoryItem createInvoice(java.lang.String pInvoiceNumber) throws InvoiceException, InvoicePipelineException
pInvoiceNumber
- The invoice number for the new invoice.InvoiceException
- if any repository error occurs while creating the new item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.InvoicePipelineException
public MutableRepositoryItem createInvoice() throws InvoiceException, InvoicePipelineException
InvoiceException
- if any repository error occurs while creating the new item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.InvoicePipelineException
public RepositoryItem createInvoice(java.lang.String pInvoiceNumber, InvoiceRequestInfo pInfo) throws InvoiceException, InvoicePipelineException
After the repository item is created, this method executes the pipeline chain whose name is specified by createInvoiceChainName. The invoice repository item is still transient at this point.
The item properties are populated by executing the pipeline chain whose name is specified by initializeInvoiceChainName, after which the item is made persistent and added to the invoice repository.
After the item properties are populated and the item is added to the invoice repository, the method executes the pipeline chain whose name is specified by addInvoiceChainName.
pInvoiceNumber
- The invoice number for the new invoice.pInfo
- An InvoiceRequestInfo object used to populate the invoice item's
properties.InvoiceException
- if any repository error occurs while creating the new item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.InvoicePipelineException
public RepositoryItem createInvoice(InvoiceRequestInfo pInfo) throws InvoiceException, InvoicePipelineException
After the repository item is created, this method executes the pipeline chain whose name is specified by createInvoiceChainName. The invoice repository item is still transient at this point.
The item properties are populated by executing the pipeline chain whose name is specified by initializeInvoiceChainName, after which the item is made persistent and added to the invoice repository.
After the item properties are populated and the item is added to the invoice repository, the method executes the pipeline chain whose name is specified by addInvoiceChainName.
pInfo
- An InvoiceRequestInfo object used to populate the invoice item's
properties.InvoiceException
- if any repository error occurs while creating the new item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.InvoicePipelineException
public RepositoryItem addInvoice(MutableRepositoryItem pInvoice) throws InvoiceException, InvoicePipelineException
pInvoice
- The transient invoice item that should be added to the repository.InvoiceException
- if any repository error occurs while adding the new item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.InvoicePipelineException
public RepositoryItem loadInvoice(java.lang.String pRepositoryId) throws InvoiceException, InvoicePipelineException
public MutableRepositoryItem loadInvoiceForUpdate(java.lang.String pRepositoryId) throws InvoiceException, InvoicePipelineException
public void removeInvoice(RepositoryItem pInvoice) throws InvoiceException, InvoicePipelineException
public void removeInvoice(java.lang.String pRepositoryId) throws InvoiceException, InvoicePipelineException
public void updateInvoice(MutableRepositoryItem pInvoice) throws InvoiceException, InvoicePipelineException
pInvoice
- The invoice being saved to the repository.InvoiceException
- if any repository error occurs while updating the item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.InvoicePipelineException
public RepositoryItem[] getInvoicesForInvoiceNumber(java.lang.String pInvoiceNumber) throws InvoiceException, InvoicePipelineException
It may be possible to have several invoices with the same invoice number but different repository id's, e.g., if a new invoice is generated to reflect partial payment of an order and a reduction in the balance due. In most cases, however, this method will return an array containing a single invoice. This method will execute the "loadInvoice" pipeline chain once for each invoice returned.
protected PipelineResult runPipelineChain(java.lang.String pChainName, RepositoryItem pItem) throws InvoiceException, InvoicePipelineException
protected PipelineResult runPipelineChain(java.lang.String pChainName, RepositoryItem pItem, InvoiceRequestInfo pInfo) throws InvoiceException, InvoicePipelineException
protected InvoicePipelineArgs createPipelineArgs(RepositoryItem pItem)
Invoice manager subclasses that wish to provide additional information to the invoice pipeline can do so by overriding this method to add additional key/value pairs to the InvoicePipelineArgs, and/or to return a different application-specific subclass to use for the argument passed to the pipeline chain.
protected InvoicePipelineArgs createPipelineArgs(RepositoryItem pItem, InvoiceRequestInfo pInfo)
Invoice manager subclasses that wish to provide additional information to the invoice pipeline can do so by overriding this method to add additional key/value pairs to the InvoicePipelineArgs, and/or to return a different application-specific subclass to use for the argument passed to the pipeline chain.
protected void throwPipelineException(java.lang.String pChainName, PipelineResult pResult) throws InvoicePipelineException
InvoicePipelineException