Class Webhook
java.lang.Object
com.erudika.para.core.Sysprop
com.erudika.para.core.Webhook
- All Implemented Interfaces:
Linkable, ParaObject, Votable, Serializable
Represents a webhook registration.
- Author:
- Alex Bogdanovski [[email protected]]
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Votable
Votable.VoteValue -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildPayloadAsJSON(String event, Object payload) Builds the JSON payload object.create()Stores this object in the data store.static booleanpropertyFilterMatches(Webhook webhook, Object payload) voidResets the secret key by generating a new one.static voidsendEventPayloadToQueue(String appid, String eventName, Object eventValue, Object payload) Sends out the payload object for an event to the queue for processing.voidvoidvoidsetCreateAll(Boolean createAll) voidsetCustomEvents(List<String> customEvents) voidsetCustomPayload(Object customPayload) voidvoidsetDeleteAll(Boolean deleteAll) voidsetPropertyFilter(String propertyFilter) voidsetRepeatedDeliveryAttempts(Integer repeatedDeliveryAttempts) voidvoidsetTargetUrl(String targetUrl) voidsetTooManyFailures(Boolean tooManyFailures) voidsetTriggeredEvent(String triggeredEvent) voidsetTypeFilter(String typeFilter) voidvoidsetUpdateAll(Boolean updateAll) voidsetUrlEncoded(Boolean urlEncoded) voidupdate()Updates the object permanently.Methods inherited from class Sysprop
addProperty, countChildren, countLinks, delete, deleteChildren, equals, exists, findChildren, findLinkedObjects, getAppid, getCached, getChildren, getChildren, getCreatorid, getId, getIndexed, getLinkedObjects, getLinks, getName, getObjectURI, getParentid, getPlural, getProperties, getProperty, getStored, getTags, getTimestamp, getType, getUpdated, getVersion, getVotes, hashCode, hasProperty, isLinked, isLinked, link, removeProperty, setAppid, setCached, setCreatorid, setId, setIndexed, setName, setParentid, setProperties, setStored, setTags, setTimestamp, setType, setUpdated, setVersion, setVotes, toString, unlink, unlinkAll, voteDown, voteUp
-
Constructor Details
-
Webhook
public Webhook()No-args constructor. -
Webhook
Default constructor.- Parameters:
targetUrl- the URL where the payload will be sent
-
-
Method Details
-
getTargetUrl
- Returns:
- the target URL
-
setTargetUrl
- Parameters:
targetUrl- target URL value
-
getSecret
- Returns:
- the webhook secret key
-
setSecret
- Parameters:
secret- webhook secret key
-
getTypeFilter
- Returns:
- type filter
-
setTypeFilter
- Parameters:
typeFilter- type filter
-
getPropertyFilter
- Returns:
- property filter
-
setPropertyFilter
- Parameters:
propertyFilter- property filter
-
getUrlEncoded
- Returns:
- if false, JSON is returned, otherwise x-www-form-urlencoded
-
setUrlEncoded
- Parameters:
urlEncoded- false for JSON payloads
-
getActive
- Returns:
- if false, nothing is sent to
targetUrl.
-
setActive
- Parameters:
active- if false, nothing is sent totargetUrl.
-
getTooManyFailures
- Returns:
- true if this was disabled by the system
-
setTooManyFailures
- Parameters:
tooManyFailures- don't set this manually
-
getCreate
- Returns:
- true if subscribed to DAO.create() methods
-
setCreate
- Parameters:
create- set to true to subscribe to create methods
-
getUpdate
- Returns:
- true if subscribed to DAO.update() methods
-
setUpdate
- Parameters:
update- set to true to subscribe to update methods
-
getDelete
- Returns:
- true if subscribed to DAO.delete() methods
-
setDelete
- Parameters:
delete- set to true to subscribe to delete methods
-
getCreateAll
- Returns:
- true if subscribed to DAO.createAll() methods
-
setCreateAll
- Parameters:
createAll- set to true to subscribe to createAll methods
-
getUpdateAll
- Returns:
- true if subscribed to DAO.updateAll() methods
-
setUpdateAll
- Parameters:
updateAll- set to true to subscribe to updateAll methods
-
getDeleteAll
- Returns:
- true if subscribed to DAO.deleteAll() methods
-
setDeleteAll
- Parameters:
deleteAll- set to true to subscribe to deleteAll methods
-
getCustomEvents
-
setCustomEvents
-
getTriggeredEvent
- Returns:
- the name of the custom event to be triggered
-
setTriggeredEvent
- Parameters:
triggeredEvent- custom event name
-
getCustomPayload
- Returns:
- the custom payload object
-
setCustomPayload
- Parameters:
customPayload- set the custom payload object which will be sent when a custom event is triggered
-
getRepeatedDeliveryAttempts
- Returns:
- the number of times to deliver the same payload to target.
-
setRepeatedDeliveryAttempts
- Parameters:
repeatedDeliveryAttempts- the number of times to deliver the same payload to target.
-
resetSecret
public void resetSecret()Resets the secret key by generating a new one. -
update
public void update()Description copied from interface:ParaObjectUpdates the object permanently. Changes toLockedfields are ignored.- Specified by:
updatein interfaceParaObject- Overrides:
updatein classSysprop- See Also:
-
create
Description copied from interface:ParaObjectStores this object in the data store.- Specified by:
createin interfaceParaObject- Overrides:
createin classSysprop- Returns:
- the id of the object (a new id if object is new)
- See Also:
-
buildPayloadAsJSON
-
sendEventPayloadToQueue
public static void sendEventPayloadToQueue(String appid, String eventName, Object eventValue, Object payload) Sends out the payload object for an event to the queue for processing.- Parameters:
appid- appideventName- event name like "create", "delete" or "customEvents"eventValue- event value - for custom events this is the name of the custom eventpayload- the payload
-
propertyFilterMatches
-