use of com.creditease.agent.feature.NotificationCenter in project uavstack by uavorg.
the class NotificationTask method run.
@Override
public void run() {
NotificationEvent event = (NotificationEvent) this.get(NCConstant.NCEventParam);
int priorityLevel = (int) this.get(NCConstant.PRIORITYLEVEL);
NotificationCenter nc = (NotificationCenter) this.getConfigManager().getComponent(this.feature, "NotificationCenter");
if (log.isTraceEnable()) {
log.info(this, "NotificationTask Actions START: event=" + event.toJSONString());
}
/**
* Step 1: get all actions for this event
*/
Map<String, String> args = event.getArgs(true);
Map<String, String> actionMap = new LinkedHashMap<String, String>();
for (String key : args.keySet()) {
if (key.indexOf("action_") != 0) {
continue;
}
String actionTag = key.substring("action_".length());
String actionStr = args.get(key);
/**
* find matched priority action
*/
String actionPrame = getActionParmeByPriorityLevel(actionStr, priorityLevel);
if (!StringHelper.isEmpty(actionPrame)) {
actionMap.put(actionTag, actionPrame);
}
}
/**
* Step 1.5: send notify to push notify event action
*/
String action4pushntf = new String();
actionMap.put("pushntf", action4pushntf);
/**
* Step 2: execute actions
*/
nc.executeNotifyAction(actionMap, event);
if (log.isTraceEnable()) {
log.info(this, "NotificationTask Actions END.");
}
}
Aggregations