for (PrioritizedExperiment prioritizedExperiment : prioritizedExperiments.getPrioritizedExperiments()) { if (prioritizedExperiment.getID().equals(experiment.getID())) { experiment.setPriority(prioritizedExperiment.getPriority());
/** * {@inheritDoc} */ @Override public void checkForIllegalUpdate(Experiment experiment, Experiment updates) { // Throw an exception if ID, ModificationTime or CreationTime is being updated. if (updates.getID() != null && !updates.getID().equals(experiment.getID())) { throw new IllegalArgumentException("Invalid experimentID \"" + updates.getID() + "\" " + "Cannot change experiment ID"); } if (updates.getCreationTime() != null && !updates.getCreationTime().equals(experiment.getCreationTime())) { throw new IllegalArgumentException("Invalid creationTime \"" + updates.getCreationTime() + "\" " + "Experiment creation time cannot be modified"); } if (updates.getModificationTime() != null && !updates.getModificationTime().equals(experiment.getModificationTime())) { throw new IllegalArgumentException("Invalid modificationTime \"" + updates.getModificationTime() + "\" " + "Experiment modification time cannot be modified"); } }
/** * {@inheritDoc} */ @Override public void validateBucketChanges(Bucket bucket, Bucket updates) { if (updates.getExperimentID() != null && !updates.getExperimentID().equals(bucket.getExperimentID())) { throw new IllegalArgumentException("Invalid value for experimentID \"" + updates.getExperimentID() + " \"." + " Cannot update ExperimentID"); } if (updates.getLabel() != null && !updates.getLabel().equals(bucket.getLabel())) { throw new IllegalArgumentException("Invalid value for bucket label \"" + updates.getLabel() + " \". " + "Cannot update bucket label"); } if (updates.getState() != null && !updates.getState().equals(bucket.getState())) { throw new IllegalArgumentException("Cannot update the state of a bucket using this api"); } }