|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.sql.SQLPeerDatum
org.starhope.appius.mb.UserEnrolment
public class UserEnrolment
This class represents an instance of a purchased enrolment (subscription) to a game, as bound to a particular user and period of time.
Field Summary | |
---|---|
private BigDecimal |
authSubID
Authorize.net subscription ID |
private Date |
begins
start date |
private Date |
expires
expiry date |
private int |
id
database ID |
private boolean |
isActivated
Has this enrolment been activated already? |
private String |
orderCode
order code |
private static char[] |
orderCodeChars
An internally-used array of characters used to create order codes. |
private String |
orderSource
order source |
private int |
productID
Enrolment product ID |
private static long |
serialVersionUID
serialVersionUID |
private int |
userID
The user who owns this enrolment |
Constructor Summary | |
---|---|
UserEnrolment(ResultSet rs)
|
|
UserEnrolment(String order_source,
int product_id,
int user_id)
WRITEME: document |
|
UserEnrolment(String order_source,
String order_code)
|
Method Summary | |
---|---|
void |
activate()
Deprecated. |
void |
activate(boolean newEnrolment)
|
void |
addPayment()
Deprecated. |
void |
cancelNow()
WRITEME theys |
void |
continueEnrolment()
TODO: document this method (theys, Sep 24, 2009) |
void |
flush()
|
private void |
generateOrderCode()
Create a pseudorandom, unique order code consisting of the approved letters and numbers. |
static Collection<UserEnrolment> |
getAllForUserID(int userID)
|
BigDecimal |
getAmount()
|
BigDecimal |
getAuthSubID()
|
Date |
getBegins()
|
Person |
getBuyer()
TODO: refactor payment gateways to use the buyer information: promote this up to Invoiceable interface. |
static UserEnrolment |
getBySourceAndCode(String orderSource,
String orderCode)
Retrieve a User Enrolment based off the invoice number split into orderSource and orderCode. |
protected String |
getCacheUniqueID()
|
Currency |
getCurrency()
|
String |
getDescription()
TODO: document this method (brpocock, Nov 19, 2009) |
Enrolment |
getEnrolment()
|
Date |
getExpires()
|
private int |
getID()
|
String |
getInvoiceID()
|
char |
getInvoiceIDPrefix()
|
private Date |
getLastExpiration()
Checks all enrolments for current user to determine when their last expiration ends and if it ends before today. |
Payment |
getLastPayment()
|
static UserEnrolment[] |
getLastTwoYearsForUserID(int userID)
Get all enrolments for a given user in the past two years from today's date. |
String |
getOrderCode()
|
String |
getOrderSource()
|
int |
getProductID()
|
Date |
getRecurs()
|
String |
getTitle()
|
AbstractUser |
getUser()
|
int |
getUserID()
|
void |
insert()
|
boolean |
isActive()
|
boolean |
isRecurring()
TODO: document this method (twheys, Oct 2, 2009) |
void |
killEnrolment()
TODO: document this method (theys, Sep 24, 2009) |
void |
set(ResultSet rs)
|
void |
setAuthSubID(BigDecimal authSubID1)
|
void |
setAuthSubID(String authSubID2)
TODO: document (twheys) |
void |
setBegins(Date newBegins)
|
void |
setEnrolment(Enrolment newEnrolment)
|
void |
setExpires(Date newExpires)
|
void |
setOrderCode(String orderCode1)
|
void |
setOrderSource(String orderSource1)
|
void |
setProductID(int productID1)
|
void |
setUser(User newUser)
|
void |
setUserID(int userID1)
|
void |
startEnrolment()
TODO: document this method (theys, Sep 24, 2009) |
org.json.JSONObject |
toJSON()
This is the default SQLPeerDatum implementation of toJSON. |
Methods inherited from class org.starhope.appius.sql.SQLPeerDatum |
---|
changed, findInCache, get, saveInCache, set |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final char[] orderCodeChars
private static final long serialVersionUID
private BigDecimal authSubID
private Date begins
private Date expires
private int id
private volatile boolean isActivated
private String orderCode
private String orderSource
private int productID
private int userID
Constructor Detail |
---|
public UserEnrolment(ResultSet rs) throws NotFoundException
rs
- SQL result set representing an enrolment
NotFoundException
- WRITEMEpublic UserEnrolment(String order_source, int product_id, int user_id) throws NotFoundException
order_source
- order sourceproduct_id
- WRITEMEuser_id
- WRITEME
NotFoundException
- if the enrolment type is not found.public UserEnrolment(String order_source, String order_code) throws NotFoundException
order_source
- order sourceorder_code
- order code
NotFoundException
- if the order doesn't already existMethod Detail |
---|
public static Collection<UserEnrolment> getAllForUserID(int userID)
userID
- user enrolled
public static UserEnrolment getBySourceAndCode(String orderSource, String orderCode) throws NotFoundException
orderSource
- The source of the order (ex. 'auth')orderCode
- The code of the order
NotFoundException
- if an enrolment cannot be found with
the given orderSource and orderCode.public static UserEnrolment[] getLastTwoYearsForUserID(int userID)
userID
- user enrolled
@Deprecated public void activate()
activate()
public void activate(boolean newEnrolment)
newEnrolment
- true if this is a new account FIXME:
activatedUser.isPaidMember () instead of accepting a
boolean?@Deprecated public void addPayment()
public void cancelNow()
public void continueEnrolment()
public void flush()
flush
in class SQLPeerDatum
SQLPeerDatum.flush()
private void generateOrderCode()
public BigDecimal getAmount()
getAmount
in interface Invoiceable
Invoiceable.getAmount()
public BigDecimal getAuthSubID()
public Date getBegins()
public Person getBuyer()
Invoiceable
getBuyer
in interface Invoiceable
Invoiceable.getBuyer()
protected String getCacheUniqueID()
getCacheUniqueID
in class SQLPeerDatum
SQLPeerDatum.getCacheUniqueID()
public Currency getCurrency()
getCurrency
in interface Invoiceable
Invoiceable.getAmount()
Invoiceable.getCurrency()
public String getDescription()
public Enrolment getEnrolment()
public Date getExpires()
private int getID()
public String getInvoiceID()
getInvoiceID
in interface Invoiceable
Invoiceable.getInvoiceID()
public char getInvoiceIDPrefix()
getInvoiceIDPrefix
in interface Invoiceable
Invoiceable.getInvoiceIDPrefix()
private Date getLastExpiration()
public Payment getLastPayment() throws NotFoundException
NotFoundException
- if nobody's paid anything yetpublic String getOrderCode()
public String getOrderSource()
public int getProductID()
public Date getRecurs()
public String getTitle()
getTitle
in interface Invoiceable
Invoiceable.getTitle()
public AbstractUser getUser()
public int getUserID()
public void insert() throws SQLException
SQLException
- WRITEMEpublic boolean isActive()
public boolean isRecurring()
public void killEnrolment()
public void set(ResultSet rs) throws SQLException
set
in class SQLPeerDatum
rs
- The result of an SQL query, with the cursor already
pointed at the row describing this specific instance
of the object.
SQLException
- WRITEMESQLPeerDatum.set(java.sql.ResultSet)
public void setAuthSubID(BigDecimal authSubID1)
authSubID1
- authorize.net subscription IDpublic void setAuthSubID(String authSubID2) throws NumberFormatException
authSubID2
- authorize.net subscription ID
NumberFormatException
- FIXMEpublic void setBegins(Date newBegins)
newBegins
- begin datepublic void setEnrolment(Enrolment newEnrolment)
newEnrolment
- enrolment productpublic void setExpires(Date newExpires)
newExpires
- expiry datepublic void setOrderCode(String orderCode1)
orderCode1
- order codepublic void setOrderSource(String orderSource1)
orderSource1
- order sourcepublic void setProductID(int productID1)
productID1
- enrolment productpublic void setUser(User newUser)
newUser
- user enrolledpublic void setUserID(int userID1)
userID1
- user enrolledpublic void startEnrolment()
public org.json.JSONObject toJSON()
SQLPeerDatum
toJSON
in class SQLPeerDatum
SQLPeerDatum.toJSON()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |