private void loadChildEntities(ArrayRun arrayRun) throws IOException { if (arrayRun.getInstrument() != null) { arrayRun.setInstrument(instrumentService.get(arrayRun.getInstrument().getId())); } if (arrayRun.getArray() != null) { Array array = arrayService.get(arrayRun.getArray().getId()); if (array == null) { // providing a way to detect "array not found" in validation arrayRun.getArray().setAlias(null); } else { arrayRun.setArray(array); } } }
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 final ArrayRun to(@Nonnull ArrayRunDto from) { ArrayRun run = new ArrayRun(); if (from.getId() != null) { run.setId(from.getId()); } run.setAlias(from.getAlias()); run.setDescription(nullifyStringIfBlank(from.getDescription())); run.setFilePath(nullifyStringIfBlank(from.getFilePath())); run.setInstrument(new InstrumentImpl()); if (from.getInstrumentId() != null) { run.getInstrument().setId(from.getInstrumentId()); } if (from.getInstrumentName() != null) { run.getInstrument().setName(from.getInstrumentName()); } if (from.getArray() != null) { run.setArray(to(from.getArray())); } run.setHealth(HealthType.get(from.getStatus())); if (from.getStartDate() != null) { run.setStartDate(parseDate(from.getStartDate())); } if (from.getCompletionDate() != null) { run.setCompletionDate(parseDate(from.getCompletionDate())); } if (from.getLastModified() != null) { run.setLastModified(parseDate(from.getLastModified())); } return run; }