Mercurial > hg > orthanc
diff OrthancServer/ServerContext.cpp @ 1008:187ed107a59f lua-scripting
modify command
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 08 Jul 2014 18:14:24 +0200 |
parents | 871c49c9b11d |
children | 26642cecd36d |
line wrap: on
line diff
--- a/OrthancServer/ServerContext.cpp Tue Jul 08 17:35:00 2014 +0200 +++ b/OrthancServer/ServerContext.cpp Tue Jul 08 18:14:24 2014 +0200 @@ -45,6 +45,7 @@ #include "Scheduler/DeleteInstanceCommand.h" +#include "Scheduler/ModifyInstanceCommand.h" #include "Scheduler/StoreScuCommand.h" #include "Scheduler/StorePeerCommand.h" @@ -150,6 +151,33 @@ return new StorePeerCommand(context, parameters); } + if (operation == "modify") + { + LOG(INFO) << "Lua script to modify instance " << parameters["instance"].asString(); + std::auto_ptr<ModifyInstanceCommand> command(new ModifyInstanceCommand(context)); + + if (parameters.isMember("replacements")) + { + const Json::Value& replacements = parameters["replacements"]; + if (replacements.type() != Json::objectValue) + { + throw OrthancException(ErrorCode_BadParameterType); + } + + Json::Value::Members members = replacements.getMemberNames(); + for (Json::Value::Members::const_iterator + it = members.begin(); it != members.end(); ++it) + { + command->GetModification().Replace(FromDcmtkBridge::ParseTag(*it), + replacements[*it].asString()); + } + + // TODO OTHER PARAMETERS OF MODIFY + } + + return command.release(); + } + throw OrthancException(ErrorCode_ParameterOutOfRange); } @@ -209,6 +237,13 @@ throw OrthancException(ErrorCode_InternalError); } + /* + TODO +if (previousCommand != NULL) + { + previousCommand->ConnectNext(command); + }*/ + previousCommand = &command; }