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 com.erudika.para.core.Votable
Votable.VoteValue
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildPayloadAsJSON
(String event, Object payload) Builds the JSON payload object.create()
Stores this object in the data store.static boolean
propertyFilterMatches
(Webhook webhook, Object paraObjects) void
Resets the secret key by generating a new one.static void
sendEventPayloadToQueue
(String appid, String eventName, Object eventValue, Object payload) Sends out the payload object for an event to the queue for processing.void
void
void
setCreateAll
(Boolean createAll) void
setCustomEvents
(List<String> customEvents) void
setCustomPayload
(Object customPayload) void
void
setDeleteAll
(Boolean deleteAll) void
setPropertyFilter
(String propertyFilter) void
setRepeatedDeliveryAttempts
(Integer repeatedDeliveryAttempts) void
void
setTargetUrl
(String targetUrl) void
setTooManyFailures
(Boolean tooManyFailures) void
setTriggeredEvent
(String triggeredEvent) void
setTypeFilter
(String typeFilter) void
void
setUpdateAll
(Boolean updateAll) void
setUrlEncoded
(Boolean urlEncoded) void
update()
Updates the object permanently.Methods inherited from class com.erudika.para.core.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:ParaObject
Updates the object permanently. Changes toLocked
fields are ignored.- Specified by:
update
in interfaceParaObject
- Overrides:
update
in classSysprop
- See Also:
-
create
Description copied from interface:ParaObject
Stores this object in the data store.- Specified by:
create
in interfaceParaObject
- Overrides:
create
in 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
-