/** * Same as `tryGetGlobalIntegerProperty` but with null as implicit default value * @param key Variable name * @return Environment or System property value or null if not found */ public static Integer tryGetGlobalIntegerProperty(String key) { return tryGetGlobalIntegerProperty(key, null); } }
/** * Same as `tryGetGlobalIntegerProperty` but with null as implicit default value * @param key Variable name * @return Environment or System property value or null if not found */ public static Integer tryGetGlobalIntegerProperty(String key) { return tryGetGlobalIntegerProperty(key, null); } }
/** * We trigger a delete of all {@link org.jboss.aerogear.unifiedpush.api.FlatPushMessageInformation} objects that are * <i>older</i> than 30 days! */ public void deleteOutdatedFlatPushInformationData() { final Date historyDate = DateUtils.calculatePastDate(ConfigurationUtils.tryGetGlobalIntegerProperty(AEROGEAR_METRICS_STORAGE_MAX_DAYS, 30)); logger.trace("Delete all until {}", historyDate.getTime()); flatPushMessageInformationDao.deletePushInformationOlderThan(historyDate); }
@SuppressWarnings("unchecked") private static <T> T getProperty(VariantType type, ConfigurationProperty property, T defaultValue, Class<T> expectedType) { String systemPropertyName = getSystemPropertyName(type, property); if (expectedType == String.class) { return (T) ConfigurationUtils.tryGetGlobalProperty(systemPropertyName, (String) defaultValue); } else if (expectedType == Integer.class) { return (T) ConfigurationUtils.tryGetGlobalIntegerProperty(systemPropertyName, (Integer) defaultValue); } else { throw new IllegalStateException("Unexpected type: " + expectedType); } }
@SuppressWarnings("unchecked") private static <T> T getProperty(VariantType type, ConfigurationProperty property, T defaultValue, Class<T> expectedType) { String systemPropertyName = getSystemPropertyName(type, property); if (expectedType == String.class) { return (T) ConfigurationUtils.tryGetGlobalProperty(systemPropertyName, (String) defaultValue); } else if (expectedType == Integer.class) { return (T) ConfigurationUtils.tryGetGlobalIntegerProperty(systemPropertyName, (Integer) defaultValue); } else { throw new IllegalStateException("Unexpected type: " + expectedType); } }