f3742220442b92941beb728f94d15240687a2140
[integration/csit.git] / plans / usecases / pnf-sw-upgrade / so / simulator / aai-simulator / src / main / java / org / onap / so / aaisimulator / utils / RequestErrorBuilder.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.aaisimulator.utils;
21
22 import java.util.Arrays;
23 import java.util.List;
24
25 /**
26  * @author waqas.ikram@ericsson.com
27  *
28  */
29 public class RequestErrorBuilder {
30
31     private final ServiceException serviceException = new ServiceException();
32
33     public RequestErrorBuilder messageId(final String messageId) {
34         this.serviceException.setMessageId(messageId);
35         return this;
36     }
37
38     public RequestErrorBuilder text(final String text) {
39         this.serviceException.setText(text);
40         return this;
41     }
42
43     public RequestErrorBuilder variables(final List<String> variables) {
44         this.serviceException.setVariables(variables);
45         return this;
46     }
47
48     public RequestErrorBuilder variables(final String... variables) {
49         this.serviceException.setVariables(Arrays.asList(variables));
50         return this;
51     }
52
53     public RequestError build() {
54         final RequestError requestError = new RequestError();
55         requestError.setServiceException(serviceException);
56         return requestError;
57     }
58
59 }