| |
|
| java.lang.Object org.jaffa.components.voucher.AbstractVoucherGenerator org.jaffa.components.voucher.SimpleVoucherGenerator
SimpleVoucherGenerator | public class SimpleVoucherGenerator extends AbstractVoucherGenerator (Code) | | This is a very simple implementation of the IVoucherGenerator interface.
It has 2 additional properties which need to be set before invoking the generate method
1- DomainClassName: A fully qualified classname for the domain class
2- FieldName: A fieldname
This implementation will merely perform the following query:
'SELECT [fieldname] FROM [domainclassname] ORDER BY [fieldname] DESC'
It will then generate the voucher by
1- Incrementing the number portion from the value retrieved
2- Appending the number to the prefix with appropriate padding
NOTE:
This implementation suffers from a very serious drawback - 2 THREADS CAN OBTAIN THE SAME VOUCHER
This class is intended for demo purposes only.
It SHOULD NOT be used in a production environment.
author: GautamJ |
getDomainClassName | public String getDomainClassName()(Code) | | Getter for the property domainClassName.
Value of property domainClassName. |
getFieldName | public String getFieldName()(Code) | | Getter for the property fieldName.
Value of property fieldName. |
setDomainClassName | public void setDomainClassName(String domainClassName)(Code) | | Setter for property domainClassName.
Parameters: domainClassName - New value of property domainClassName. |
setFieldName | public void setFieldName(String fieldName)(Code) | | Setter for property fieldName.
Parameters: fieldName - New value of property fieldName. |
|
|
|