Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerJobs/Operations/DeleteResourceOperation.cpp @ 4935:acd3f72e2a21 more-tags
split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 10 Mar 2022 19:00:43 +0100 |
parents | 6eff25f70121 |
children | 0ea402b4d901 |
rev | line source |
---|---|
2603 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
2603 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU General Public License as | |
10 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
2641 | 23 #include "../../PrecompiledHeadersServer.h" |
2603 | 24 #include "DeleteResourceOperation.h" |
25 | |
26 #include "DicomInstanceOperationValue.h" | |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
27 #include "../../ServerContext.h" |
2603 | 28 |
4045 | 29 #include "../../../../OrthancFramework/Sources/Logging.h" |
30 #include "../../../../OrthancFramework/Sources/OrthancException.h" | |
2603 | 31 |
32 namespace Orthanc | |
33 { | |
34 void DeleteResourceOperation::Apply(JobOperationValues& outputs, | |
4310
2ae905070221
renaming pure interface JobOperationValue as IJobOperationValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
35 const IJobOperationValue& input) |
2603 | 36 { |
37 switch (input.GetType()) | |
38 { | |
4310
2ae905070221
renaming pure interface JobOperationValue as IJobOperationValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
39 case IJobOperationValue::Type_DicomInstance: |
2603 | 40 { |
41 const DicomInstanceOperationValue& instance = dynamic_cast<const DicomInstanceOperationValue&>(input); | |
2605
1e11b0229e04
StorePeerOperation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
42 LOG(INFO) << "Lua: Deleting instance: " << instance.GetId(); |
2603 | 43 |
44 try | |
45 { | |
46 Json::Value tmp; | |
47 context_.DeleteResource(tmp, instance.GetId(), ResourceType_Instance); | |
48 } | |
49 catch (OrthancException& e) | |
50 { | |
2605
1e11b0229e04
StorePeerOperation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
51 LOG(ERROR) << "Lua: Unable to delete instance " << instance.GetId() << ": " << e.What(); |
2603 | 52 } |
53 | |
54 break; | |
55 } | |
56 | |
57 default: | |
58 break; | |
59 } | |
60 } | |
61 } |