Class ApnsSendPushNotificationJobHandler
java.lang.Object
com.flowable.engage.notification.apns.ApnsSendPushNotificationJobHandler
- All Implemented Interfaces:
org.flowable.job.service.JobHandler
public class ApnsSendPushNotificationJobHandler
extends java.lang.Object
implements org.flowable.job.service.JobHandler
- Author:
- Filip Hrisafov
-
Field Summary
Fields Modifier and Type Field Description protected boolean
addConversationNameToTitle
protected boolean
addSenderNameToTitle
protected ApnsPushNotificationSender
apnsPushNotificationSender
protected DeviceService
deviceService
protected boolean
enableNotificationTitle
static java.lang.String
TYPE
-
Constructor Summary
Constructors Constructor Description ApnsSendPushNotificationJobHandler(DeviceService deviceService, ApnsPushNotificationSender apnsPushNotificationSender)
-
Method Summary
Modifier and Type Method Description void
execute(org.flowable.job.service.impl.persistence.entity.JobEntity job, java.lang.String configuration, org.flowable.variable.api.delegate.VariableScope variableScope, org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
protected java.lang.String
getAlertTitle(java.lang.String recipientId, java.lang.String messageId, java.lang.String conversationId, java.lang.String senderId, java.lang.String tenantId, org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
Hook method to compose the title for the push notification.protected java.lang.String
getConversationName(Conversation conversation)
Hook method to compose the conversation name used in the push notification title.protected java.lang.String
getConversationName(java.lang.String conversationId, org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
java.lang.String
getType()
protected java.lang.String
getUserName(com.flowable.core.idm.api.PlatformUser user)
Hook method to compose the sending user name in the push notification.protected java.lang.String
getUserName(java.lang.String userId, java.lang.String tenantId, org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
boolean
isAddConversationNameToTitle()
boolean
isAddSenderNameToTitle()
boolean
isEnableNotificationTitle()
protected void
sendLastReadMessage(java.lang.String recipientId, com.fasterxml.jackson.databind.JsonNode payloadMessage, org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
protected void
sendMessage(java.lang.String recipientId, com.fasterxml.jackson.databind.JsonNode payloadMessage, org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
protected void
sendPushNotificationWithBuilder(java.lang.String recipientId, java.lang.String collapseId, java.lang.String apnsId, com.turo.pushy.apns.util.ApnsPayloadBuilder payloadBuilder)
void
setAddConversationNameToTitle(boolean addConversationNameToTitle)
void
setAddSenderNameToTitle(boolean addSenderNameToTitle)
void
setEnableNotificationTitle(boolean enableNotificationTitle)
-
Field Details
-
TYPE
public static final java.lang.String TYPE- See Also:
- Constant Field Values
-
deviceService
-
apnsPushNotificationSender
-
enableNotificationTitle
protected boolean enableNotificationTitle -
addSenderNameToTitle
protected boolean addSenderNameToTitle -
addConversationNameToTitle
protected boolean addConversationNameToTitle
-
-
Constructor Details
-
ApnsSendPushNotificationJobHandler
public ApnsSendPushNotificationJobHandler(DeviceService deviceService, ApnsPushNotificationSender apnsPushNotificationSender)
-
-
Method Details
-
getType
public java.lang.String getType()- Specified by:
getType
in interfaceorg.flowable.job.service.JobHandler
-
execute
public void execute(org.flowable.job.service.impl.persistence.entity.JobEntity job, java.lang.String configuration, org.flowable.variable.api.delegate.VariableScope variableScope, org.flowable.common.engine.impl.interceptor.CommandContext commandContext)- Specified by:
execute
in interfaceorg.flowable.job.service.JobHandler
-
sendMessage
protected void sendMessage(java.lang.String recipientId, com.fasterxml.jackson.databind.JsonNode payloadMessage, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) -
getAlertTitle
protected java.lang.String getAlertTitle(java.lang.String recipientId, java.lang.String messageId, java.lang.String conversationId, java.lang.String senderId, java.lang.String tenantId, org.flowable.common.engine.impl.interceptor.CommandContext commandContext)Hook method to compose the title for the push notification. This default implementation uses the sender name and the conversation name, if available.- Parameters:
recipientId
- the id of the recipient of the push notificationmessageId
- the id of the message to be pushedconversationId
- the id of the conversation where the message was posted intosenderId
- the id of the sending usertenantId
- the tenant id of the messagecommandContext
- the command context to get further information or services, if needed
-
getUserName
protected java.lang.String getUserName(java.lang.String userId, java.lang.String tenantId, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) -
getUserName
protected java.lang.String getUserName(com.flowable.core.idm.api.PlatformUser user)Hook method to compose the sending user name in the push notification. Uses the display name, if available, otherwise first name / last name as a composition.- Parameters:
user
- the user to return its name- Returns:
- the name of the user
-
getConversationName
protected java.lang.String getConversationName(java.lang.String conversationId, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) -
getConversationName
Hook method to compose the conversation name used in the push notification title. Uses the conversation name, if available or its fallback name, otherwise null is returned.- Parameters:
conversation
- the conversation to return its name- Returns:
-
sendLastReadMessage
protected void sendLastReadMessage(java.lang.String recipientId, com.fasterxml.jackson.databind.JsonNode payloadMessage, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) -
sendPushNotificationWithBuilder
protected void sendPushNotificationWithBuilder(java.lang.String recipientId, java.lang.String collapseId, java.lang.String apnsId, com.turo.pushy.apns.util.ApnsPayloadBuilder payloadBuilder) -
isEnableNotificationTitle
public boolean isEnableNotificationTitle() -
setEnableNotificationTitle
public void setEnableNotificationTitle(boolean enableNotificationTitle) -
isAddSenderNameToTitle
public boolean isAddSenderNameToTitle() -
setAddSenderNameToTitle
public void setAddSenderNameToTitle(boolean addSenderNameToTitle) -
isAddConversationNameToTitle
public boolean isAddConversationNameToTitle() -
setAddConversationNameToTitle
public void setAddConversationNameToTitle(boolean addConversationNameToTitle)
-