private void validateStartDate(ArrayRun arrayRun, ArrayRun beforeChange, List<ValidationError> errors) throws IOException { if (arrayRun.getStartDate() == null) { errors.add(new ValidationError("startDate", "Start date cannot be blank")); } else if (!authorizationManager.isAdminUser() && beforeChange != null && beforeChange.getStartDate() != null && !arrayRun.getStartDate().equals(beforeChange.getStartDate())) { errors.add(new ValidationError("startDate", "Only admin may change start date")); } }
private void applyChanges(ArrayRun from, ArrayRun to) { to.setAlias(from.getAlias()); to.setDescription(from.getDescription()); to.setFilePath(from.getFilePath()); to.setArray(from.getArray()); to.setHealth(from.getHealth()); to.setStartDate(from.getStartDate()); to.setCompletionDate(from.getCompletionDate()); }
public static ArrayRunDto asDto(@Nonnull ArrayRun from) { ArrayRunDto dto = new ArrayRunDto(); dto.setId(from.getId()); dto.setAlias(from.getAlias()); dto.setDescription(from.getDescription()); dto.setFilePath(from.getFilePath()); if (from.getInstrument() != null) { dto.setInstrumentId(from.getInstrument().getId()); dto.setInstrumentName(from.getInstrument().getName()); } if (from.getArray() != null) { dto.setArray(asDto(from.getArray())); } dto.setStatus(from.getHealth().getKey()); if (from.getStartDate() != null) { dto.setStartDate(formatDate(from.getStartDate())); } if (from.getCompletionDate() != null) { dto.setCompletionDate(formatDate(from.getCompletionDate())); } if (from.getLastModified() != null) { dto.setLastModified(formatDate(from.getLastModified())); } return dto; }