/** * Construct a new Sample with a SecurityProfile owned by the given User * * @param user * of type User */ public SampleImpl(User user) { setSecurityProfile(new SecurityProfile(user)); }
@Override public void updateEntity(long id, QcCorrespondingField correspondingField, double value, String units) throws IOException { SampleImpl sample = getSample(id); sample.updateFromQc(correspondingField, value, units); currentSession().update(sample); } }
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; }
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; }
case Sample: SampleQC newSampleQc = new SampleQC(); Sample ownerSample = new SampleImpl(); ownerSample.setId(dto.getEntityId()); newSampleQc.setSample(ownerSample);
/** * Construct a new Sample with a default empty SecurityProfile */ public SampleImpl() { setSecurityProfile(new SecurityProfile()); }
to = toDetailedSample((DetailedSampleDto) from); } else { to = new SampleImpl();
to.setSample(new SampleImpl()); to.getSample().setId(from.getParentSampleId());