@Override public void execute(WorkflowExecutor workflowExecutor) throws IOException { if (!isComplete()) throw new IllegalStateException("Workflow is not complete"); SequencerPartitionContainer spc; if (containerStep.isExistingContainer()) { spc = containerStep.getContainer(); } else { spc = new SequencerPartitionContainerImpl(); SequencingContainerModel model = containerModelStep.getModel(); spc.setModel(model); spc.setIdentificationBarcode(containerStep.getBarcode()); spc.setPartitionLimit(model.getPartitionCount()); } for (int i = 0; i < partitionSteps.size(); ++i) { spc.getPartitionAt(i + 1).setPool(partitionSteps.get(i).getPool()); } workflowExecutor.save(spc); }
private void applyChanges(Partition target, Partition source) { target.setPool(source.getPool()); target.setLoadingConcentration(source.getLoadingConcentration()); target.setLoadingConcentrationUnits(source.getLoadingConcentrationUnits()); if (target.getPool() == null) { target.setLoadingConcentration(null); } if (target.getLoadingConcentration() == null) { target.setLoadingConcentrationUnits(null); } }
@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; } } } }
@Override public void update(Partition partition) throws IOException { Partition original = containerDao.getPartitionById(partition.getId()); authorizationManager.throwIfNotWritable(original.getSequencerPartitionContainer()); if (partition.getPool() != null) { partition.setPool(poolService.get(partition.getPool().getId())); } validateChange(partition, original); applyChanges(original, partition); original.getSequencerPartitionContainer().setChangeDetails(authorizationManager.getCurrentUser()); containerDao.save(original.getSequencerPartitionContainer()); }