Commit 5c4ee837 authored by Rob Tomsick's avatar Rob Tomsick

Don't use UUID#randomUUID()

parent f6d16bc2
......@@ -57,6 +57,9 @@ import org.jooq.conf.Settings;
import org.jooq.impl.DSL;
import org.jooq.impl.DefaultDSLContext;
import com.fasterxml.uuid.NoArgGenerator;
import com.fasterxml.uuid.impl.RandomBasedGenerator;
import edu.unc.cscc.crxrest.ConfigurableProvider;
import edu.unc.cscc.crxrest.DBDictionaryProvider;
import edu.unc.cscc.crxrest.DictionaryService;
......@@ -66,20 +69,23 @@ import edu.unc.cscc.crxrest.Discoverable;
public class NDCServiceProvider
implements DBDictionaryProvider, ConfigurableProvider
{
public static final String IDENTIFIER = "FDA-NDC";
public static final String DEFAULT_PATH =
public static final String IDENTIFIER = "FDA-NDC";
public static final String DEFAULT_PATH =
"/usr/local/share/crxrest/ndc/product.txt";
static final Table<?> D_TABLE =
static final Table<?> D_TABLE =
DSL.table(DSL.name("entries"));
static final Table<?> N_TABLE =
static final Table<?> N_TABLE =
DSL.table(DSL.name("non_proprietary_names"));
static final Table<?> S_TABLE =
static final Table<?> S_TABLE =
DSL.table(DSL.name("substances"));
private String productFilePath;
private final NoArgGenerator uuidGenerator =
new RandomBasedGenerator(null);
private String productFilePath;
private DictionaryService ndcService;
private DictionaryService ndcService;
@Override
public String persistenceID()
......@@ -126,7 +132,7 @@ implements DBDictionaryProvider, ConfigurableProvider
for (final ProductParser.Entry e : parser)
{
final UUID id = UUID.randomUUID();
final UUID id = this.uuidGenerator.generate();
DSL.using(config)
.insertInto(D_TABLE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment