private boolean isDefault(List<SimpleStrategy> defaults, String strategyName) { for (SimpleStrategy strategy : defaults) { if (strategy.getName().equals(strategyName)) { return true; } } return false; }
@Override public String toString() { return String.format("%s [%s, cronExpression=%s]", getClass().getSimpleName(), super.toString(), cronExpression); }
/** * Checks if a given persistence configuration entry has a certain strategy for the given service * * @param serviceName the service to check the configuration for * @param itemConfig the persistence configuration entry * @param strategy the strategy to check for * @return true, if it has the given strategy */ private boolean hasStrategy(String serviceName, SimpleItemConfiguration itemConfig, SimpleStrategy strategy) { final PersistenceServiceConfiguration config = persistenceServiceConfigs.get(serviceName); if (config.getDefaults().contains(strategy) && itemConfig.getStrategies().isEmpty()) { return true; } else { for (SimpleStrategy s : itemConfig.getStrategies()) { if (s.equals(strategy)) { return true; } } return false; } }
/** * Checks if a given persistence configuration entry has a certain strategy for the given service * * @param serviceName the service to check the configuration for * @param itemConfig the persistence configuration entry * @param strategy the strategy to check for * @return true, if it has the given strategy */ private boolean hasStrategy(String serviceName, SimpleItemConfiguration itemConfig, SimpleStrategy strategy) { final PersistenceServiceConfiguration config = persistenceServiceConfigs.get(serviceName); if (config.getDefaults().contains(strategy) && itemConfig.getStrategies().isEmpty()) { return true; } else { for (SimpleStrategy s : itemConfig.getStrategies()) { if (s.equals(strategy)) { return true; } } return false; } }
private boolean isDefault(List<SimpleStrategy> defaults, String strategyName) { for (SimpleStrategy strategy : defaults) { if (strategy.getName().equals(strategyName)) { return true; } } return false; }
@Override public String toString() { return String.format("%s [%s, cronExpression=%s]", getClass().getSimpleName(), super.toString(), cronExpression); }
private boolean hasStrategy(List<SimpleStrategy> defaults, SimpleItemConfiguration config, String strategyName) { // check if the strategy is directly defined on the config for (SimpleStrategy strategy : config.getStrategies()) { if (strategyName.equals(strategy.getName())) { return true; } } // if no strategies are given, check the default strategies to use if (config.getStrategies().isEmpty() && isDefault(defaults, strategyName)) { return true; } return false; }
private boolean hasStrategy(List<SimpleStrategy> defaults, SimpleItemConfiguration config, String strategyName) { // check if the strategy is directly defined on the config for (SimpleStrategy strategy : config.getStrategies()) { if (strategyName.equals(strategy.getName())) { return true; } } // if no strategies are given, check the default strategies to use if (config.getStrategies().isEmpty() && isDefault(defaults, strategyName)) { return true; } return false; }