if (container.getClusteringKit() != null) { KitDescriptor descriptor = kitService.getKitDescriptorById(container.getClusteringKit().getId()); if (descriptor.getKitType() != KitType.CLUSTERING) { throw new IllegalArgumentException(descriptor.getName() + " is not a clustering kit.");
public static ContainerDto asDto(@Nonnull SequencerPartitionContainer from, boolean includePartitions, boolean includePoolContents) { ContainerDto dto = new ContainerDto(); dto.setId(from.getId()); dto.setIdentificationBarcode(from.getIdentificationBarcode()); dto.setModel(asDto(from.getModel())); Run lastRun = from.getLastRun(); if (lastRun != null) { dto.setLastRunAlias(lastRun.getAlias()); dto.setLastRunId(lastRun.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.setClusteringKit(asDto(from.getClusteringKit())); } if (from.getMultiplexingKit() != null) { dto.setMultiplexingKit(asDto(from.getMultiplexingKit())); } if (includePartitions) { dto.setPartitions(asPartitionDtos(from.getPartitions(), includePoolContents)); } return dto; }
@Override public void applyChanges(SequencerPartitionContainer source, SequencerPartitionContainer managed) throws IOException { managed.setIdentificationBarcode(source.getIdentificationBarcode()); managed.setDescription(source.getDescription()); managed.setClusteringKit(source.getClusteringKit()); managed.setMultiplexingKit(source.getMultiplexingKit()); if (LimsUtils.isOxfordNanoporeContainer(managed)) { applyOxfordNanoporeChanges((OxfordNanoporeContainer) source, (OxfordNanoporeContainer) managed); } for (Partition sourcePartition : source.getPartitions()) { for (Partition managedPartition : managed.getPartitions()) { if (sourcePartition == null || managedPartition == null) { throw new IOException("Partition from " + (sourcePartition == null ? "client" : "database") + " is null."); } if (sourcePartition.getId() == managedPartition.getId()) { Pool sourcePool = sourcePartition.getPool(); Pool managedPool = managedPartition.getPool(); if (sourcePool == null) { managedPartition.setPool(null); } else if (managedPool == null || sourcePool.getId() != managedPool.getId()) { managedPartition.setPool(poolService.get(sourcePool.getId())); } break; } } } }