Skip to content

Commit

Permalink
0002284: Additional improvements to the performance of the edit table…
Browse files Browse the repository at this point in the history
… triggers screen
  • Loading branch information
chenson42 committed Apr 28, 2015
1 parent 5c8c90f commit b42b9a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Expand Up @@ -38,7 +38,9 @@
*/
public interface ITriggerRouterService {

public boolean refreshFromDatabase();
public boolean refreshFromDatabase();

public List<TriggerHistory> getActiveTriggerHistoriesFromCache();

public List<TriggerHistory> getActiveTriggerHistories();

Expand Down
Expand Up @@ -385,14 +385,24 @@ public TriggerHistory getNewestTriggerHistoryForTrigger(String triggerId, String
}
return null;
}

@SuppressWarnings("unchecked")
@Override
public List<TriggerHistory> getActiveTriggerHistoriesFromCache() {
return new ArrayList<TriggerHistory>(historyMap != null ? historyMap.values() : Collections.EMPTY_LIST);
}

/**
* Get a list of trigger histories that are currently active
*/
public List<TriggerHistory> getActiveTriggerHistories() {
return sqlTemplate.query(getSql("allTriggerHistSql", "activeTriggerHistSql"),
List<TriggerHistory> histories = sqlTemplate.query(getSql("allTriggerHistSql", "activeTriggerHistSql"),
new TriggerHistoryMapper());
}
for (TriggerHistory triggerHistory : histories) {
historyMap.put(triggerHistory.getTriggerHistoryId(), triggerHistory);
}
return histories;
}

public List<TriggerHistory> getActiveTriggerHistories(String tableName) {
return sqlTemplate.query(getSql("allTriggerHistSql", "triggerHistBySourceTableWhereSql"),
Expand Down Expand Up @@ -893,6 +903,7 @@ public Map<String, List<TriggerRouter>> getTriggerRoutersByChannel(String nodeGr

public void insert(TriggerHistory newHistRecord) {
newHistRecord.setTriggerHistoryId((int)sequenceService.nextVal(Constants.SEQUENCE_TRIGGER_HIST));
historyMap.put(newHistRecord.getTriggerHistoryId(), newHistRecord);
sqlTemplate.update(
getSql("insertTriggerHistorySql"),
new Object[] { newHistRecord.getTriggerHistoryId(), newHistRecord.getTriggerId(), newHistRecord.getSourceTableName(),
Expand Down

0 comments on commit b42b9a3

Please sign in to comment.