Updated champ-lib to use the correct logger
[aai/champ.git] / champ-service / src / main / java / org / onap / champ / entity / ChampBulkPayload.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.champ.entity;
23
24 import com.google.gson.Gson;
25 import com.google.gson.GsonBuilder;
26
27 import java.util.ArrayList;
28 import java.util.List;
29
30
31 public class ChampBulkPayload {
32
33   public static String ADD_OP = "add";
34   public static String UPDATE_OP = "modify";
35   public static String DELETE_OP = "delete";
36   public static String PATCH_OP = "patch";
37
38   private List<ChampBulkOp> edgeDeleteOps = new ArrayList<ChampBulkOp>();
39   private List<ChampBulkOp> vertexDeleteOps = new ArrayList<ChampBulkOp>();
40   private List<ChampBulkOp> vertexAddModifyOps = new ArrayList<ChampBulkOp>();
41   private List<ChampBulkOp> edgeAddModifyOps = new ArrayList<ChampBulkOp>();
42
43   private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
44
45   public String toJson() {
46     return gson.toJson(this);
47   }
48
49   public static ChampBulkPayload fromJson(String payload) {
50     return gson.fromJson(payload, ChampBulkPayload.class);
51   }
52
53   public List<ChampBulkOp> getEdgeDeleteOps() {
54     return edgeDeleteOps;
55   }
56
57   public void setEdgeDeleteOps(List<ChampBulkOp> ops) {
58     this.edgeDeleteOps = ops;
59   }
60
61   public List<ChampBulkOp> getVertexDeleteOps() {
62     return vertexDeleteOps;
63   }
64
65   public void setVertexDeleteOps(List<ChampBulkOp> ops) {
66     this.vertexDeleteOps = ops;
67   }
68
69   public List<ChampBulkOp> getVertexAddModifyOps() {
70     return vertexAddModifyOps;
71   }
72
73   public void setVertexAddModifyOps(List<ChampBulkOp> ops) {
74     this.vertexAddModifyOps = ops;
75   }
76
77   public List<ChampBulkOp> getEdgeAddModifyOps() {
78     return edgeAddModifyOps;
79   }
80
81   public void setEdgeAddModifyOps(List<ChampBulkOp> ops) {
82     this.edgeAddModifyOps = ops;
83   }
84 }