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()); }
public static StorageLocation to(@Nonnull StorageLocationDto from) { StorageLocation location = new StorageLocation(); location.setId(from.getId()); location.setAlias(from.getAlias()); if (!LimsUtils.isStringEmptyOrNull(from.getIdentificationBarcode())) { location.setIdentificationBarcode(from.getIdentificationBarcode()); } if (!LimsUtils.isStringEmptyOrNull(from.getMapUrl())) { location.setMapUrl(from.getMapUrl()); } if (from.getParentLocationId() != null) { location.setParentLocation(new StorageLocation()); location.getParentLocation().setId(from.getParentLocationId()); } location.setLocationUnit(LocationUnit.valueOf(from.getLocationUnit())); location.setProbeId(from.getProbeId()); return location; }
public static Box to(@Nonnull BoxDto from) { Box to = new BoxImpl(); if (from.getId() != null) to.setId(from.getId()); to.setAlias(from.getAlias()); to.setDescription(from.getDescription()); to.setIdentificationBarcode(from.getIdentificationBarcode()); to.setLocationBarcode(from.getLocationBarcode() == null ? "" : from.getLocationBarcode()); if (from.getUseId() != null) { BoxUse use = new BoxUse(); use.setId(from.getUseId()); to.setUse(use); } if (from.getSizeId() != null) { BoxSize size = new BoxSize(); size.setId(from.getSizeId()); to.setSize(size); } if (from.getStorageLocationId() != null) { to.setStorageLocation(new StorageLocation()); to.getStorageLocation().setId(from.getStorageLocationId()); } if (!isStringEmptyOrNull(from.getStorageLocationBarcode())) { if (to.getStorageLocation() == null) { to.setStorageLocation(new StorageLocation()); } to.getStorageLocation().setIdentificationBarcode(from.getStorageLocationBarcode()); } return to; }