| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jaffa.components.voucher.AbstractVoucherGenerator
org.jaffa.components.voucher.SimpleVoucherGenerator
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.
| Constructor Summary | |
| SimpleVoucherGenerator() | |
| Method Summary | |
|  String | generate()The client will invoke this method to generate a voucher. | 
|  String | getDomainClassName()Getter for the property domainClassName. | 
|  String | getFieldName()Getter for the property fieldName. | 
|  void | setDomainClassName(String domainClassName)Setter for property domainClassName. | 
|  void | setFieldName(String fieldName)Setter for property fieldName. | 
| Methods inherited from class org.jaffa.components.voucher.AbstractVoucherGenerator | 
| cleanup, getLabelToken, getLength, getPrefix, getUow, init, setLabelToken, setLength, setPrefix, setUow | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public SimpleVoucherGenerator()
| Method Detail | 
public String getDomainClassName()
public void setDomainClassName(String domainClassName)
domainClassName - New value of property domainClassName.public String getFieldName()
public void setFieldName(String fieldName)
fieldName - New value of property fieldName.
public String generate()
                throws FrameworkException,
                       ApplicationExceptions
generate in interface IVoucherGeneratorgenerate in class AbstractVoucherGeneratorFrameworkException - if any framework error occurs.
ApplicationExceptions - if any application error occurs.| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||