if (json.has("barcodeGenerator")) {
BarcodeDimension dim = new BarcodeDimension(100, 100);
if (json.has("dimensionWidth") && json.has("dimensionHeight")) {
dim = new BarcodeDimension(json.getDouble("dimensionWidth"), json.getDouble("dimensionHeight"));
}
BarcodeGenerator bg = BarcodeFactory.lookupGenerator(json.getString("barcodeGenerator"));
if (bg != null) {
bi = barcodeFactory.generateBarcode(sample, bg, dim);
}
else {
return JSONUtils.SimpleJSONError("'" + json.getString("barcodeGenerator") + "' is not a valid barcode generator type");