private void throwTargetedSequencingIncompatible(TargetedSequencing ts, KitDescriptor kd) { String tsName = ts.getAlias(); String kitName = kd.getName(); throw new IllegalArgumentException(String.format("Selected targeted sequencing is not available for kit on parent library.\n" + "If you think this is an error, please contact your MISO administrator " + "to make targeted sequencing \"%s\" available for kit \"%s\".", tsName, kitName)); }
private void validateChange(KitDescriptor managed, KitDescriptor changes) { List<ValidationError> errors = new ArrayList<>(); Collection<TargetedSequencing> removed = CollectionUtils.subtract(managed.getTargetedSequencing(), changes.getTargetedSequencing()); for (TargetedSequencing ts : removed) { List<LibraryDilution> affectedDilutions = kitStore.getDilutionsForKdTsRelationship(managed, ts); if (!affectedDilutions.isEmpty()) { errors.add(new ValidationError( String.format("Cannot unlink targeted sequencing '%s' from kit '%s' as %d dilutions already use this link.", ts.getAlias(), managed.getName(), affectedDilutions.size()))); } } if (!errors.isEmpty()) { throw new ValidationException(errors); } }
public static TargetedSequencingDto asDto(@Nonnull TargetedSequencing from) { TargetedSequencingDto dto = new TargetedSequencingDto(); dto.setId(from.getId()); dto.setAlias(from.getAlias()); dto.setArchived(from.isArchived()); dto.setKitDescriptorIds(from.getKitDescriptors().stream().map(KitDescriptor::getId).collect(Collectors.toList())); return dto; }