Modifier and Type | Field and Description |
---|---|
protected Properties |
appProperties |
protected TokenNotificationTrackerService<T> |
notificationCountTracker |
Constructor and Description |
---|
AbstractNotificationHelper() |
Modifier and Type | Method and Description |
---|---|
Map |
addFeedback(ChildTokenEvent<T> event,
T token,
Feedback feedback)
TokenNotificationTrackerService.keepCount(Token, FlowStatus) + Add Feedback |
Map |
addFeedback(TokenEvent<T> causeEvent,
FlowStatus status,
T token,
Feedback feedback)
Add Feedback
|
protected Map<String,String> |
defineMessageAttributes(Attributes entity,
Map<String,?> entityAttributes)
Using Entity Attributes convert them into message attributes such that final keys are {$<entity class simple name>.<attrib name>}
|
boolean |
evaluateCurrentActionNotifyConfigs(String notifyActionConfigSuffix,
Behaviors behaviorsContainer)
Check for Server config (constructed key by using the param notifyActionConfigSuffix), and if none exists
then rely on any override, and if even that does not exist then by default return true,
|
String |
getBroadcastMessage(String broadCastId,
String shiftName)
Message template variables {N} where N is:
{0} -
Displayable.getDisplayName() - Shift Display Name
|
protected String |
getMessage(String fullKey,
Map<String,String> attributes,
String... params) |
String |
getMessage(TokenEvent.TokenEventType e,
String shiftName,
String tokenName)
Deprecated.
|
String |
getMessage(TokenEvent.TokenEventType e,
T token)
Message template variables {N} where N is:
{0} -
Displayable.getDisplayName() - Shift Display Name
{1} - Displayable.getDisplayName() - Token Display Name
|
abstract Integer |
getNextNToNotify()
Smart notifications > Ripple effect : If >0 means N other people who are impacted by a status update of someone else will also be notified.
access.q.user.notify.nextNToNotify <=0; means this is false else true |
TokenNotificationTrackerService<T> |
getNotificationCountTracker() |
protected abstract String |
getNotifyMessagesKeyPrefix() |
org.springframework.context.MessageSource |
getNotifyMsgResource() |
String |
getProperty(String fullKey)
Get a property from the settings (static or dynamic).
|
abstract <C> boolean |
ignore(C consumer)
To ignore the Consumer or contact.
|
void |
init() |
abstract boolean |
isNotificationEnabled()
true if notifications enabled else false for global shut
|
Boolean |
isNotifyOn(Object action)
Generic service method for notification on any action.
|
abstract boolean |
isNotifyOthers()
Smart notifications > Ripple effect : If true means other people who are impacted by a status update of someone else will also be notified.
|
void |
setNotificationCountTracker(TokenNotificationTrackerService<T> notificationCountTracker) |
void |
setNotifyMsgResource(org.springframework.context.MessageSource notifyMsgResource) |
<E extends ChildTokenEvent<T>> |
setupNotificationEvent(TokenEvent<T> parentEvent,
E notifyCustomerEvent,
List<E> notifyEvents)
|
@Autowired @Qualifier(value="appConfiguration") protected Properties appProperties
protected TokenNotificationTrackerService<T extends Token<T>> notificationCountTracker
@PostConstruct public void init()
public Map addFeedback(ChildTokenEvent<T> event, T token, Feedback feedback)
TokenNotificationTrackerService.keepCount(Token, FlowStatus)
+ Add Feedbackevent
- as ChildTokenEvent
causing the feedback. This event could represent a ripple effect or first impact. (not nec.. root event)token
- as Token
whose feedback to addfeedback
- as Feedback
Map
of Token Id and Notification type sentpublic <E extends ChildTokenEvent<T>> void setupNotificationEvent(TokenEvent<T> parentEvent, E notifyCustomerEvent, List<E> notifyEvents)
parentEvent
- as TokenEvent
, nullable truenotifyCustomerEvent
- as MessageTokenEvent
, not nullablenotifyEvents
- as batch of MessageTokenEvent
s to generate for batch notification, not nullablepublic Map addFeedback(TokenEvent<T> causeEvent, FlowStatus status, T token, Feedback feedback)
causeEvent
- as TokenEvent
that cause of the current Feedback
for the current Token
status
- as FlowStatus
token
- as Token
for which we want to add Feedback
feedback
- as Feedback
Map
of Token Id and Notification type sentpublic String getMessage(TokenEvent.TokenEventType e, T token)
Displayable.getDisplayName()
- Shift Display NameDisplayable.getDisplayName()
- Token Display Namee
- as TokenEvent.TokenEventType
token
- as Token
#getNotifyMessagesKeyPrefix()}
,
getBroadcastMessage(String, String)
@Deprecated public String getMessage(TokenEvent.TokenEventType e, String shiftName, String tokenName)
e
- as TokenEvent.TokenEventType
shiftName
- aa String for TokenContainer.getName()
tokenName
- as String for Displayable.getDisplayName()
#getMessage(TokenEventType, Token)
public String getBroadcastMessage(String broadCastId, String shiftName)
Displayable.getDisplayName()
- Shift Display NamebroadCastId
- is the TokenEvent.TokenEventType
name or any other it that is appended to getNotifyMessagesKeyPrefix()
shiftName
- as String#getNotifyMessagesKeyPrefix()}
protected abstract String getNotifyMessagesKeyPrefix()
public String getProperty(String fullKey)
fullKey
- as String includes namespaceappProperties
protected String getMessage(String fullKey, Map<String,String> attributes, String... params)
fullKey
- attributes
- as Map
of String to Strin, of key / values to substitute in message. Where an attribute key will be searched in the String, if it matches then will be replaced by valueparams
- as String .s | {0} Shift
Name , {1} Token Display Codeprotected Map<String,String> defineMessageAttributes(Attributes entity, Map<String,?> entityAttributes)
entity
- to use as prefix. If null then only attribute name is used within {$...}entityAttributes
- as the core Entity Attributes, key is String and value is of type Attribute
public abstract boolean isNotificationEnabled()
public Boolean isNotifyOn(Object action)
CurrentActionNotifyBehavior
else
an action defined in the properties as getNotifyMessagesKeyPrefix()
.<action>Notify, where action
can be String or Enum.name()
.
action
- as String (property name or name of an action) or AddOnBehavior
or any app specific type or TokenEvent.TokenEventType
getNotifyMessagesKeyPrefix()
public boolean evaluateCurrentActionNotifyConfigs(String notifyActionConfigSuffix, Behaviors behaviorsContainer)
notifyActionConfigSuffix
- as String appended. See NotificationHelper#isNotifyOn(Object)
behaviorsContainer
- as Behaviors
public abstract boolean isNotifyOthers()
#
public abstract Integer getNextNToNotify()
public abstract <C> boolean ignore(C consumer)
token
- as Consumer or contact numberpublic org.springframework.context.MessageSource getNotifyMsgResource()
public void setNotifyMsgResource(org.springframework.context.MessageSource notifyMsgResource)
public TokenNotificationTrackerService<T> getNotificationCountTracker()
public void setNotificationCountTracker(TokenNotificationTrackerService<T> notificationCountTracker)
Copyright © 2018. All rights reserved.