# HG changeset patch # User Sebastien Jodogne # Date 1404480702 -7200 # Node ID f3929718ea7eb042584b63b6a66362ebb0011ae2 # Parent 13e230bbd882cea26f70f4a3997218f590ba6ae8 autorouting primitives diff -r 13e230bbd882 -r f3929718ea7e CMakeLists.txt --- a/CMakeLists.txt Fri Jul 04 14:14:14 2014 +0200 +++ b/CMakeLists.txt Fri Jul 04 15:31:42 2014 +0200 @@ -154,6 +154,7 @@ OrthancServer/OrthancMoveRequestHandler.cpp # From "lua-scripting" branch + OrthancServer/Scheduler/DeleteInstanceCommand.cpp OrthancServer/Scheduler/ServerCommandInstance.cpp OrthancServer/Scheduler/ServerJob.cpp OrthancServer/Scheduler/ServerScheduler.cpp diff -r 13e230bbd882 -r f3929718ea7e OrthancServer/Scheduler/ServerCommandInstance.cpp --- a/OrthancServer/Scheduler/ServerCommandInstance.cpp Fri Jul 04 14:14:14 2014 +0200 +++ b/OrthancServer/Scheduler/ServerCommandInstance.cpp Fri Jul 04 15:31:42 2014 +0200 @@ -39,7 +39,21 @@ bool ServerCommandInstance::Execute(IListener& listener) { ListOfStrings outputs; - if (!filter_->Apply(outputs, inputs_)) + + bool success = false; + + try + { + if (filter_->Apply(outputs, inputs_)) + { + success = true; + } + } + catch (OrthancException&) + { + } + + if (!success) { listener.SignalFailure(jobId_); return true; diff -r 13e230bbd882 -r f3929718ea7e OrthancServer/Scheduler/StoreScuCommand.cpp --- a/OrthancServer/Scheduler/StoreScuCommand.cpp Fri Jul 04 14:14:14 2014 +0200 +++ b/OrthancServer/Scheduler/StoreScuCommand.cpp Fri Jul 04 15:31:42 2014 +0200 @@ -58,6 +58,8 @@ std::string dicom; context_.ReadFile(dicom, *it, FileContentType_Dicom); locker.GetConnection().Store(dicom); + + outputs.push_back(*it); } return true; diff -r 13e230bbd882 -r f3929718ea7e OrthancServer/ServerContext.cpp --- a/OrthancServer/ServerContext.cpp Fri Jul 04 14:14:14 2014 +0200 +++ b/OrthancServer/ServerContext.cpp Fri Jul 04 15:31:42 2014 +0200 @@ -43,6 +43,12 @@ #include #include + +#include "Scheduler/DeleteInstanceCommand.h" +#include "Scheduler/StoreScuCommand.h" + + + #define ENABLE_DICOM_CACHE 1 static const char* RECEIVED_INSTANCE_FILTER = "ReceivedInstanceFilter"; @@ -131,6 +137,20 @@ printf("TODO\n"); std::cout << result; } + + { + // Autorouting test + RemoteModalityParameters p = Configuration::GetModalityUsingSymbolicName("sample"); + + ServerJob job; + ServerCommandInstance& a = job.AddCommand(new StoreScuCommand(*this, p)); + ServerCommandInstance& b = job.AddCommand(new DeleteInstanceCommand(*this)); + a.AddInput(instanceId); + a.ConnectNext(b); + + job.SetDescription("Autorouting test"); + scheduler_.Submit(job); + } } @@ -196,8 +216,15 @@ if (status == StoreStatus_Success || status == StoreStatus_AlreadyStored) { - DicomInstanceHasher hasher(dicomSummary); - ApplyOnStoredInstance(simplified, hasher.HashInstance()); + try + { + DicomInstanceHasher hasher(dicomSummary); + ApplyOnStoredInstance(simplified, hasher.HashInstance()); + } + catch (OrthancException&) + { + LOG(ERROR) << "Error when dealing with OnStoredInstance"; + } } return status;