Search in sources :

Example 1 with GroupIdentifiable

use of uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable in project miso-lims by miso-lims.

the class Dtos method asDetailedDto.

private static DetailedLibraryAliquotDto asDetailedDto(DetailedLibraryAliquot from) {
    DetailedLibraryAliquotDto dto = new DetailedLibraryAliquotDto();
    setId(dto::setLibraryDesignCodeId, from.getLibraryDesignCode());
    setBoolean(dto::setNonStandardAlias, from.isNonStandardAlias(), false);
    GroupIdentifiable effective = from.getEffectiveGroupIdEntity();
    if (effective != null) {
        dto.setEffectiveGroupId(effective.getGroupId());
        dto.setEffectiveGroupIdSample(effective.getAlias());
    }
    setString(dto::setGroupId, from.getGroupId());
    setString(dto::setGroupDescription, from.getGroupDescription());
    return dto;
}
Also used : GroupIdentifiable(uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable)

Example 2 with GroupIdentifiable

use of uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable in project miso-lims by miso-lims.

the class Dtos method asDetailedLibraryDto.

private static DetailedLibraryDto asDetailedLibraryDto(@Nonnull DetailedLibrary from) {
    DetailedLibraryDto dto = new DetailedLibraryDto();
    if (from.getLibraryDesign() != null) {
        dto.setLibraryDesignId(from.getLibraryDesign().getId());
    }
    dto.setLibraryDesignCodeId(from.getLibraryDesignCode().getId());
    dto.setPreMigrationId(from.getPreMigrationId());
    dto.setArchived(from.getArchived());
    dto.setNonStandardAlias(from.hasNonStandardAlias());
    GroupIdentifiable effective = from.getEffectiveGroupIdEntity();
    if (effective != null) {
        dto.setEffectiveGroupId(effective.getGroupId());
        dto.setEffectiveGroupIdSample(effective.getAlias());
    }
    if (from.getGroupId() != null) {
        dto.setGroupId(from.getGroupId());
    }
    if (from.getGroupDescription() != null) {
        dto.setGroupDescription(from.getGroupDescription());
    }
    if (from.getSample() != null) {
        DetailedSample detailed = (DetailedSample) from.getSample();
        if (detailed.getSubproject() != null) {
            dto.setSubprojectAlias(detailed.getSubproject().getAlias());
            dto.setSubprojectPriority(detailed.getSubproject().getPriority());
        }
        if (detailed.getIdentityAttributes() != null) {
            ParentIdentityAttributes identity = detailed.getIdentityAttributes();
            setString(dto::setIdentityConsentLevel, maybeGetProperty(identity.getConsentLevel(), ConsentLevel::getLabel));
        }
        if (detailed.getTissueAttributes() != null) {
            ParentTissueAttributes tissue = detailed.getTissueAttributes();
            setString(dto::setEffectiveTissueOriginAlias, tissue.getTissueOrigin().getAlias());
            setString(dto::setEffectiveTissueOriginDescription, tissue.getTissueOrigin().getDescription());
            setString(dto::setEffectiveTissueTypeAlias, tissue.getTissueType().getAlias());
            setString(dto::setEffectiveTissueTypeDescription, tissue.getTissueType().getDescription());
        }
    }
    return dto;
}
Also used : ParentTissueAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes) ParentIdentityAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentIdentityAttributes) GroupIdentifiable(uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)

Example 3 with GroupIdentifiable

use of uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable in project miso-lims by miso-lims.

the class NotificationManager method makeSampleTable.

private static ContainerTag makeSampleTable(Collection<TransferSample> transferSamples) {
    boolean detailed = LimsUtils.isDetailedSample(transferSamples.iterator().next().getItem());
    ContainerTag headerRow = tr(makeTh("Alias"));
    if (detailed) {
        headerRow = headerRow.with(makeTh("Type"), makeTh("Exernal Identifier"));
    }
    headerRow = headerRow.with(makeTh("VOL (uL)"), makeTh("[] (ng/uL)"), makeTh("Total (ng)"));
    if (detailed) {
        headerRow = headerRow.with(makeTh("Subproject"), makeTh("Group ID"), makeTh("Group Description"));
    }
    headerRow = headerRow.with(makeTh("Barcode"), makeTh("Location"));
    List<ContainerTag> rows = new ArrayList<>();
    List<TransferSample> sorted = sortByAlias(transferSamples);
    for (TransferSample transferSample : sorted) {
        Sample sample = transferSample.getItem();
        DetailedSample detailedSample = detailed ? (DetailedSample) sample : null;
        List<DomContent> cells = new ArrayList<>();
        cells.add(makeTd(sample.getAlias()));
        if (detailed) {
            cells.add(makeTd(dnaOrRna(detailedSample)));
            cells.add(makeTd(detailedSample.getIdentityAttributes().getExternalName()));
        }
        BigDecimal volume = transferSample.getDistributedVolume() != null ? transferSample.getDistributedVolume() : sample.getVolume();
        cells.add(makeTd(LimsUtils.toNiceString(volume)));
        cells.add(makeTd(LimsUtils.toNiceString(sample.getConcentration())));
        cells.add(makeTd(getYieldString(volume, sample.getConcentration())));
        if (detailed) {
            cells.add(makeTd(detailedSample.getSubproject() == null ? null : detailedSample.getSubproject().getAlias()));
            GroupIdentifiable groupIdEntity = detailedSample.getEffectiveGroupIdEntity();
            cells.add(makeTd(groupIdEntity == null ? null : groupIdEntity.getGroupId()));
            cells.add(makeTd(groupIdEntity == null ? null : groupIdEntity.getGroupDescription()));
        }
        cells.add(makeTd(sample.getIdentificationBarcode()));
        cells.add(makeTd(makeLocationLabel(transferSample)));
        rows.add(tr().with(cells));
    }
    return makeTable(headerRow, rows);
}
Also used : DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) Sample(uk.ac.bbsrc.tgac.miso.core.data.Sample) TransferSample(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample) ArrayList(java.util.ArrayList) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) GroupIdentifiable(uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable) DomContent(j2html.tags.DomContent) TransferSample(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample) ContainerTag(j2html.tags.ContainerTag) BigDecimal(java.math.BigDecimal)

Example 4 with GroupIdentifiable

use of uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable in project miso-lims by miso-lims.

the class Dtos method asDetailedSampleDto.

private static DetailedSampleDto asDetailedSampleDto(@Nonnull DetailedSample from) {
    DetailedSampleDto dto = null;
    if (isIdentitySample(from)) {
        dto = asIdentitySampleDto((SampleIdentity) from);
    } else if (isTissueSample(from)) {
        dto = asTissueSampleDto((SampleTissue) from);
    } else if (isTissueProcessingSample(from)) {
        dto = asTissueProcessingSampleDto((SampleTissueProcessing) from);
    } else if (isAliquotSample(from)) {
        dto = asAliquotSampleDto((SampleAliquot) from);
    } else if (isStockSample(from)) {
        dto = asStockSampleDto((SampleStock) from);
    } else {
        throw new IllegalArgumentException();
    }
    dto.setSampleClassId(from.getSampleClass().getId());
    dto.setSampleClassAlias(from.getSampleClass().getAlias());
    dto.setSampleCategory(from.getSampleClass().getSampleCategory());
    dto.setSampleSubcategory(from.getSampleClass().getSampleSubcategory());
    if (from.getSubproject() != null) {
        dto.setSubprojectId(from.getSubproject().getId());
        dto.setSubprojectAlias(from.getSubproject().getAlias());
        dto.setSubprojectPriority(from.getSubproject().getPriority());
    }
    if (from.getParent() != null) {
        DetailedSample parent = from.getParent();
        dto.setParentId(parent.getId());
        setString(dto::setParentName, parent.getName());
        dto.setParentAlias(parent.getAlias());
        dto.setParentSampleClassId(parent.getSampleClass().getId());
        if (parent.getBox() != null) {
            dto.setParentBoxPosition(parent.getBoxPosition());
            dto.setParentBoxPositionLabel(BoxUtils.makeBoxPositionLabel(parent.getBox().getAlias(), parent.getBoxPosition()));
        }
    }
    GroupIdentifiable effective = from.getEffectiveGroupIdEntity();
    if (effective != null) {
        dto.setEffectiveGroupId(effective.getGroupId());
        dto.setEffectiveGroupIdSample(effective.getAlias());
    }
    if (from.getGroupId() != null) {
        dto.setGroupId(from.getGroupId());
    }
    if (from.getGroupDescription() != null) {
        dto.setGroupDescription(from.getGroupDescription());
    }
    if (from.isSynthetic() != null) {
        dto.setSynthetic(from.isSynthetic());
    }
    setDateString(dto::setCreationDate, from.getCreationDate());
    dto.setNonStandardAlias(from.hasNonStandardAlias());
    setString(dto::setVolumeUsed, from.getVolumeUsed());
    setString(dto::setNgUsed, from.getNgUsed());
    if (from.getIdentityAttributes() != null) {
        ParentIdentityAttributes identity = from.getIdentityAttributes();
        setString(dto::setIdentityConsentLevel, maybeGetProperty(identity.getConsentLevel(), ConsentLevel::getLabel));
        setString(dto::setEffectiveExternalNames, identity.getExternalName());
    }
    if (from.getTissueAttributes() != null) {
        ParentTissueAttributes tissue = from.getTissueAttributes();
        setString(dto::setEffectiveTissueOriginAlias, tissue.getTissueOrigin().getAlias());
        setString(dto::setEffectiveTissueOriginDescription, tissue.getTissueOrigin().getDescription());
        setString(dto::setEffectiveTissueTypeAlias, tissue.getTissueType().getAlias());
        setString(dto::setEffectiveTissueTypeDescription, tissue.getTissueType().getDescription());
    }
    setEffectiveQcFailure(from, dto);
    if (from.getRequisition() == null) {
        Requisition requisition = getParentRequisition(from);
        setId(dto::setEffectiveRequisitionId, requisition);
        setString(dto::setEffectiveRequisitionAlias, maybeGetProperty(requisition, Requisition::getAlias));
    }
    return dto;
}
Also used : SampleTissueProcessing(uk.ac.bbsrc.tgac.miso.core.data.SampleTissueProcessing) ParentTissueAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes) SampleIdentity(uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity) ParentIdentityAttributes(uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentIdentityAttributes) DetailedSample(uk.ac.bbsrc.tgac.miso.core.data.DetailedSample) GroupIdentifiable(uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable) Requisition(uk.ac.bbsrc.tgac.miso.core.data.impl.Requisition) SampleStock(uk.ac.bbsrc.tgac.miso.core.data.SampleStock)

Aggregations

GroupIdentifiable (uk.ac.bbsrc.tgac.miso.core.data.GroupIdentifiable)4 DetailedSample (uk.ac.bbsrc.tgac.miso.core.data.DetailedSample)3 ParentIdentityAttributes (uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentIdentityAttributes)2 ParentTissueAttributes (uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes)2 ContainerTag (j2html.tags.ContainerTag)1 DomContent (j2html.tags.DomContent)1 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)1 SampleIdentity (uk.ac.bbsrc.tgac.miso.core.data.SampleIdentity)1 SampleStock (uk.ac.bbsrc.tgac.miso.core.data.SampleStock)1 SampleTissueProcessing (uk.ac.bbsrc.tgac.miso.core.data.SampleTissueProcessing)1 Requisition (uk.ac.bbsrc.tgac.miso.core.data.impl.Requisition)1 TransferSample (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample)1