Skip to content

Commit

Permalink
Merge pull request #84 from lucasponce/150820-smallfixes
Browse files Browse the repository at this point in the history
Small fixes
  • Loading branch information
lucasponce committed Aug 20, 2015
2 parents e1ed212 + 3658097 commit e0940af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public StandaloneActionPluginListener(Map<String, ActionPluginListener> plugins)
public void process(Action action) {
try {
init();
if (ActionPlugins.getPlugins().isEmpty()) {
if (plugins.isEmpty()) {
msgLog.warnNoPluginsFound();
return;
}
Expand All @@ -60,7 +60,7 @@ public void process(Action action) {
return;
}
String actionPlugin = action.getActionPlugin();
ActionPluginListener plugin = ActionPlugins.getPlugins().get(actionPlugin);
ActionPluginListener plugin = plugins.get(actionPlugin);
if (plugin == null) {
log.debug("Received action [" + actionPlugin +
"] but no ActionPluginListener found on this deployment");
Expand All @@ -73,6 +73,7 @@ public void process(Action action) {
Map<String, String> mixedProps = mixProperties(properties, defaultProperties);

PluginMessage pluginMessage = new StandalonePluginMessage(action, mixedProps);

plugin.process(pluginMessage);
} else {
msgLog.warnCannotAccessToDefinitionsService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ public void removeTrigger(String tenantId, String triggerId) throws Exception {
}
try {
deleteTags(tenantId, triggerId, null, null);
deleteTriggerActions(tenantId, triggerId);
List<ResultSetFuture> futures = new ArrayList<>();
futures.add(session.executeAsync(deleteDampenings.bind(tenantId, triggerId)));
futures.add(session.executeAsync(deleteConditions.bind(tenantId, triggerId)));
Expand Down Expand Up @@ -516,7 +517,7 @@ public Trigger updateTrigger(String tenantId, Trigger trigger) throws Exception
trigger.getSeverity().name(), trigger.getFiringMatch().name(),
trigger.getAutoResolveMatch().name(), trigger.isEnabled(), trigger.getTenantId(),
trigger.getId()));
deleteTriggerActions(trigger);
deleteTriggerActions(trigger.getTenantId(), trigger.getId());
insertTriggerActions(trigger);
} catch (Exception e) {
msgLog.errorDatabaseException(e.getMessage());
Expand All @@ -532,12 +533,12 @@ public Trigger updateTrigger(String tenantId, Trigger trigger) throws Exception
return trigger;
}

private void deleteTriggerActions(Trigger trigger) throws Exception {
private void deleteTriggerActions(String tenantId, String triggerId) throws Exception {
PreparedStatement deleteTriggerActions = CassStatement.get(session, CassStatement.DELETE_TRIGGER_ACTIONS);
if (deleteTriggerActions == null) {
throw new RuntimeException("updateTrigger PreparedStatement is null");
}
session.execute(deleteTriggerActions.bind(trigger.getTenantId(), trigger.getId()));
session.execute(deleteTriggerActions.bind(tenantId, triggerId));
}

@Override
Expand Down

0 comments on commit e0940af

Please sign in to comment.