use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes in project miso-lims by miso-lims.
the class Dtos method asDto.
public static LibraryAliquotDto asDto(@Nonnull ListLibraryAliquotView from) {
LibraryAliquotDto dto = null;
if (from.getParentAttributes() != null) {
// indicates detailed sample
DetailedLibraryAliquotDto detailedDto = new DetailedLibraryAliquotDto();
setId(detailedDto::setLibraryDesignCodeId, from.getDesignCode());
if (from.getSubprojectId() != null) {
detailedDto.setSubprojectAlias(from.getSubprojectAlias());
detailedDto.setSubprojectPriority(from.getSubprojectPriority());
}
if (from.getIdentityAttributes() != null) {
ParentIdentityAttributes identity = from.getIdentityAttributes();
setString(detailedDto::setIdentityConsentLevel, maybeGetProperty(identity.getConsentLevel(), ConsentLevel::getLabel));
setString(detailedDto::setEffectiveExternalNames, identity.getExternalName());
}
if (from.getTissueAttributes() != null) {
ParentTissueAttributes tissue = from.getTissueAttributes();
setString(detailedDto::setEffectiveTissueOriginAlias, tissue.getTissueOrigin().getAlias());
setString(detailedDto::setEffectiveTissueOriginDescription, tissue.getTissueOrigin().getDescription());
setString(detailedDto::setEffectiveTissueTypeAlias, tissue.getTissueType().getAlias());
setString(detailedDto::setEffectiveTissueTypeDescription, tissue.getTissueType().getDescription());
}
dto = detailedDto;
} else {
dto = new LibraryAliquotDto();
}
dto.setId(from.getId());
dto.setName(from.getName());
setString(dto::setAlias, from.getAlias());
setString(dto::setCreatorName, maybeGetProperty(from.getCreator(), User::getFullName));
setString(dto::setConcentration, from.getConcentration());
dto.setConcentrationUnits(from.getConcentrationUnits());
dto.setLastModified(formatDateTime(from.getLastModified()));
dto.setCreationDate(formatDate(from.getCreated()));
dto.setIdentificationBarcode(from.getAliquotBarcode());
dto.setLocationLabel(BoxUtils.makeLocationLabel(from));
dto.setIndexIds(Stream.of(from.getParentLibrary().getIndex1(), from.getParentLibrary().getIndex2()).filter(Objects::nonNull).map(Index::getId).collect(Collectors.toList()));
dto.setIndexLabels(Stream.of(from.getParentLibrary().getIndex1(), from.getParentLibrary().getIndex2()).filter(Objects::nonNull).map(Index::getLabel).collect(Collectors.toList()));
dto.setTargetedSequencingId(from.getTargetedSequencingId());
setInteger(dto::setDnaSize, from.getDnaSize(), true);
setString(dto::setVolume, from.getAliquotVolume());
dto.setVolumeUnits(from.getAliquotVolumeUnits());
setString(dto::setNgUsed, from.getNgUsed());
setString(dto::setVolumeUsed, from.getVolumeUsed());
dto.setLibraryId(from.getLibraryId());
dto.setLibraryName(from.getLibraryName());
dto.setLibraryAlias(from.getLibraryAlias());
dto.setLibraryLowQuality(from.isLibraryLowQuality());
dto.setLibraryPlatformType(from.getPlatformType().getKey());
dto.setSampleId(from.getSampleId());
dto.setSampleName(from.getSampleName());
dto.setSampleAlias(from.getSampleAlias());
setString(dto::setSequencingControlTypeAlias, maybeGetProperty(from.getSampleSequencingControlType(), SequencingControlType::getAlias));
setId(dto::setDetailedQcStatusId, from.getDetailedQcStatus());
setString(dto::setDetailedQcStatusNote, from.getDetailedQcStatusNote());
setString(dto::setQcUserName, maybeGetProperty(from.getQcUser(), User::getFullName));
setDateString(dto::setQcDate, from.getQcDate());
List<Long> parentAliquotIds = new ArrayList<>();
for (ParentAliquot parent = from.getParentAliquot(); parent != null; parent = parent.getParentAliquot()) {
parentAliquotIds.add(parent.getId());
}
dto.setParentAliquotIds(parentAliquotIds);
setEffectiveQcFailure(from, dto);
return dto;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes in project miso-lims by miso-lims.
the class Dtos method asMinimalDto.
public static SampleDto asMinimalDto(@Nonnull Sample from) {
DetailedSampleDto dto = new DetailedSampleDto();
copySampleFields(from, dto, false, 0);
if (isDetailedSample(from)) {
DetailedSample detailed = (DetailedSample) from;
dto.setSampleClassId(detailed.getSampleClass().getId());
setDateString(dto::setCreationDate, detailed.getCreationDate());
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));
setString(dto::setEffectiveExternalNames, identity.getExternalName());
}
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());
setString(dto::setEffectiveTimepoint, tissue.getTimepoint());
}
setEffectiveQcFailure(from, dto);
}
return dto;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes in project miso-lims by miso-lims.
the class Dtos method asDto.
public static LibraryAliquotDto asDto(@Nonnull LibraryAliquot from, boolean includeBoxPositions) {
LibraryAliquotDto dto = null;
Library library = from.getLibrary();
Sample sample = library == null ? null : library.getSample();
if (isDetailedLibraryAliquot(from)) {
DetailedLibraryAliquotDto detailedDto = asDetailedDto((DetailedLibraryAliquot) from);
DetailedSample detailed = (DetailedSample) sample;
if (detailed.getSubproject() != null) {
detailedDto.setSubprojectAlias(detailed.getSubproject().getAlias());
detailedDto.setSubprojectPriority(detailed.getSubproject().getPriority());
}
if (detailed.getIdentityAttributes() != null) {
ParentIdentityAttributes identity = detailed.getIdentityAttributes();
setString(detailedDto::setIdentityConsentLevel, maybeGetProperty(identity.getConsentLevel(), ConsentLevel::getLabel));
setString(detailedDto::setEffectiveExternalNames, identity.getExternalName());
}
if (detailed.getTissueAttributes() != null) {
ParentTissueAttributes tissue = detailed.getTissueAttributes();
setString(detailedDto::setEffectiveTissueOriginAlias, tissue.getTissueOrigin().getAlias());
setString(detailedDto::setEffectiveTissueOriginDescription, tissue.getTissueOrigin().getDescription());
setString(detailedDto::setEffectiveTissueTypeAlias, tissue.getTissueType().getAlias());
setString(detailedDto::setEffectiveTissueTypeDescription, tissue.getTissueType().getDescription());
}
dto = detailedDto;
} else {
dto = new LibraryAliquotDto();
}
if (library != null) {
setLong(dto::setLibraryId, library.getId(), true);
setString(dto::setLibraryName, library.getName());
setString(dto::setLibraryAlias, library.getAlias());
setBoolean(dto::setLibraryLowQuality, library.isLowQuality(), false);
setString(dto::setLibraryPlatformType, library.getPlatformType().getKey());
if (library.getIndex1() != null) {
List<Index> indices = Stream.of(library.getIndex1(), library.getIndex2()).filter(Objects::nonNull).collect(Collectors.toList());
dto.setIndexIds(indices.stream().sorted(Comparator.comparingInt(Index::getPosition)).map(Index::getId).collect(Collectors.toList()));
dto.setIndexLabels(indices.stream().sorted(Comparator.comparingInt(Index::getPosition)).map(Index::getLabel).collect(Collectors.toList()));
}
if (sample != null) {
setLong(dto::setSampleId, sample.getId(), true);
setString(dto::setSampleName, sample.getName());
setString(dto::setSampleAlias, sample.getAlias());
}
}
if (from.getParentAliquot() != null) {
setLong(dto::setParentAliquotId, from.getParentAliquot().getId(), true);
setString(dto::setParentAliquotAlias, from.getParentAliquot().getAlias());
}
setString(dto::setParentName, maybeGetProperty(from.getParent(), HierarchyEntity::getName));
setString(dto::setParentVolume, maybeGetProperty(from.getParent(), HierarchyEntity::getVolume));
dto.setId(from.getId());
dto.setName(from.getName());
setString(dto::setAlias, from.getAlias());
setString(dto::setDescription, from.getDescription());
dto.setCreatorName(from.getCreator().getFullName());
setString(dto::setConcentration, from.getConcentration());
dto.setConcentrationUnits(from.getConcentrationUnits());
setString(dto::setVolume, from.getVolume());
dto.setVolumeUnits(from.getVolumeUnits());
setString(dto::setNgUsed, from.getNgUsed());
setString(dto::setVolumeUsed, from.getVolumeUsed());
setInteger(dto::setDnaSize, from.getDnaSize(), true);
if (from.getCreationDate() != null) {
dto.setCreationDate(formatDate(from.getCreationDate()));
}
dto.setIdentificationBarcode(from.getIdentificationBarcode());
dto.setLocationLabel(BoxUtils.makeLocationLabel(from));
if (from.getTargetedSequencing() != null) {
dto.setTargetedSequencingId(from.getTargetedSequencing().getId());
}
if (from.getBox() != null) {
dto.setBox(asDto(from.getBox(), includeBoxPositions));
dto.setBoxPosition(from.getBoxPosition());
}
dto.setDiscarded(from.isDiscarded());
setDateTimeString(dto::setLastModified, from.getLastModified());
setId(dto::setDetailedQcStatusId, from.getDetailedQcStatus());
setString(dto::setDetailedQcStatusNote, from.getDetailedQcStatusNote());
setString(dto::setQcUserName, maybeGetProperty(from.getQcUser(), User::getFullName));
setDateString(dto::setQcDate, from.getQcDate());
setEffectiveQcFailure(from, dto);
setId(dto::setKitDescriptorId, from.getKitDescriptor());
setString(dto::setKitLot, from.getKitLot());
Requisition requisition = from.getLibrary().getSample().getRequisition();
if (requisition == null) {
requisition = getParentRequisition(from.getLibrary().getSample());
}
setId(dto::setRequisitionId, requisition);
setString(dto::setRequisitionAlias, maybeGetProperty(requisition, Requisition::getAlias));
return dto;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes 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;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.view.ParentTissueAttributes 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;
}
Aggregations