public static <T extends DetailedSample> T getParent(Class<T> targetParentClass, DetailedSample start) { for (DetailedSample current = deproxify(start.getParent()); current != null; current = deproxify(current.getParent())) { if (targetParentClass.isInstance(current)) { return targetParentClass.cast(current); } } return null; }
private void applyAliquotChanges(SampleAliquot target, SampleAliquot source) { source = deproxify(source); if (source instanceof SampleAliquotSingleCell) { ((SampleAliquotSingleCell) target).setInputIntoLibrary(((SampleAliquotSingleCell) source).getInputIntoLibrary()); } target.setSamplePurpose(source.getSamplePurpose()); }
private static SampleTissueProcessingDto asTissueProcessingSampleDto(@Nonnull SampleTissueProcessing from) { from = deproxify(from); if (isSampleSlide(from)) { return asSlideSampleDto((SampleSlide) from); } else if (isLcmTubeSample(from)) { return asLCMTubeSampleDto((SampleLCMTube) from); } else if (isProcessingSingleCellSample(from)) { return asSingleCellSampleDto((SampleSingleCell) from); } else { return new SampleTissueProcessingDto(); } }
@Override public Integer getSlidesRemaining() { if (getSlides() == null) { return null; } int slidesConsumed = 0; for (Sample child : getChildren()) { if (child == null) continue; child = deproxify(child); if (child instanceof SampleLCMTube) { Integer consumed = ((SampleLCMTube) child).getSlidesConsumed(); if (consumed != null) slidesConsumed += consumed; } else if (child instanceof SampleSlideImpl) { Integer consumed = ((SampleSlideImpl) child).getSlides(); if (consumed != null) slidesConsumed += consumed; } } int discards = 0; if (getDiscards() != null) { discards = getDiscards(); } return (getSlides() - discards - slidesConsumed); }
private void applyStockChanges(SampleStock target, SampleStock source) { source = deproxify(source); if (source instanceof SampleStockSingleCell) { ((SampleStockSingleCell) target).setTargetCellRecovery(((SampleStockSingleCell) source).getTargetCellRecovery()); ((SampleStockSingleCell) target).setCellViability(((SampleStockSingleCell) source).getCellViability()); ((SampleStockSingleCell) target).setLoadingCellConcentration(((SampleStockSingleCell) source).getLoadingCellConcentration()); } target.setStrStatus(source.getStrStatus()); target.setDNAseTreated(source.getDNAseTreated()); }
private void applyTissueProcessingChanges(SampleTissueProcessing target, SampleTissueProcessing source) { source = deproxify(source); if (source instanceof SampleSlide) { ((SampleSlide) target).setSlides(((SampleSlide) source).getSlides()); ((SampleSlide) target).setDiscards(((SampleSlide) source).getDiscards()); ((SampleSlide) target).setThickness(((SampleSlide) source).getThickness()); ((SampleSlide) target).setStain(((SampleSlide) source).getStain()); } else if (source instanceof SampleLCMTube) { ((SampleLCMTube) target).setSlidesConsumed(((SampleLCMTube) source).getSlidesConsumed()); } else if (source instanceof SampleSingleCell) { ((SampleSingleCell) target).setInitialCellConcentration(((SampleSingleCell) source).getInitialCellConcentration()); ((SampleSingleCell) target).setDigestion(((SampleSingleCell) source).getDigestion()); } }