use of uk.ac.bbsrc.tgac.miso.core.data.impl.OxfordNanoporeContainer in project miso-lims by miso-lims.
the class Dtos method to.
public static SequencerPartitionContainer to(@Nonnull ContainerDto from) {
SequencerPartitionContainer to = null;
if (from instanceof OxfordNanoporeContainerDto) {
OxfordNanoporeContainerDto ontFrom = (OxfordNanoporeContainerDto) from;
OxfordNanoporeContainer ontTo = new OxfordNanoporeContainer();
setObject(ontTo::setPoreVersion, PoreVersion::new, ontFrom.getPoreVersionId());
setDate(ontTo::setReceivedDate, ontFrom.getReceivedDate());
setDate(ontTo::setReturnedDate, ontFrom.getReturnedDate());
to = ontTo;
} else {
to = new SequencerPartitionContainerImpl();
}
setLong(to::setId, from.getId(), false);
setString(to::setIdentificationBarcode, from.getIdentificationBarcode());
setObject(to::setModel, SequencingContainerModel::new, maybeGetProperty(from.getModel(), SequencingContainerModelDto::getId));
setString(to::setDescription, from.getDescription());
setObject(to::setClusteringKit, KitDescriptor::new, from.getClusteringKitId());
setString(to::setClusteringKitLot, from.getClusteringKitLot());
setObject(to::setMultiplexingKit, KitDescriptor::new, from.getMultiplexingKitId());
setString(to::setMultiplexingKitLot, from.getMultiplexingKitLot());
return to;
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.OxfordNanoporeContainer in project miso-lims by miso-lims.
the class DefaultContainerService method loadChildEntities.
/**
* Loads persisted objects into container fields. Should be called before saving new containers. Loads all member objects <b>except</b>
* <ul>
* <li>creator/lastModifier User objects</li>
* </ul>
*
* @param container the SequencerPartitionContainer to load entities into. Must contain at least the IDs of objects to load (e.g. to load
* the persisted SequencingContainerModel
* into container.model, container.model.id must be set)
* @throws IOException
*/
private void loadChildEntities(SequencerPartitionContainer container) throws IOException {
container.setModel(containerModelService.get(container.getModel().getId()));
if (container.getClusteringKit() != null) {
KitDescriptor descriptor = kitService.get(container.getClusteringKit().getId());
if (descriptor.getKitType() != KitType.CLUSTERING) {
throw new IllegalArgumentException(descriptor.getName() + " is not a clustering kit.");
}
container.setClusteringKit(descriptor);
}
if (container.getMultiplexingKit() != null) {
KitDescriptor descriptor = kitService.get(container.getMultiplexingKit().getId());
if (descriptor.getKitType() != KitType.MULTIPLEXING) {
throw new IllegalArgumentException(descriptor.getName() + " is not a multiplexing kit.");
}
container.setMultiplexingKit(descriptor);
}
if (LimsUtils.isOxfordNanoporeContainer(container)) {
OxfordNanoporeContainer ontContainer = (OxfordNanoporeContainer) container;
if (ontContainer.getPoreVersion() != null) {
ontContainer.setPoreVersion(containerDao.getPoreVersion(ontContainer.getPoreVersion().getId()));
}
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.OxfordNanoporeContainer in project miso-lims by miso-lims.
the class Dtos method asDto.
public static ContainerDto asDto(@Nonnull SequencerPartitionContainer from, boolean includePartitions, boolean includePoolContents, IndexChecker indexChecker) {
ContainerDto dto = null;
if (from instanceof OxfordNanoporeContainer) {
OxfordNanoporeContainer ontFrom = (OxfordNanoporeContainer) from;
OxfordNanoporeContainerDto ontDto = new OxfordNanoporeContainerDto();
if (ontFrom.getPoreVersion() != null) {
ontDto.setPoreVersionId(ontFrom.getPoreVersion().getId());
}
ontDto.setReceivedDate(formatDate(ontFrom.getReceivedDate()));
ontDto.setReturnedDate(formatDate(ontFrom.getReturnedDate()));
dto = ontDto;
} else {
dto = new ContainerDto();
}
dto.setId(from.getId());
dto.setIdentificationBarcode(from.getIdentificationBarcode());
dto.setModel(asDto(from.getModel()));
dto.setDescription(from.getDescription());
Run lastRun = from.getLastRun();
if (lastRun != null) {
dto.setLastRunAlias(lastRun.getAlias());
dto.setLastRunId(lastRun.getId());
dto.setLastRunInstrumentModelId(lastRun.getSequencer().getInstrumentModel().getId());
dto.setLastSequencerId(lastRun.getSequencer().getId());
dto.setLastSequencerName(lastRun.getSequencer().getName());
}
if (from.getLastModified() != null) {
dto.setLastModified(formatDateTime(from.getLastModified()));
}
if (from.getClusteringKit() != null) {
dto.setClusteringKitId(from.getClusteringKit().getId());
}
setString(dto::setClusteringKitLot, from.getClusteringKitLot());
if (from.getMultiplexingKit() != null) {
dto.setMultiplexingKitId(from.getMultiplexingKit().getId());
}
setString(dto::setMultiplexingKitLot, from.getMultiplexingKitLot());
if (includePartitions) {
dto.setPartitions(asPartitionDtos(from.getPartitions(), includePoolContents, indexChecker));
}
return dto;
}
Aggregations