@Test public void getHistoryLevelFromTest() { HistoryLevelDeterminatorJdbcTemplateImpl determinator = new HistoryLevelDeterminatorJdbcTemplateImpl(); assertEquals(determinator.getDefaultHistoryLevel(), determinator.getHistoryLevelFrom(-1)); assertFalse(determinator.historyLevels.isEmpty()); HistoryLevel customHistoryLevel = new HistoryLevel() { @Override public boolean isHistoryEventProduced(HistoryEventType eventType, Object entity) { return false; } @Override public String getName() { return "custom"; } @Override public int getId() { return Integer.MAX_VALUE; } }; determinator.addCustomHistoryLevels(Collections.singleton(customHistoryLevel)); assertTrue(determinator.historyLevels.contains(customHistoryLevel)); for (HistoryLevel historyLevel : determinator.historyLevels) { assertEquals(historyLevel.getName(), determinator.getHistoryLevelFrom(historyLevel.getId())); } }
protected String getHistoryLevelFrom(Integer historyLevelFromDb) { String result = defaultHistoryLevel; if (historyLevelFromDb != null) { for (HistoryLevel historyLevel : historyLevels) { if (historyLevel.getId() == historyLevelFromDb.intValue()) { result = historyLevel.getName(); log.debug("found matching history level '{}'", result); break; } } } return result; }
HistoryLevelDeterminatorJdbcTemplateImpl implements HistoryLevelDeterminator, InitializingBean { protected String getHistoryLevelFrom(Integer historyLevelFromDb) { String result = defaultHistoryLevel; if (historyLevelFromDb != null) { for (HistoryLevel historyLevel : historyLevels) { if (historyLevel.getId() == historyLevelFromDb.intValue()) { result = historyLevel.getName(); log.debug("found matching history level '{}'", result); break; } } } return result; } }
HistoryLevelDeterminatorJdbcTemplateImpl implements HistoryLevelDeterminator, InitializingBean { protected String getHistoryLevelFrom(Integer historyLevelFromDb) { String result = defaultHistoryLevel; if (historyLevelFromDb != null) { for (HistoryLevel historyLevel : historyLevels) { if (historyLevel.getId() == historyLevelFromDb.intValue()) { result = historyLevel.getName(); log.debug("found matching history level '{}'", result); break; } } } return result; }  }
HistoryLevelDeterminatorJdbcTemplateImpl implements HistoryLevelDeterminator, InitializingBean { protected String getHistoryLevelFrom(Integer historyLevelFromDb) { String result = defaultHistoryLevel; if (historyLevelFromDb != null) { for (HistoryLevel historyLevel : historyLevels) { if (historyLevel.getId() == historyLevelFromDb.intValue()) { result = historyLevel.getName(); log.debug("found matching history level '{}'", result); break; } } } return result; }  static HistoryLevelDeterminator createHistoryLevelDeterminator(CamundaBpmProperties camundaBpmProperties, JdbcTemplate jdbcTemplate); String getDefaultHistoryLevel(); void setDefaultHistoryLevel(String defaultHistoryLevel); JdbcTemplate getJdbcTemplate(); void setJdbcTemplate(JdbcTemplate jdbcTemplate); boolean isIgnoreDataAccessException(); void setIgnoreDataAccessException(boolean ignoreDataAccessException); CamundaBpmProperties getCamundaBpmProperties(); void setCamundaBpmProperties(CamundaBpmProperties camundaBpmProperties); @Override void afterPropertiesSet(); @Override String determineHistoryLevel(); void addCustomHistoryLevels(Collection<HistoryLevel> customHistoryLevels); }
HistoryLevelDeterminatorJdbcTemplateImpl implements HistoryLevelDeterminator, InitializingBean { protected String getHistoryLevelFrom(Integer historyLevelFromDb) { String result = defaultHistoryLevel; if (historyLevelFromDb != null) { for (HistoryLevel historyLevel : historyLevels) { if (historyLevel.getId() == historyLevelFromDb.intValue()) { result = historyLevel.getName(); log.debug("found matching history level '{}'", result); break; } } } return result; }  static HistoryLevelDeterminator createHistoryLevelDeterminator(CamundaBpmProperties camundaBpmProperties, JdbcTemplate jdbcTemplate); String getDefaultHistoryLevel(); void setDefaultHistoryLevel(String defaultHistoryLevel); JdbcTemplate getJdbcTemplate(); void setJdbcTemplate(JdbcTemplate jdbcTemplate); boolean isIgnoreDataAccessException(); void setIgnoreDataAccessException(boolean ignoreDataAccessException); CamundaBpmProperties getCamundaBpmProperties(); void setCamundaBpmProperties(CamundaBpmProperties camundaBpmProperties); @Override void afterPropertiesSet(); @Override String determineHistoryLevel(); void addCustomHistoryLevels(Collection<HistoryLevel> customHistoryLevels);  }