net.rim.pushsdk.subscription
Class Subscriber

java.lang.Object
  extended by net.rim.pushsdk.subscription.SubscriberPartial
      extended by net.rim.pushsdk.subscription.Subscriber
All Implemented Interfaces:
Serializable

public class Subscriber
extends SubscriberPartial
implements Serializable

Represents a subscriber to a push application.

Author:
mdandrea
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.rim.pushsdk.subscription.SubscriberPartial
address, status, subscriberPrimaryKey, type
 
Constructor Summary
Subscriber()
          Constructs a subscriber to a push application.
Subscriber(Subscriber subscriber)
          Copy Constructor.
Subscriber(SubscriberPartial subPartial)
          Constructs a subscriber to a push application setting all fields from the partial details.
Subscriber(SubscriberPrimaryKey subscriberPrimaryKey)
          Constructs a subscriber to a push application.
Subscriber(SubscriberPrimaryKey subscriberPrimaryKey, String address)
          Constructs a subscriber to a push application.
 
Method Summary
 boolean equals(Object obj)
          Returns true if two subscribers are found to be equal and false otherwise.
 Integer getConsecutiveFailedPushCount()
          Gets a count of the number of consecutive failed pushes to this subscriber.
 String getModel()
          Gets the current BlackBerry model number of the subscriber.
 String getOsVersion()
          Gets the current OS version of the subscriber.
 Date getResumeDate()
          Gets the date at which a subscriber's subscription to a push application was resumed.
 Date getSubscribeDate()
          Gets the date at which a subscriber subscribed to a push application.
 SubscriberPartial getSubscriberPartial()
          Gets partial details for this subscriber.
 Date getSuspendDate()
          Gets the date at which a subscriber's subscription to a push application was suspended.
 Date getUnsubscribeDate()
          Gets the date at which a subscriber unsubscribed from a push application.
 int hashCode()
          Returns a hashcode for this subscriber.
protected  void setConsecutiveFailedPushCount(Integer consecutiveFailedPushCount)
          Sets the number of consecutive failed pushes to this subscriber.
 void setModel(String model)
          Sets the current BlackBerry model number of the subscriber.
 void setOsVersion(String osVersion)
          Sets the current OS version of the subscriber.
protected  void setResumeDate(Date resumeDate)
          Sets the date at which a subscriber's subscription to a push application was resumed.
protected  void setSubscribeDate(Date subscribeDate)
          Sets the date at which a subscriber subscribed to a push application.
protected  void setSuspendDate(Date suspendDate)
          Sets the date at which a subscriber's subscription to a push application was suspended.
protected  void setUnsubscribeDate(Date unsubscribeDate)
          Sets the date at which a subscriber unsubscribed from a push application.
 String toString()
          Constructs a String with all attributes in name = value format.
 void validate()
          Validates a subscriber by verifying that it has i) a non-null OS version, ii) a non-null model number, iii) a non-null subscription date, iv) a subscription date that was in the past, v) as well as performing the same validation as a partial subscriber.
 
Methods inherited from class net.rim.pushsdk.subscription.SubscriberPartial
getAddress, getId, getPushApplicationId, getStatus, getSubscriberPrimaryKey, getType, setAddress, setStatus, setSubscriberPrimaryKey, setType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Subscriber

public Subscriber(Subscriber subscriber)
Copy Constructor.

Parameters:
subscriber - a Subscriber object

Subscriber

public Subscriber()
Constructs a subscriber to a push application.


Subscriber

public Subscriber(SubscriberPartial subPartial)
Constructs a subscriber to a push application setting all fields from the partial details.

Parameters:
subPartial - a subscriber with partial details

Subscriber

public Subscriber(SubscriberPrimaryKey subscriberPrimaryKey,
                  String address)
Constructs a subscriber to a push application.

Parameters:
subscriberPrimaryKey - the primary key of a subscriber
address - the address (e.g. PIN or email address) of a subscriber

Subscriber

public Subscriber(SubscriberPrimaryKey subscriberPrimaryKey)
Constructs a subscriber to a push application.

Parameters:
subscriberPrimaryKey - the primary key of a subscriber
Method Detail

getOsVersion

public String getOsVersion()
Gets the current OS version of the subscriber.

Returns:
the OS version

setOsVersion

public void setOsVersion(String osVersion)
Sets the current OS version of the subscriber.

Parameters:
osVersion - an OS version number

getModel

public String getModel()
Gets the current BlackBerry model number of the subscriber.

Returns:
the BlackBerry model number

setModel

public void setModel(String model)
Sets the current BlackBerry model number of the subscriber.

Parameters:
model - a BlackBerry model number.

getSubscribeDate

public Date getSubscribeDate()
Gets the date at which a subscriber subscribed to a push application.

Returns:
the subscribe date

setSubscribeDate

protected void setSubscribeDate(Date subscribeDate)
Sets the date at which a subscriber subscribed to a push application.

Parameters:
subscribeDate - the subscribe date

getUnsubscribeDate

public Date getUnsubscribeDate()
Gets the date at which a subscriber unsubscribed from a push application.

Returns:
the unsubscribe date

setUnsubscribeDate

protected void setUnsubscribeDate(Date unsubscribeDate)
Sets the date at which a subscriber unsubscribed from a push application.

Parameters:
unsubscribeDate - the unsubscribe date

getSuspendDate

public Date getSuspendDate()
Gets the date at which a subscriber's subscription to a push application was suspended.

Returns:
the suspension date

setSuspendDate

protected void setSuspendDate(Date suspendDate)
Sets the date at which a subscriber's subscription to a push application was suspended.

Parameters:
suspendDate - the suspension date

getResumeDate

public Date getResumeDate()
Gets the date at which a subscriber's subscription to a push application was resumed.

Returns:
the resumption date

setResumeDate

protected void setResumeDate(Date resumeDate)
Sets the date at which a subscriber's subscription to a push application was resumed.

Parameters:
resumeDate - the resumption date

getConsecutiveFailedPushCount

public Integer getConsecutiveFailedPushCount()
Gets a count of the number of consecutive failed pushes to this subscriber. If a success is encountered, this count is reset back to 0.

Returns:
the consecutive failed pushes count

setConsecutiveFailedPushCount

protected void setConsecutiveFailedPushCount(Integer consecutiveFailedPushCount)
Sets the number of consecutive failed pushes to this subscriber.

Parameters:
consecutiveFailedPushCount - the consecutive failed pushes count

getSubscriberPartial

public SubscriberPartial getSubscriberPartial()
Gets partial details for this subscriber.

Returns:
a subscriber with partial details

validate

public void validate()
Validates a subscriber by verifying that it has i) a non-null OS version, ii) a non-null model number, iii) a non-null subscription date, iv) a subscription date that was in the past, v) as well as performing the same validation as a partial subscriber.

Overrides:
validate in class SubscriberPartial
Throws:
IllegalArgumentException - if validation fails

hashCode

public int hashCode()
Returns a hashcode for this subscriber.

Overrides:
hashCode in class SubscriberPartial
Returns:
a hashcode for this subscriber

equals

public boolean equals(Object obj)
Returns true if two subscribers are found to be equal and false otherwise.

Overrides:
equals in class SubscriberPartial
Returns:
whether two subscribers are equal

toString

public String toString()
Constructs a String with all attributes in name = value format.

Overrides:
toString in class SubscriberPartial
Returns:
a String representation of this object.


Copyright © 2011 Research In Motion. All Rights Reserved.