Package com.hellosign.sdk.resource
Class Event
- java.lang.Object
-
- com.hellosign.sdk.resource.AbstractResource
-
- com.hellosign.sdk.resource.Event
-
public class Event extends AbstractResource
This is a utility class for assisting with the development of callback services to respond to HelloSign events.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EVENT_HASH
static java.lang.String
EVENT_KEY
static java.lang.String
EVENT_MESSAGE
static java.lang.String
EVENT_METADATA
static java.lang.String
EVENT_TIME
static java.lang.String
EVENT_TYPE
static java.lang.String
HASH_ALGORITHM
protected static char[]
hexArray
static java.lang.String
RELATED_SIGNATURE_ID
static java.lang.String
REPORTED_FOR_ACCOUNT_ID
static java.lang.String
REPORTED_FOR_APP_ID
-
Fields inherited from class com.hellosign.sdk.resource.AbstractResource
dataObj, warnings
-
-
Constructor Summary
Constructors Constructor Description Event(org.json.JSONObject json)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAccountId()
Returns the account ID that this event is reporting for.java.lang.String
getAppId()
Returns the API app ID for which this event is reported.java.util.Date
getEventDate()
Returns the event time as a Java Date object.java.lang.String
getEventMessage()
Returns the message if any from the eventjava.lang.String
getHash()
Returns the unique hash string identifying this event.Signature
getRelatedSignature()
Returns the associated Signature object with this event, if the event is associated with a Signature Request.java.lang.String
getRelatedSignatureId()
Returns the signature ID to which this event is associated.SignatureRequest
getSignatureRequest()
Returns a reference to the SignatureRequest that is attached to the Event.Template
getTemplate()
Returns a reference to the Template that is attached to the Event.EventType
getType()
Returns the EventType for this event.java.lang.String
getTypeString()
Returns the event type String.boolean
hasAccountId()
Returns true if this event has a "reported_for_account_id" field.boolean
hasAppId()
Returns true if this event has a "reported_for_app_id" field.boolean
hasRelatedSignatureId()
Utility method to determine if this event has a related signature ID.boolean
hasSignatureRequest()
Returns true if this Event is associated with a Signature Request.boolean
hasTemplate()
Returns true if this event is associated with a Template.boolean
isValid(java.lang.String apiKey)
Returns true if the event hash matches the computed hash using the provided API key.java.lang.String
toString()
Displays the Signature Request in addition to the Event data.-
Methods inherited from class com.hellosign.sdk.resource.AbstractResource
add, addToList, clearList, get, getBoolean, getConstructor, getDate, getInteger, getJSONObject, getList, getList, getLong, getObject, getString, getWarnings, has, hasString, set, toString
-
-
-
-
Field Detail
-
EVENT_KEY
public static final java.lang.String EVENT_KEY
- See Also:
- Constant Field Values
-
EVENT_METADATA
public static final java.lang.String EVENT_METADATA
- See Also:
- Constant Field Values
-
REPORTED_FOR_ACCOUNT_ID
public static final java.lang.String REPORTED_FOR_ACCOUNT_ID
- See Also:
- Constant Field Values
-
REPORTED_FOR_APP_ID
public static final java.lang.String REPORTED_FOR_APP_ID
- See Also:
- Constant Field Values
-
RELATED_SIGNATURE_ID
public static final java.lang.String RELATED_SIGNATURE_ID
- See Also:
- Constant Field Values
-
EVENT_TYPE
public static final java.lang.String EVENT_TYPE
- See Also:
- Constant Field Values
-
EVENT_TIME
public static final java.lang.String EVENT_TIME
- See Also:
- Constant Field Values
-
EVENT_HASH
public static final java.lang.String EVENT_HASH
- See Also:
- Constant Field Values
-
EVENT_MESSAGE
public static final java.lang.String EVENT_MESSAGE
- See Also:
- Constant Field Values
-
HASH_ALGORITHM
public static final java.lang.String HASH_ALGORITHM
- See Also:
- Constant Field Values
-
hexArray
protected static final char[] hexArray
-
-
Constructor Detail
-
Event
public Event(org.json.JSONObject json) throws HelloSignException
Default constructor. Provide this constructor with the JSONObject created from the API response.- Parameters:
json
- JSONObject- Throws:
HelloSignException
- thrown if there is a problem parsing the JSONObject.
-
-
Method Detail
-
getAccountId
public java.lang.String getAccountId() throws HelloSignException
Returns the account ID that this event is reporting for.- Returns:
- String
- Throws:
HelloSignException
- thrown if there is a problem parsing the backing JSON object.
-
hasAccountId
public boolean hasAccountId()
Returns true if this event has a "reported_for_account_id" field.- Returns:
- true or false if it does not have an account ID
-
getAppId
public java.lang.String getAppId() throws HelloSignException
Returns the API app ID for which this event is reported.- Returns:
- String
- Throws:
HelloSignException
- thrown if there is a problem parsing the backing JSONObject.
-
hasAppId
public boolean hasAppId()
Returns true if this event has a "reported_for_app_id" field.- Returns:
- boolean
-
getEventDate
public java.util.Date getEventDate()
Returns the event time as a Java Date object.- Returns:
- Date
-
getEventMessage
public java.lang.String getEventMessage() throws HelloSignException
Returns the message if any from the event- Returns:
- String
- Throws:
HelloSignException
- thrown if there is a problem parsing the backing JSONObject.
-
getRelatedSignatureId
public java.lang.String getRelatedSignatureId()
Returns the signature ID to which this event is associated.- Returns:
- String
-
hasRelatedSignatureId
public boolean hasRelatedSignatureId()
Utility method to determine if this event has a related signature ID.- Returns:
- true if this field exists and is set, false otherwise
-
getRelatedSignature
public Signature getRelatedSignature() throws HelloSignException
Returns the associated Signature object with this event, if the event is associated with a Signature Request.- Returns:
- Signature
- Throws:
HelloSignException
- thrown if there is a problem parsing the backing JSONObject.
-
getSignatureRequest
public SignatureRequest getSignatureRequest()
Returns a reference to the SignatureRequest that is attached to the Event.- Returns:
- SignatureRequest
-
hasSignatureRequest
public boolean hasSignatureRequest()
Returns true if this Event is associated with a Signature Request.- Returns:
- boolean
-
getTemplate
public Template getTemplate()
Returns a reference to the Template that is attached to the Event.- Returns:
- Template
-
hasTemplate
public boolean hasTemplate()
Returns true if this event is associated with a Template.- Returns:
- boolean
-
getType
public EventType getType()
Returns the EventType for this event.- Returns:
- EventType enum
-
getTypeString
public java.lang.String getTypeString()
Returns the event type String.- Returns:
- String event type
-
getHash
public java.lang.String getHash()
Returns the unique hash string identifying this event.- Returns:
- String hash
-
isValid
public boolean isValid(java.lang.String apiKey) throws HelloSignException
Returns true if the event hash matches the computed hash using the provided API key.- Parameters:
apiKey
- String api key.- Returns:
- true if the hashes match, false otherwise
- Throws:
HelloSignException
- thrown if there is a problem parsing the API key.
-
toString
public java.lang.String toString()
Displays the Signature Request in addition to the Event data.- Overrides:
toString
in classAbstractResource
-
-