org.starhope.appius.pay
Class GiftCard
java.lang.Object
org.starhope.appius.util.ManagedReferenceHolder
org.starhope.appius.sql.SQLPeerDatum
org.starhope.appius.pay.GiftCard
public class GiftCard
- extends SQLPeerDatum
- Author:
- brpocock
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
avatar
private com.sun.sgs.app.ManagedReference<Avatar> avatar
code
private String code
createdBy
private com.sun.sgs.app.ManagedReference<User> createdBy
createdOn
private Date createdOn
expires
private Date expires
memo
private String memo
usedBy
private com.sun.sgs.app.ManagedReference<User> usedBy
usedOn
private Date usedOn
GiftCard
public GiftCard()
get
public static GiftCard get(String code)
throws RuntimeException,
NotFoundException
- Parameters:
code
- serial number of gift card
- Returns:
- gift card
- Throws:
NotFoundException
- if the gift card isn't found in the
database
RuntimeException
- if something bad happens
apply
public void apply(User recipient)
throws AlreadyUsedException,
DataException
- Syntactic sugar for apply (recipient, “now”)
- Parameters:
recipient
- The user who will receive the benefits of the
gift card being applied
- Throws:
DataException
- if there is a problem with the data objects
being used.
AlreadyUsedException
- if the gift card has been used
previously
apply
public void apply(User recipient,
Date applyOn)
throws AlreadyUsedException,
DataException
- Parameters:
recipient
- The user who will receive the benefits of the
gift card being appliedapplyOn
- The date and time at which the gift card's
benefits are applied.
- Throws:
AlreadyUsedException
- if the gift card has been used
previously
DataException
- if there is a problem with the data objects
being used.
getAvatar
public Avatar getAvatar()
- Returns:
- get the avatar associated with this gift card, if any
getCode
public String getCode()
- Returns:
- WRITEME
getCreatedBy
public Person getCreatedBy()
- Returns:
- WRITEME
getCreatedOn
public Date getCreatedOn()
- Returns:
- WRITEME
getExpires
public Date getExpires()
- Returns:
- WRITEME
getMemo
public String getMemo()
- Returns:
- WRITEME
getUsedBy
public Person getUsedBy()
- Returns:
- WRITEME
getUsedOn
public Date getUsedOn()
- Returns:
- WRITEME
set
public void set(org.json.JSONObject o)
- Overrides:
set
in class SQLPeerDatum
- See Also:
CastsToJSON.set(org.json.JSONObject)
setAvatar
public void setAvatar(Avatar avatar)
throws DataException
- Parameters:
avatar
- WRITEME
- Throws:
DataException
- WRITEME
setCode
public void setCode(String newCode)
- Parameters:
newCode
- WRITEME
setCreatedBy
public void setCreatedBy(User newCreatedBy)
- Parameters:
newCreatedBy
- WRITEME
setCreatedOn
public void setCreatedOn(Date newCreatedOn)
- Parameters:
newCreatedOn
- WRITEME
setExpires
public void setExpires(Date newExpires)
throws DataException
- Parameters:
newExpires
- WRITEME
- Throws:
DataException
- WRITEME
setMemo
public void setMemo(String newMemo)
- Parameters:
newMemo
- WRITEME
setUsedBy
public void setUsedBy(User newUsedBy)
- Parameters:
newUsedBy
- WRITEME
setUsedOn
public void setUsedOn(Date newUsedOn)
throws AlreadyUsedException,
DataException
- Parameters:
newUsedOn
- WRITEME
- Throws:
AlreadyUsedException
- WRITEME
DataException
- WRITEME
toJSON
public org.json.JSONObject toJSON()
- Overrides:
toJSON
in class SQLPeerDatum
- Returns:
- See Also:
org.starhope.appius.util.BaseDatum#toJSON()