private Builder(Bucket other) { instance = new Bucket(); instance.experimentID = other.getExperimentID(); instance.label = other.getLabel(); instance.control = other.isControl() == null ? Boolean.FALSE : other.isControl(); instance.allocationPercent = other.getAllocationPercent(); instance.description = other.getDescription(); instance.payload = other.getPayload(); instance.state = other.getState(); }
public Bucket build() { Bucket result = new Bucket(); result.setControl(instance.isControl()); result.setState(instance.getState()); result.setLabel(instance.getLabel()); result.setPayload(instance.getPayload()); result.setAllocationPercent(instance.getAllocationPercent()); result.setDescription(instance.getDescription()); result.setExperimentID(instance.getExperimentID()); instance = null; return result; } }
/** * Get the bucket based on experiment id and bucket label * * @param experimentID * @param bucketLabel * @return */ protected String getBucketPayload(Experiment.ID experimentID, String bucketLabel) { if (isNull(bucketLabel) || bucketLabel.trim().isEmpty()) { return null; } Optional<Bucket> rBucket = getBucketByLabel(experimentID, Bucket.Label.valueOf(bucketLabel)); String payload = null; if (rBucket.isPresent()) { payload = rBucket.get().getPayload(); } return payload; }
if (updates.getPayload() != null && !updates.getPayload().equals(bucket.getPayload())) { builder.withPayload(updates.getPayload()); changeData = new Bucket.BucketAuditInfo("payload", bucket.getPayload(), updates.getPayload()); changeList.add(changeData);
args.add(b.isControl()); if (b.getPayload() != null) { CQL += "payload = ?,"; args.add(b.getPayload());
if (bucketList.getBuckets().get(i).getPayload() != null) { hasval = true; break; for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { SQL.append("WHEN ? then ? "); if (b.getPayload() != null) { args.add(b.getLabel().toString()); args.add(b.getPayload());
/** * {@inheritDoc} */ @Override public void createBucket(Bucket newBucket) { LOGGER.debug("Creating bucket {}", newBucket); Preconditions.checkNotNull(newBucket, "Parameter \"newBucket\" cannot be null"); final Bucket.State STATE = Bucket.State.OPEN; try { bucketAccessor.insert(newBucket.getExperimentID().getRawID(), newBucket.getLabel().toString(), newBucket.getDescription(), newBucket.getAllocationPercent(), newBucket.isControl(), newBucket.getPayload(), STATE.name()); } catch (Exception e) { LOGGER.error("Error creating bucket {}", newBucket, e); throw new RepositoryException("Could not create bucket \"" + newBucket + "\" because " + e, e); } }
bucket.getAllocationPercent(), bucket.isControl(), bucket.getPayload() != null ? bucket.getPayload() : "", bucket.getExperimentID(),
private Builder(Bucket other) { instance = new Bucket(); instance.experimentID = other.getExperimentID(); instance.label = other.getLabel(); instance.control = other.isControl() == null ? Boolean.FALSE : other.isControl(); instance.allocationPercent = other.getAllocationPercent(); instance.description = other.getDescription(); instance.payload = other.getPayload(); instance.state = other.getState(); }
@Override public void createBucket(Bucket newBucket) throws RepositoryException { final String SQL = "insert into bucket (" + "experiment_id, description, label, allocation_percent, is_control, payload, state) " + "values (?,?,?,?,?,?,?)"; try { newTransaction().insert( SQL, newBucket.getExperimentID(), newBucket.getDescription() != null ? newBucket.getDescription() : "", newBucket.getLabel().toString(), newBucket.getAllocationPercent(), newBucket.isControl() != null ? newBucket.isControl() : false, newBucket.getPayload() != null ? newBucket.getPayload() : "", Bucket.State.OPEN.toString()); } catch (WasabiException e) { throw e; } catch (Exception e) { throw new RepositoryException("Could not create bucket \"" + newBucket + "\"", e); } }
bucket.getAllocationPercent(), bucket.isControl(), bucket.getPayload() != null ? bucket.getPayload() : "", bucket.getExperimentID().getRawID(), bucket.getLabel().toString());
public Bucket build() { Bucket result = new Bucket(); result.setControl(instance.isControl()); result.setState(instance.getState()); result.setLabel(instance.getLabel()); result.setPayload(instance.getPayload()); result.setAllocationPercent(instance.getAllocationPercent()); result.setDescription(instance.getDescription()); result.setExperimentID(instance.getExperimentID()); instance = null; return result; } }
.withControl(bucket.isControl()) .withDescription(bucket.getDescription()) .withPayload(bucket.getPayload()) .withState(bucket.getState()) .build();