Mercurial > hg > orthanc
comparison OrthancServer/ServerJobs/OrthancJobUnserializer.cpp @ 2655:c196d76cb8fa jobs
serialization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 Jun 2018 17:57:49 +0200 |
parents | a3f0f61a14ca |
children | a6d3e45eeff5 |
comparison
equal
deleted
inserted
replaced
2654:761031029aa9 | 2655:c196d76cb8fa |
---|---|
35 #include "OrthancJobUnserializer.h" | 35 #include "OrthancJobUnserializer.h" |
36 | 36 |
37 #include "../../Core/Logging.h" | 37 #include "../../Core/Logging.h" |
38 #include "../../Core/OrthancException.h" | 38 #include "../../Core/OrthancException.h" |
39 | 39 |
40 #include "Operations/DeleteResourceOperation.h" | |
40 #include "Operations/DicomInstanceOperationValue.h" | 41 #include "Operations/DicomInstanceOperationValue.h" |
42 #include "Operations/ModifyInstanceOperation.h" | |
43 #include "Operations/StorePeerOperation.h" | |
44 #include "Operations/StoreScuOperation.h" | |
45 #include "Operations/SystemCallOperation.h" | |
41 | 46 |
42 namespace Orthanc | 47 namespace Orthanc |
43 { | 48 { |
44 IJob* OrthancJobUnserializer::UnserializeJob(const Json::Value& source) | 49 IJob* OrthancJobUnserializer::UnserializeJob(const Json::Value& source) |
45 { | 50 { |
47 } | 52 } |
48 | 53 |
49 | 54 |
50 IJobOperation* OrthancJobUnserializer::UnserializeOperation(const Json::Value& source) | 55 IJobOperation* OrthancJobUnserializer::UnserializeOperation(const Json::Value& source) |
51 { | 56 { |
52 const std::string type = GetString(source, "Type"); | 57 const std::string type = ReadString(source, "Type"); |
53 | 58 |
54 return GenericJobUnserializer::UnserializeOperation(source); | 59 if (type == "DeleteResource") |
60 { | |
61 return new DeleteResourceOperation(context_); | |
62 } | |
63 else if (type == "ModifyInstance") | |
64 { | |
65 return new ModifyInstanceOperation(context_, source); | |
66 } | |
67 else if (type == "StorePeer") | |
68 { | |
69 return new StorePeerOperation(source); | |
70 } | |
71 else if (type == "StoreScu") | |
72 { | |
73 return new StoreScuOperation(source); | |
74 } | |
75 else if (type == "SystemCall") | |
76 { | |
77 return new SystemCallOperation(source); | |
78 } | |
79 else | |
80 { | |
81 return GenericJobUnserializer::UnserializeOperation(source); | |
82 } | |
55 } | 83 } |
56 | 84 |
57 | 85 |
58 JobOperationValue* OrthancJobUnserializer::UnserializeValue(const Json::Value& source) | 86 JobOperationValue* OrthancJobUnserializer::UnserializeValue(const Json::Value& source) |
59 { | 87 { |
60 const std::string type = GetString(source, "Type"); | 88 const std::string type = ReadString(source, "Type"); |
61 | 89 |
62 if (type == "DicomInstance") | 90 if (type == "DicomInstance") |
63 { | 91 { |
64 return new DicomInstanceOperationValue(context_, GetString(source, "ID")); | 92 return new DicomInstanceOperationValue(context_, ReadString(source, "ID")); |
65 } | 93 } |
66 else | 94 else |
67 { | 95 { |
68 return GenericJobUnserializer::UnserializeValue(source); | 96 return GenericJobUnserializer::UnserializeValue(source); |
69 } | 97 } |