public class InvoiceTools extends GenericService
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 |
---|
InvoiceTools() |
Modifier and Type | Method and Description |
---|---|
RepositoryItem |
addInvoice(MutableRepositoryItem pInvoice)
Add a new invoice repository item to the repository.
|
void |
addProfileToBean(RepositoryItem pInvoice,
java.lang.Object pBean)
Find the user profile of the user who created an invoice and add it
to an arbitrary Java Bean.
|
void |
copyInvoiceRequestProperties(InvoiceRequestInfo pInfo,
MutableRepositoryItem pInvoice)
Copy property values from an InvoiceRequestInfo object to
an invoice repository item, using the mapping specified by
invoiceRequestPropertyMap.
|
MutableRepositoryItem |
createInvoice(java.lang.String pInvoiceNumber)
Create a new invoice repository item.
|
MutableRepositoryItem |
createInvoice(java.lang.String pInvoiceNumber,
boolean pMakePersistent)
Create a new invoice repository item, optionally adding it to the
invoice repository.
|
javax.jms.ObjectMessage |
createInvoiceMessage(RepositoryItem pInvoice,
MessageSourceContext pContext,
java.lang.String pMessagePort,
boolean pFetchProfile)
Create a patchbay-compatible invoice message from a specified
invoice repository item using the default message bean class and
the default invoice item to message bean property mapping.
|
javax.jms.ObjectMessage |
createInvoiceMessage(RepositoryItem pInvoice,
java.lang.String pMessageBeanClass,
MessageSourceContext pContext,
java.lang.String pMessagePort,
java.util.Properties pPropertyMap,
boolean pFetchProfile)
Create a patchbay-compatible invoice message from a specified
invoice repository item.
|
RepositoryItem[] |
findInvoicesByInvoiceNumber(java.lang.String pInvoiceNumber)
Search the repository for invoices having a particular invoice number.
|
RepositoryItem[] |
findInvoicesByPropertyValue(java.util.Map pValues)
Search the repository for invoices having a set of particular property
values.
|
RepositoryItem[] |
findInvoicesByPropertyValue(java.lang.String pPropertyName,
java.lang.Object pTargetValue)
Search the repository for invoices having a particular property value.
|
RepositoryItem[] |
findInvoicesByPropertyValue(java.lang.String pPropertyName_1,
java.lang.Object pTargetValue_1,
java.lang.String pPropertyName_2,
java.lang.Object pTargetValue_2)
Search the repository for invoices having two particular property
values.
|
java.lang.String |
getBalanceDuePropertyName()
Return the name of the property used to store an invoice's balance due.
|
java.lang.String |
getDefaultInvoiceMessageClass()
Return the class that
createInvoiceMessage will use as
the default "Dynamo message bean" type. |
java.util.Properties |
getDefaultInvoiceMessageMap()
Return the mapping of properties from repository item to Dynamo
message bean that
createInvoiceMessage will use by
default. |
RepositoryItem |
getDeliveryInfo(RepositoryItem pInvoice)
Return the repository item that represents an invoice's delivery information.
|
MutableRepositoryItem |
getDeliveryInfoForUpdate(RepositoryItem pInvoice)
Return a mutable version of the repository item that represents an
invoice's delivery information.
|
java.lang.String |
getDeliveryInfoPropertyName()
Return the name of the property used to store an invoice's delivery
information.
|
java.lang.String |
getDSSProfilePropertyName()
Get the name of the JMS message property where Dynamo Scenario Server
expects to find a reference to the user profile.
|
RepositoryItem |
getInvoice(java.lang.String pRepositoryId)
Get the invoice with the specified repository id.
|
MutableRepositoryItem |
getInvoiceForUpdate(java.lang.String pRepositoryId)
Get a mutable version of the invoice with the specified repository id.
|
java.lang.String |
getInvoiceItemDescriptorName()
Return the repository item descriptor name for the invoice item type.
|
java.lang.String |
getInvoiceNumberPropertyName()
Return the name of the property used to store an invoice's invoice number.
|
MutableRepository |
getInvoiceRepository()
Return the repository being used to store and retrieve invoices.
|
java.util.Properties |
getInvoiceRequestPropertyMap()
Return the map describing the association between properties of an
InvoiceRequestInfo object and properties of an invoice repository item.
|
java.lang.String |
getLastModifiedPropertyName()
Return the name of the property used to store an invoice's last
modified date and time.
|
java.lang.String |
getOrderIdPropertyName()
Return the name of the property used to store an invoice's order id.
|
java.lang.String |
getPaymentDueDatePropertyName()
Return the name of the property used to store an invoice's payment due date.
|
java.lang.String |
getPaymentGroupIdPropertyName()
Return the name of the property used to store an invoice's payment group id.
|
RepositoryItem |
getPaymentTerms(RepositoryItem pInvoice)
Return the repository item that represents an invoice's payment terms.
|
RepositoryItem |
getPaymentTermsForUpdate(RepositoryItem pInvoice)
Return a mutable version of the repository item that represents an
invoice's payment terms.
|
java.lang.String |
getPaymentTermsPropertyName()
Return the name of the property used to store an invoice's payment terms.
|
java.lang.String |
getPONumberPropertyName()
Return the name of the property used to store an invoice's purchase order number.
|
CommerceProfileTools |
getProfileTools() |
PropertyTools |
getPropertyTools() |
RepositoryItem |
getUserProfile(RepositoryItem pInvoice)
Return the user profile of the user who created the order that was
paid for with the specified invoice.
|
void |
removeInvoice(RepositoryItem pInvoice)
Remove the specified invoice repository item from the repository.
|
void |
removeInvoice(java.lang.String pRepositoryId)
Remove the specified invoice repository item from the repository.
|
void |
setBalanceDuePropertyName(java.lang.String pBalanceDuePropertyName)
Specify the name of the property used to store an invoice's balance due.
|
void |
setDefaultInvoiceMessageClass(java.lang.String pDefaultInvoiceMessageClass)
Specify the class that
createInvoiceMessage will use as
the default "Dynamo message bean" type. |
void |
setDefaultInvoiceMessageMap(java.util.Properties pDefaultInvoiceMessageMap)
Specify the mapping of properties from repository item to Dynamo
message bean that
createInvoiceMessage will use by
default. |
void |
setDeliveryInfoPropertyName(java.lang.String pDeliveryInfoPropertyName)
Specify the name of the property used to store an invoice's delivery
information.
|
void |
setDSSProfilePropertyName(java.lang.String pDSSProfilePropertyName)
Set the name of the JMS message property where Dynamo Scenario Server
expects to find a reference to the user profile.
|
void |
setInvoiceItemDescriptorName(java.lang.String pInvoiceItemDescriptorName)
Specify the repository item descriptor name for the invoice item type.
|
void |
setInvoiceNumberPropertyName(java.lang.String pInvoiceNumberPropertyName)
Specify the name of the property used to store an invoice's invoice number.
|
void |
setInvoiceRepository(MutableRepository pInvoiceRepository)
Specify which invoice repository to use.
|
void |
setInvoiceRequestPropertyMap(java.util.Properties pInvoiceRequestPropertyMap)
Specify the association between properties of an InvoiceRequestInfo
object and properties of an invoice repository item.
|
void |
setLastModifiedPropertyName(java.lang.String pLastModifiedPropertyName)
Specify the name of the property used to store an invoice's last
modified date and time.
|
void |
setOrderIdPropertyName(java.lang.String pOrderIdPropertyName)
Specify the name of the property used to store an invoice's order id.
|
void |
setPaymentDueDatePropertyName(java.lang.String pPaymentDueDatePropertyName)
Specify the name of the property used to store an invoice's payment due date.
|
void |
setPaymentGroupIdPropertyName(java.lang.String pPaymentGroupIdPropertyName)
Specify the name of the property used to store an invoice's payment group id.
|
void |
setPaymentTermsPropertyName(java.lang.String pPaymentTermsPropertyName)
Specify the name of the property used to store an invoice's payment terms.
|
void |
setPONumberPropertyName(java.lang.String pPONumberPropertyName)
Specify the name of the property used to store an invoice's purchase order number.
|
void |
setProfileTools(CommerceProfileTools pProfileTools) |
void |
setPropertyTools(PropertyTools pPropertyTools) |
void |
updateInvoice(MutableRepositoryItem pInvoice)
Update invoice properties in the invoice repository and set the
repository item's last-modified-time to the current date and time.
|
void |
updateInvoice(MutableRepositoryItem pInvoice,
boolean pUpdateTimestamp)
Update invoice properties in the invoice repository, optionally
updating the repository item's last-modified-time automatically.
|
void |
updateLastModifiedTime(MutableRepositoryItem pMutableInvoice)
Set an invoice's last modified date and time to the current
date and time.
|
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 setInvoiceRepository(MutableRepository pInvoiceRepository)
public MutableRepository getInvoiceRepository()
public void setInvoiceItemDescriptorName(java.lang.String pInvoiceItemDescriptorName)
public java.lang.String getInvoiceItemDescriptorName()
public void setLastModifiedPropertyName(java.lang.String pLastModifiedPropertyName)
public java.lang.String getLastModifiedPropertyName()
public void setDeliveryInfoPropertyName(java.lang.String pDeliveryInfoPropertyName)
public java.lang.String getDeliveryInfoPropertyName()
public void setPaymentTermsPropertyName(java.lang.String pPaymentTermsPropertyName)
public java.lang.String getPaymentTermsPropertyName()
public void setInvoiceNumberPropertyName(java.lang.String pInvoiceNumberPropertyName)
public java.lang.String getInvoiceNumberPropertyName()
public void setPONumberPropertyName(java.lang.String pPONumberPropertyName)
public java.lang.String getPONumberPropertyName()
public void setBalanceDuePropertyName(java.lang.String pBalanceDuePropertyName)
public java.lang.String getBalanceDuePropertyName()
public void setPaymentDueDatePropertyName(java.lang.String pPaymentDueDatePropertyName)
public java.lang.String getPaymentDueDatePropertyName()
public void setOrderIdPropertyName(java.lang.String pOrderIdPropertyName)
public java.lang.String getOrderIdPropertyName()
public void setPaymentGroupIdPropertyName(java.lang.String pPaymentGroupIdPropertyName)
public java.lang.String getPaymentGroupIdPropertyName()
public void setDSSProfilePropertyName(java.lang.String pDSSProfilePropertyName)
public java.lang.String getDSSProfilePropertyName()
public void setProfileTools(CommerceProfileTools pProfileTools)
public CommerceProfileTools getProfileTools()
public void setPropertyTools(PropertyTools pPropertyTools)
public PropertyTools getPropertyTools()
public void setInvoiceRequestPropertyMap(java.util.Properties pInvoiceRequestPropertyMap)
The left hand side of each map entry is a property expression valid for InvoiceRequestInfo; the right hand side is a property expression valid for the invoice repository item. Either side may contain dotted names that refer to sub-properties of a given object.
The value of each InvoiceRequestInfo property is looked up and copied to the corresponding invoice repository item property by the copyInvoiceRequestProperties method.
Example configuration:
invoiceRequestPropertyMap=\ paymentDueDate=paymentDueDate,\ paymentNetDays=paymentTerms.netDays,\ paymentDiscountDays=paymentTerms.discountDays,\ preferredFormat=deliveryInfo.preferredFormat,\ billingAddress.firstName=deliveryInfo.firstName,\ billingAddress.middleName=deliveryInfo.middleName,\ billingAddress.lastName=deliveryInfo.lastName
public java.util.Properties getInvoiceRequestPropertyMap()
public void setDefaultInvoiceMessageClass(java.lang.String pDefaultInvoiceMessageClass)
createInvoiceMessage
will use as
the default "Dynamo message bean" type.public java.lang.String getDefaultInvoiceMessageClass()
createInvoiceMessage
will use as
the default "Dynamo message bean" type.public void setDefaultInvoiceMessageMap(java.util.Properties pDefaultInvoiceMessageMap)
createInvoiceMessage
will use by
default. See setInvoiceRequestPropertyMap
for more information about property maps and how to use them.public java.util.Properties getDefaultInvoiceMessageMap()
createInvoiceMessage
will use by
default.public MutableRepositoryItem createInvoice(java.lang.String pInvoiceNumber, boolean pMakePersistent) throws InvoiceException
pInvoiceNumber
- The invoice number for the new invoice, which may be null if no
invoice number is desired.pMakePersistent
- If true the new item will be added to the invoice repository
immediately, in which case the application should populate the item
properties and then call updateInvoice to make the changes persistent.
If false the new item will be transient, in which case the application should populate the item properties and then call addInvoice to make the new item and its properties persistent.
In either case, a mutable repository item is returned.
InvoiceException
- if any repository error occurs while creating the new item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public MutableRepositoryItem createInvoice(java.lang.String pInvoiceNumber) throws InvoiceException
pInvoiceNumber
- The invoice number for the new invoice, which may be null if no
invoice number is desired.InvoiceException
- if any repository error occurs while creating the new item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public RepositoryItem addInvoice(MutableRepositoryItem pInvoice) throws InvoiceException
InvoiceException
- if any repository error occurs while creating the new item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public RepositoryItem getInvoice(java.lang.String pRepositoryId) throws InvoiceException
InvoiceException
- if any repository error occurs while retrieving the item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public MutableRepositoryItem getInvoiceForUpdate(java.lang.String pRepositoryId) throws InvoiceException
InvoiceException
- if any repository error occurs while retrieving the item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public void updateInvoice(MutableRepositoryItem pInvoice, boolean pUpdateTimestamp) throws InvoiceException
pInvoice
- The invoice being saved to the repository.pUpdateTimestamp
- Flag indicating whether or not to update the last modified time.
If true, the last modified time of the repository item will be set
to the current date and time. Otherwise the last modified time will
remain unchanged. Note that the last modified time will be updated
even if no properties in the repository item have changed value since
the last update.InvoiceException
- if any repository error occurs while updating the item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public void updateInvoice(MutableRepositoryItem pInvoice) throws InvoiceException
InvoiceException
- if any repository error occurs while updating the item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public void removeInvoice(RepositoryItem pInvoice) throws InvoiceException
InvoiceException
- if any repository error occurs while removing the item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public void removeInvoice(java.lang.String pRepositoryId) throws InvoiceException
InvoiceException
- if any repository error occurs while removing the item. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public RepositoryItem[] findInvoicesByPropertyValue(java.lang.String pPropertyName, java.lang.Object pTargetValue) throws InvoiceException
pPropertyName
- A property name of the form "invoiceNumber" or "deliveryInfo.lastName"
whose value is of interest.pTargetValue
- The value of the named property to search for.InvoiceException
- if any repository error occurs while searching the repository. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public RepositoryItem[] findInvoicesByPropertyValue(java.lang.String pPropertyName_1, java.lang.Object pTargetValue_1, java.lang.String pPropertyName_2, java.lang.Object pTargetValue_2) throws InvoiceException
pPropertyName_1
- A property name of the form "invoiceNumber" or "deliveryInfo.lastName"
whose value is of interest.pTargetValue_1
- The value of the property specified by pPropertyName_1 to search for.pPropertyName_2
- Another property name.pTargetValue_2
- The value of the property specified by pPropertyName_2 to search for.InvoiceException
- if any repository error occurs while searching the repository. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public RepositoryItem[] findInvoicesByPropertyValue(java.util.Map pValues) throws InvoiceException
pValues
- A Map whose keys are property names, and whose values are the target
values for the corresponding property.InvoiceException
- if any repository error occurs while searching the repository. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public RepositoryItem[] findInvoicesByInvoiceNumber(java.lang.String pInvoiceNumber) throws InvoiceException
pInvoiceNumber
- The invoice number to search for.InvoiceException
- if any repository error occurs while searching the repository. The
sourceException property of the invoice exception provides access
to the original RepositoryException.public RepositoryItem getDeliveryInfo(RepositoryItem pInvoice)
public MutableRepositoryItem getDeliveryInfoForUpdate(RepositoryItem pInvoice) throws InvoiceException
InvoiceException
public RepositoryItem getPaymentTerms(RepositoryItem pInvoice)
public RepositoryItem getPaymentTermsForUpdate(RepositoryItem pInvoice) throws InvoiceException
InvoiceException
public RepositoryItem getUserProfile(RepositoryItem pInvoice) throws InvoiceException
InvoiceException
public void updateLastModifiedTime(MutableRepositoryItem pMutableInvoice)
public void copyInvoiceRequestProperties(InvoiceRequestInfo pInfo, MutableRepositoryItem pInvoice) throws InvoiceException
InvoiceException
- if any error occurs getting property values from the object
or setting them in the repository itemsetInvoiceRequestPropertyMap(java.util.Properties)
public javax.jms.ObjectMessage createInvoiceMessage(RepositoryItem pInvoice, java.lang.String pMessageBeanClass, MessageSourceContext pContext, java.lang.String pMessagePort, java.util.Properties pPropertyMap, boolean pFetchProfile) throws InvoiceException
pInvoice
- The invoice repository item whose data is represented in the message.pMessageBeanClass
- The message bean class that will carry the data in the message.pContext
- The message source context to use when creating the new message.pMessagePort
- The JMS port on which to send the message.pPropertyMap
- The table that specifies the mapping of values from properties of
the invoice repository to properties of the message bean.pFetchProfile
- If true, and if the message bean class contains a property named
profile
whose type is RepositoryItem
, then
the profile property will be set to the user profile of the use
who placed the order resulting in the creation of pInvoice
.
Otherwise no special attempt will be made to populate the profile
property of the message bean, even if it exists.InvoiceException
public javax.jms.ObjectMessage createInvoiceMessage(RepositoryItem pInvoice, MessageSourceContext pContext, java.lang.String pMessagePort, boolean pFetchProfile) throws InvoiceException
pInvoice
- The invoice repository item whose data is represented in the message.pContext
- The message source context to use when creating the new message.pMessagePort
- The JMS port on which to send the message.pFetchProfile
- If true, and if the message bean class contains a property named
profile
whose type is RepositoryItem
, then
the profile property will be set to the user profile of the use
who placed the order resulting in the creation of pInvoice
.
Otherwise no special attempt will be made to populate the profile
property of the message bean, even if it exists.InvoiceException
setDefaultInvoiceMessageClass(java.lang.String)
,
setDefaultInvoiceMessageMap(java.util.Properties)
public void addProfileToBean(RepositoryItem pInvoice, java.lang.Object pBean) throws java.beans.IntrospectionException, PropertyNotFoundException, InvoiceException
profile
whose type is RepositoryItem
,
then set this property to the profile of the user who placed the order
paid for by pInvoice. If pBean does not have such a property, return
without doing anything.java.beans.IntrospectionException
PropertyNotFoundException
InvoiceException