private void onTriggerPause(final Trigger t) throws TriggerManagerException { final List<TriggerAction> expireActions = t.getExpireActions(); for (final TriggerAction action : expireActions) { try { logger.info("Doing expire actions for " + action.getDescription() + " for " + t); action.doAction(); } catch (final Exception e) { logger.error("Failed to do expire action " + action.getDescription() + " for " + t, e); } catch (final Throwable th) { logger.error("Failed to do expire action " + action.getDescription() + " for " + t, th); } } logger.info("Pausing Trigger " + t.getDescription()); t.setStatus(TriggerStatus.PAUSED); try { TriggerManager.this.triggerLoader.updateTrigger(t); } catch (final TriggerLoaderException e) { throw new TriggerManagerException(e); } }
for (final TriggerAction action : this.actions) { final Map<String, Object> oneActionJson = new HashMap<>(); oneActionJson.put("type", action.getType()); oneActionJson.put("actionJson", action.toJson()); actionsJson.add(oneActionJson); for (final TriggerAction expireAction : this.expireActions) { final Map<String, Object> oneExpireActionJson = new HashMap<>(); oneExpireActionJson.put("type", expireAction.getType()); oneExpireActionJson.put("actionJson", expireAction.toJson()); expireActionsJson.add(oneExpireActionJson);
action.setContext(context); action.setContext(context);
public String getDescription() { final StringBuffer actionsString = new StringBuffer(); for (final TriggerAction act : this.actions) { actionsString.append(", "); actionsString.append(act.getDescription()); } return "Trigger from " + getSource() + " with trigger condition of " + this.triggerCondition.getExpression() + " and expire condition of " + this.expireCondition.getExpression() + actionsString; }
ExecuteFlowAction act = null; for (final TriggerAction action : actions) { if (action.getType().equals(ExecuteFlowAction.type)) { act = (ExecuteFlowAction) action; break;
public String getDescription() { StringBuffer actionsString = new StringBuffer(); for(TriggerAction act : actions) { actionsString.append(", "); actionsString.append(act.getDescription()); } return "Trigger from " + getSource() + " with trigger condition of " + triggerCondition.getExpression() + " and expire condition of " + expireCondition.getExpression() + actionsString; }
ExecuteFlowAction act = null; for(TriggerAction action : actions) { if(action.getType().equals(ExecuteFlowAction.type)) { act = (ExecuteFlowAction) action; break;
for (final TriggerAction action : actions) { try { logger.info("Doing trigger actions " + action.getDescription() + " for " + t); action.doAction(); } catch (final ExecutorManagerException e) { if (e.getReason() == ExecutorManagerException.Reason.SkippedExecution) { logger.info("Skipped action [" + action.getDescription() + "] for [" + t + "] because: " + e.getMessage()); } else { logger.error("Failed to do action [" + action.getDescription() + "] for [" + t + "]", e); logger.error("Failed to do action [" + action.getDescription() + "] for [" + t + "]", th);
for (final TriggerAction action : this.actions) { final Map<String, Object> oneActionJson = new HashMap<>(); oneActionJson.put("type", action.getType()); oneActionJson.put("actionJson", action.toJson()); actionsJson.add(oneActionJson); for (final TriggerAction expireAction : this.expireActions) { final Map<String, Object> oneExpireActionJson = new HashMap<>(); oneExpireActionJson.put("type", expireAction.getType()); oneExpireActionJson.put("actionJson", expireAction.toJson()); expireActionsJson.add(oneExpireActionJson);
public String getDescription() { final StringBuffer actionsString = new StringBuffer(); for (final TriggerAction act : this.actions) { actionsString.append(", "); actionsString.append(act.getDescription()); } return "Trigger from " + getSource() + " with trigger condition of " + this.triggerCondition.getExpression() + " and expire condition of " + this.expireCondition.getExpression() + actionsString; }
ExecuteFlowAction act = null; for (final TriggerAction action : actions) { if (action.getType().equals(ExecuteFlowAction.type)) { act = (ExecuteFlowAction) action; break;
action.setContext(context); action.setContext(context);
private void onTriggerPause(final Trigger t) throws TriggerManagerException { final List<TriggerAction> expireActions = t.getExpireActions(); for (final TriggerAction action : expireActions) { try { logger.info("Doing expire actions for " + action.getDescription() + " for " + t); action.doAction(); } catch (final Exception e) { logger.error("Failed to do expire action " + action.getDescription() + " for " + t, e); } catch (final Throwable th) { logger.error("Failed to do expire action " + action.getDescription() + " for " + t, th); } } logger.info("Pausing Trigger " + t.getDescription()); t.setStatus(TriggerStatus.PAUSED); try { TriggerManager.this.triggerLoader.updateTrigger(t); } catch (final TriggerLoaderException e) { throw new TriggerManagerException(e); } }
for(TriggerAction action : actions) { Map<String, Object> oneActionJson = new HashMap<String, Object>(); oneActionJson.put("type", action.getType()); oneActionJson.put("actionJson", action.toJson()); actionsJson.add(oneActionJson); for(TriggerAction expireAction : expireActions) { Map<String, Object> oneExpireActionJson = new HashMap<String, Object>(); oneExpireActionJson.put("type", expireAction.getType()); oneExpireActionJson.put("actionJson", expireAction.toJson()); expireActionsJson.add(oneExpireActionJson);
action.setContext(context); action.setContext(context);
private void onTriggerTrigger(final Trigger t) throws TriggerManagerException { final List<TriggerAction> actions = t.getTriggerActions(); for (final TriggerAction action : actions) { try { logger.info("Doing trigger actions " + action.getDescription() + " for " + t); action.doAction(); } catch (final Exception e) { logger.error("Failed to do action " + action.getDescription() + " for " + t, e); } catch (final Throwable th) { logger.error("Failed to do action " + action.getDescription() + " for " + t, th); } } if (t.isResetOnTrigger()) { t.resetTriggerConditions(); } else { logger.info("NextCheckTime did not change. Setting status to expired for trigger" + t.getTriggerId()); t.setStatus(TriggerStatus.EXPIRED); } try { TriggerManager.this.triggerLoader.updateTrigger(t); } catch (final TriggerLoaderException e) { throw new TriggerManagerException(e); } }
private void onTriggerTrigger(Trigger t) throws TriggerManagerException { List<TriggerAction> actions = t.getTriggerActions(); for(TriggerAction action : actions) { try { logger.info("Doing trigger actions"); action.doAction(); } catch (Exception e) { // TODO Auto-generated catch block //throw new TriggerManagerException("action failed to execute", e); logger.error("Failed to do action " + action.getDescription(), e); } catch (Throwable th) { logger.error("Failed to do action " + action.getDescription(), th); } } if(t.isResetOnTrigger()) { t.resetTriggerConditions(); t.resetExpireCondition(); } else { t.setStatus(TriggerStatus.EXPIRED); } try { triggerLoader.updateTrigger(t); } catch (TriggerLoaderException e) { throw new TriggerManagerException(e); } }
private void onTriggerExpire(Trigger t) throws TriggerManagerException { List<TriggerAction> expireActions = t.getExpireActions(); for(TriggerAction action : expireActions) { try { logger.info("Doing expire actions"); action.doAction(); } catch (Exception e) { // TODO Auto-generated catch block //throw new TriggerManagerException("action failed to execute", e); logger.error("Failed to do expire action " + action.getDescription(), e); } catch (Throwable th) { logger.error("Failed to do expire action " + action.getDescription(), th); } } if(t.isResetOnExpire()) { t.resetTriggerConditions(); t.resetExpireCondition(); // updateTrigger(t); } else { t.setStatus(TriggerStatus.EXPIRED); } try { triggerLoader.updateTrigger(t); } catch (TriggerLoaderException e) { throw new TriggerManagerException(e); } }