@Override public void setId(Long id) { sample.setId(id); }
private static Map<String, Sample> toArraySamples(List<ArraySampleDto> dtos) { Map<String, Sample> samples = new HashMap<>(); if (dtos != null) { for (ArraySampleDto dto : dtos) { Sample sample = new SampleImpl(); sample.setId(dto.getId()); sample.setAlias(dto.getAlias()); sample.setName(dto.getName()); sample.setIdentificationBarcode(dto.getIdentificationBarcode()); samples.put(dto.getCoordinates(), sample); } } return samples; }
if (from.getId() != null) to.setId(from.getId()); to.setAccession(nullifyStringIfBlank(from.getAccession())); to.setName(from.getName());
public static Workset to(@Nonnull WorksetDto from) { Workset workset = new Workset(); if (from.getId() != null) { workset.setId(from.getId()); } workset.setAlias(from.getAlias()); workset.setDescription(from.getDescription()); if (from.getSampleIds() != null && !from.getSampleIds().isEmpty()) { workset.setSamples(from.getSampleIds().stream().map(id -> { Sample s = new SampleImpl(); s.setId(id); return s; }).collect(Collectors.toSet())); } if (from.getLibraryIds() != null && !from.getLibraryIds().isEmpty()) { workset.setLibraries(from.getLibraryIds().stream().map(id -> { Library l = new LibraryImpl(); l.setId(id); return l; }).collect(Collectors.toSet())); } if (from.getDilutionIds() != null && !from.getDilutionIds().isEmpty()) { workset.setDilutions(from.getDilutionIds().stream().map(id -> { LibraryDilution d = new LibraryDilution(); d.setId(id); return d; }).collect(Collectors.toSet())); } return workset; }
SampleQC newSampleQc = new SampleQC(); Sample ownerSample = new SampleImpl(); ownerSample.setId(dto.getEntityId()); newSampleQc.setSample(ownerSample); to = newSampleQc;
@Override public Long create(Library library) throws IOException { if (library.getSample() != null && library.getSample().getId() == Sample.UNSAVED_ID) { Long sampleId = sampleService.create(library.getSample()); library.getSample().setId(sampleId); } loadChildEntities(library); boxService.throwIfBoxPositionIsFilled(library); library.setChangeDetails(authorizationManager.getCurrentUser()); if (library.getSecurityProfile() == null) { library.inheritPermissions(sampleService.get(library.getSample().getId())); } authorizationManager.throwIfNotWritable(library); validateParentOrThrow(library); // pre-save field generation library.setName(generateTemporaryName()); if (isStringEmptyOrNull(library.getAlias()) && namingScheme.hasLibraryAliasGenerator()) { library.setAlias(generateTemporaryName()); } if (library.getConcentration() == null) { library.setConcentrationUnits(null); } if (library.getVolume() == null) { library.setVolumeUnits(null); } validateChange(library, null); long savedId = save(library, true).getId(); boxService.updateBoxableLocation(library); return savedId; }
if (from.getParentSampleId() != null) { to.setSample(new SampleImpl()); to.getSample().setId(from.getParentSampleId());