2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License ati
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
25 package org.openecomp.sa.rest;
29 * This class represents a single instance of a request from the search client
30 * that would be part of a bundle of such operations sent in a single bulk
33 public class BulkRequest {
35 public enum OperationType {
41 private BulkOperation create;
42 private BulkOperation update;
43 private BulkOperation delete;
45 public BulkOperation getCreate() {
49 public void setCreate(BulkOperation create) {
53 public BulkOperation getUpdate() {
57 public void setUpdate(BulkOperation update) {
61 public BulkOperation getDelete() {
65 public void setDelete(BulkOperation delete) {
69 public OperationType getOperationType() {
72 return OperationType.CREATE;
73 } else if (update != null) {
74 return OperationType.UPDATE;
75 } else if (delete != null) {
76 return OperationType.DELETE;
82 public BulkOperation getOperation() {
85 } else if (update != null) {
87 } else if (delete != null) {
94 public String getIndex() {
95 return ApiUtils.extractIndexFromUri(getOperation().getMetaData().getUrl());
98 public String getId() {
99 return ApiUtils.extractIdFromUri(getOperation().getMetaData().getUrl());
103 public String toString() {
105 if (create != null) {
106 return "create: [" + create.toString() + "]\n";
107 } else if (update != null) {
108 return "update: [" + update.toString() + "]\n";
109 } else if (delete != null) {
110 return "delete: [" + delete.toString() + "]\n";