@Test public void testCustomIncrementerDatasourceNoVersion() throws Exception { SimpleConfig config = new SimpleConfig(); config.putProperty("rice.krad.data.platform.incrementer.mysql", "org.kuali.rice.krad.data.platform.testincrementers.CustomIncrementerMySQLVersion5"); config.putProperty("rice.krad.data.platform.incrementer.oracle", "org.kuali.rice.krad.data.platform.testincrementers.CustomIncrementerOracleVersion11"); ConfigContext.init(config); DataFieldMaxValueIncrementer mySQLMaxVal = MaxValueIncrementerFactory.getIncrementer(mysql,"test_mySQL"); assertTrue("Found MySQL custom incrementer",mySQLMaxVal != null); assertTrue("Custom incrementer for MySQL should be mySQL5 for String val", StringUtils.equals(mySQLMaxVal.nextStringValue(),"mySQL5")); DataFieldMaxValueIncrementer oracleMaxVal = MaxValueIncrementerFactory.getIncrementer(oracle,"test_oracle"); assertTrue("Found Oracle custom incrementer", oracleMaxVal != null); }
public static DataFieldMaxValueIncrementer getIncrementer(DataSource dataSource, String incrementerName) { if (dataSource == null) { throw new IllegalArgumentException("DataSource must not be null"); } if (StringUtils.isBlank(incrementerName)) { throw new IllegalArgumentException("Incrementer name must not be null or blank"); } ConcurrentMap<String, DataFieldMaxValueIncrementer> incrementerCache = cache.get(dataSource); if (incrementerCache == null) { cache.put(dataSource, new ConcurrentHashMap<String, DataFieldMaxValueIncrementer>(8, 0.9f, 1)); if (incrementerCache == null) { incrementerCache = cache.get(dataSource); } } DataFieldMaxValueIncrementer incrementer = incrementerCache.get(incrementerName.toUpperCase()); if (incrementer == null) { incrementer = incrementerCache.putIfAbsent(incrementerName.toUpperCase(), createIncrementer(dataSource, incrementerName)); if (incrementer == null) { incrementer = incrementerCache.get(incrementerName.toUpperCase()); } } return incrementer; }
MaxValueIncrementerFactory { public static DataFieldMaxValueIncrementer getIncrementer(DataSource dataSource, String incrementerName) { if (dataSource == null) { throw new IllegalArgumentException("DataSource must not be null"); } if (StringUtils.isBlank(incrementerName)) { throw new IllegalArgumentException("Incrementer name must not be null or blank"); } ConcurrentMap<String, DataFieldMaxValueIncrementer> incrementerCache = cache.get(dataSource); if (incrementerCache == null) { cache.put(dataSource, new ConcurrentHashMap<String, DataFieldMaxValueIncrementer>(8, 0.9f, 1)); if (incrementerCache == null) { incrementerCache = cache.get(dataSource); } } DataFieldMaxValueIncrementer incrementer = incrementerCache.get(incrementerName.toUpperCase()); if (incrementer == null) { incrementer = incrementerCache.putIfAbsent(incrementerName.toUpperCase(), createIncrementer(dataSource, incrementerName)); if (incrementer == null) { incrementer = incrementerCache.get(incrementerName.toUpperCase()); } } return incrementer; } }
MaxValueIncrementerFactory { public static DataFieldMaxValueIncrementer getIncrementer(DataSource dataSource, String incrementerName) { if (dataSource == null) { throw new IllegalArgumentException("DataSource must not be null"); } if (StringUtils.isBlank(incrementerName)) { throw new IllegalArgumentException("Incrementer name must not be null or blank"); } ConcurrentMap<String, DataFieldMaxValueIncrementer> incrementerCache = cache.get(dataSource); if (incrementerCache == null) { cache.put(dataSource, new ConcurrentHashMap<String, DataFieldMaxValueIncrementer>(8, 0.9f, 1)); if (incrementerCache == null) { incrementerCache = cache.get(dataSource); } } DataFieldMaxValueIncrementer incrementer = incrementerCache.get(incrementerName.toUpperCase()); if (incrementer == null) { incrementer = incrementerCache.putIfAbsent(incrementerName.toUpperCase(), createIncrementer(dataSource, incrementerName)); if (incrementer == null) { incrementer = incrementerCache.get(incrementerName.toUpperCase()); } } return incrementer; } private  MaxValueIncrementerFactory(); }
MaxValueIncrementerFactory { public static DataFieldMaxValueIncrementer getIncrementer(DataSource dataSource, String incrementerName) { if (dataSource == null) { throw new IllegalArgumentException("DataSource must not be null"); } if (StringUtils.isBlank(incrementerName)) { throw new IllegalArgumentException("Incrementer name must not be null or blank"); } ConcurrentMap<String, DataFieldMaxValueIncrementer> incrementerCache = cache.get(dataSource); if (incrementerCache == null) { cache.put(dataSource, new ConcurrentHashMap<String, DataFieldMaxValueIncrementer>(8, 0.9f, 1)); if (incrementerCache == null) { incrementerCache = cache.get(dataSource); } } DataFieldMaxValueIncrementer incrementer = incrementerCache.get(incrementerName.toUpperCase()); if (incrementer == null) { incrementer = incrementerCache.putIfAbsent(incrementerName.toUpperCase(), createIncrementer(dataSource, incrementerName)); if (incrementer == null) { incrementer = incrementerCache.get(incrementerName.toUpperCase()); } } return incrementer; } private  MaxValueIncrementerFactory(); static DataFieldMaxValueIncrementer getIncrementer(DataSource dataSource, String incrementerName); }
MaxValueIncrementerFactory { public static DataFieldMaxValueIncrementer getIncrementer(DataSource dataSource, String incrementerName) { if (dataSource == null) { throw new IllegalArgumentException("DataSource must not be null"); } if (StringUtils.isBlank(incrementerName)) { throw new IllegalArgumentException("Incrementer name must not be null or blank"); } ConcurrentMap<String, DataFieldMaxValueIncrementer> incrementerCache = cache.get(dataSource); if (incrementerCache == null) { cache.put(dataSource, new ConcurrentHashMap<String, DataFieldMaxValueIncrementer>(8, 0.9f, 1)); if (incrementerCache == null) { incrementerCache = cache.get(dataSource); } } DataFieldMaxValueIncrementer incrementer = incrementerCache.get(incrementerName.toUpperCase()); if (incrementer == null) { incrementer = incrementerCache.putIfAbsent(incrementerName.toUpperCase(), createIncrementer(dataSource, incrementerName)); if (incrementer == null) { incrementer = incrementerCache.get(incrementerName.toUpperCase()); } } return incrementer; } private  MaxValueIncrementerFactory(); static DataFieldMaxValueIncrementer getIncrementer(DataSource dataSource, String incrementerName); static final String PLATFORM_INCREMENTER_PREFIX; }