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