psoft.hsphere.promotion
Class Promo

java.lang.Object
  |
  +--psoft.hsphere.promotion.Promo
All Implemented Interfaces:
freemarker.template.TemplateHashModel, freemarker.template.TemplateModel

public class Promo
extends java.lang.Object
implements freemarker.template.TemplateHashModel


Constructor Summary
Promo(long id, java.lang.String code, java.lang.String name, java.lang.String billingDescr, PromoValidator validator, PromoCalculator calc, boolean setup, boolean recurr, boolean usage, boolean isCodeLess)
           
 
Method Summary
 double calcDiscount(psoft.hsphere.Account a, double sum)
           
 psoft.hsphere.PromoDiscount createDiscountBillEntry(long beId, psoft.hsphere.Account a, double amount)
           
static Promo createPromo(java.lang.String promoCode, java.lang.String promoName, java.lang.String billDescr, java.lang.String promoValidatorId, java.lang.String promoCalcId, boolean setup, boolean recurr, boolean usage, boolean codeLess)
           
 void delete()
           
 freemarker.template.TemplateModel FM_delete()
           
 freemarker.template.TemplateModel FM_setState(java.lang.String state)
           
 freemarker.template.TemplateModel FM_updatePromo(java.lang.String newCode, java.lang.String newName, java.lang.String newBillDescr, java.lang.String setup, java.lang.String recurrent, java.lang.String usage, java.lang.String codeLess)
           
 freemarker.template.TemplateModel get(java.lang.String key)
           
 java.lang.String getBillingDescr()
           
 java.lang.String getCode()
           
 long getId()
           
static Promo getPromo(long promoId)
           
static java.util.Hashtable getPromoHash()
           
 boolean isActive()
           
 boolean isCodeLess()
           
 boolean isEmpty()
           
protected static boolean isEmpty(java.lang.String str)
           
 boolean isPromoValid(long billEntryType, psoft.hsphere.Account a)
           
 void setState(boolean st)
           
 void updatePromo(java.lang.String newCode, java.lang.String newName, java.lang.String newBillDescr, boolean setup, boolean recurrent, boolean usage, boolean codeless)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Promo

public Promo(long id,
             java.lang.String code,
             java.lang.String name,
             java.lang.String billingDescr,
             PromoValidator validator,
             PromoCalculator calc,
             boolean setup,
             boolean recurr,
             boolean usage,
             boolean isCodeLess)
Method Detail

calcDiscount

public double calcDiscount(psoft.hsphere.Account a,
                           double sum)

isPromoValid

public boolean isPromoValid(long billEntryType,
                            psoft.hsphere.Account a)

createPromo

public static Promo createPromo(java.lang.String promoCode,
                                java.lang.String promoName,
                                java.lang.String billDescr,
                                java.lang.String promoValidatorId,
                                java.lang.String promoCalcId,
                                boolean setup,
                                boolean recurr,
                                boolean usage,
                                boolean codeLess)
                         throws java.lang.Exception
java.lang.Exception

get

public freemarker.template.TemplateModel get(java.lang.String key)
                                      throws freemarker.template.TemplateModelException
Specified by:
get in interface freemarker.template.TemplateHashModel
freemarker.template.TemplateModelException

isEmpty

public boolean isEmpty()
                throws freemarker.template.TemplateModelException
Specified by:
isEmpty in interface freemarker.template.TemplateModel
freemarker.template.TemplateModelException

isEmpty

protected static boolean isEmpty(java.lang.String str)

getId

public long getId()

getPromoHash

public static java.util.Hashtable getPromoHash()
                                        throws java.lang.Exception
java.lang.Exception

getPromo

public static Promo getPromo(long promoId)
                      throws java.lang.Exception
java.lang.Exception

updatePromo

public void updatePromo(java.lang.String newCode,
                        java.lang.String newName,
                        java.lang.String newBillDescr,
                        boolean setup,
                        boolean recurrent,
                        boolean usage,
                        boolean codeless)
                 throws java.lang.Exception
java.lang.Exception

FM_updatePromo

public freemarker.template.TemplateModel FM_updatePromo(java.lang.String newCode,
                                                        java.lang.String newName,
                                                        java.lang.String newBillDescr,
                                                        java.lang.String setup,
                                                        java.lang.String recurrent,
                                                        java.lang.String usage,
                                                        java.lang.String codeLess)
                                                 throws java.lang.Exception
java.lang.Exception

setState

public void setState(boolean st)
              throws java.lang.Exception
java.lang.Exception

FM_setState

public freemarker.template.TemplateModel FM_setState(java.lang.String state)
                                              throws java.lang.Exception
java.lang.Exception

delete

public void delete()
            throws java.lang.Exception
java.lang.Exception

FM_delete

public freemarker.template.TemplateModel FM_delete()
                                            throws java.lang.Exception
java.lang.Exception

isActive

public boolean isActive()

getBillingDescr

public java.lang.String getBillingDescr()

createDiscountBillEntry

public psoft.hsphere.PromoDiscount createDiscountBillEntry(long beId,
                                                           psoft.hsphere.Account a,
                                                           double amount)
                                                    throws java.lang.Exception
java.lang.Exception

getCode

public java.lang.String getCode()

isCodeLess

public boolean isCodeLess()