/** * Checks submitted data for validity, throwing a ValidationException containing all of the errors if invalid * * @param storage submitted StorageLocation to validate * @param beforeChange the already-persisted StorageLocation before changes */ private void validateChange(StorageLocation storage, StorageLocation beforeChange) { List<ValidationError> errors = new ArrayList<>(); if (storage.getIdentificationBarcode() != null && (beforeChange == null || !storage.getIdentificationBarcode().equals(beforeChange.getIdentificationBarcode())) && storageLocationStore.getByBarcode(storage.getIdentificationBarcode()) != null) { errors.add(new ValidationError("identificationBarcode", String.format("There is already a storage location with this barcode (%s)", storage.getIdentificationBarcode()))); } validateLocationUnitRelationships(storage, errors); validateUrl(storage.getMapUrl(), true, errors); if (!errors.isEmpty()) { throw new ValidationException(errors); } }
private void applyChanges(StorageLocation from, StorageLocation to) { to.setAlias(from.getAlias()); to.setIdentificationBarcode(from.getIdentificationBarcode()); to.setParentLocation(from.getParentLocation()); to.setMapUrl(from.getMapUrl()); to.setProbeId(from.getProbeId()); }
dto.setDisplayLocation(from.getDisplayLocation()); dto.setFullDisplayLocation(from.getFullDisplayLocation()); dto.setMapUrl(from.getMapUrl()); dto.setProbeId(from.getProbeId()); if (includeChildLocations) {