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; } }
/** * This method takes a list of buckets and transforms it to the {@link BucketDetail}s that are needed * for later extension. * * @param buckets a list of {@link Bucket}s */ public void addBuckets(List<Bucket> buckets) { List<BucketDetail> details = buckets.stream() .map(b -> new BucketDetail(b.getLabel(), b.isControl(), b.getAllocationPercent(), b.getState(), b.getDescription())) .collect(Collectors.toList()); setBuckets(details); }
if (updates.getDescription() != null && !updates.getDescription().equals(bucket.getDescription())) { builder.withDescription(updates.getDescription()); changeData = new Bucket.BucketAuditInfo("description", bucket.getDescription(), updates.getDescription()); changeList.add(changeData);
args.add(b.getAllocationPercent()); if (b.getDescription() != null) { CQL += "description = ?,"; args.add(b.getDescription());
if (bucketList.getBuckets().get(i).getDescription() != null) { hasval = true; break; for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { SQL.append("WHEN ? then ? "); if (b.getDescription() != null) { args.add(b.getLabel().toString()); args.add(b.getDescription());
/** * {@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.getDescription() != null ? bucket.getDescription() : "", bucket.getAllocationPercent(),
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.getDescription() != null ? bucket.getDescription() : "", bucket.getAllocationPercent(), bucket.isControl(),
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; } }
builder.withState(newState); builder.withControl(buck.isControl()); builder.withDescription(buck.getDescription()); newBuckets.addBucket(builder.build());
.withAllocationPercent(bucket.getAllocationPercent()) .withControl(bucket.isControl()) .withDescription(bucket.getDescription()) .withPayload(bucket.getPayload()) .withState(bucket.getState())