Search in sources :

Example 1 with ParentSample

use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentSample in project miso-lims by miso-lims.

the class Dtos method setEffectiveQcFailure.

private static void setEffectiveQcFailure(ListLibraryAliquotView from, UpstreamQcFailableDto to) {
    for (ParentAliquot parent = from.getParentAliquot(); parent != null; parent = parent.getParentAliquot()) {
        if (parent.getDetailedQcStatus() != null && Boolean.FALSE.equals(parent.getDetailedQcStatus().getStatus())) {
            to.setEffectiveQcFailureId(parent.getDetailedQcStatus().getId());
            to.setEffectiveQcFailureLevel(EntityType.LIBRARY_ALIQUOT.getLabel());
            return;
        }
    }
    ParentLibrary lib = from.getParentLibrary();
    if (lib != null) {
        if (lib.getDetailedQcStatus() != null && Boolean.FALSE.equals(lib.getDetailedQcStatus().getStatus())) {
            to.setEffectiveQcFailureId(lib.getDetailedQcStatus().getId());
            to.setEffectiveQcFailureLevel(EntityType.LIBRARY.getLabel());
            return;
        }
        ParentSample sam = lib.getParentSample();
        if (sam != null) {
            if (sam.getDetailedQcStatus() != null && Boolean.FALSE.equals(sam.getDetailedQcStatus().getStatus())) {
                to.setEffectiveQcFailureId(sam.getDetailedQcStatus().getId());
                to.setEffectiveQcFailureLevel(sam.getParentSampleClass() == null ? EntityType.SAMPLE.getLabel() : sam.getParentSampleClass().getSampleCategory());
                return;
            }
            for (GrandparentSample parent = sam.getParentSample(); parent != null; parent = parent.getParentSample()) {
                if (sam.getDetailedQcStatus() != null && Boolean.FALSE.equals(sam.getDetailedQcStatus().getStatus())) {
                    to.setEffectiveQcFailureId(parent.getDetailedQcStatus().getId());
                    to.setEffectiveQcFailureLevel(parent.getParentSampleClass() == null ? EntityType.SAMPLE.getLabel() : parent.getParentSampleClass().getSampleCategory());
                    return;
                }
            }
        }
    }
}
Also used : ParentLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentLibrary) ParentSample(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentSample) GrandparentSample(uk.ac.bbsrc.tgac.miso.core.data.impl.view.GrandparentSample) ParentAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentAliquot)

Aggregations

GrandparentSample (uk.ac.bbsrc.tgac.miso.core.data.impl.view.GrandparentSample)1 ParentAliquot (uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentAliquot)1 ParentLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentLibrary)1 ParentSample (uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentSample)1