Removed MsoLogger class
[so.git] / mso-api-handlers / mso-api-handler-common / src / main / java / org / onap / so / apihandlerinfra / logging / ErrorLoggerInfo.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.apihandlerinfra.logging;
22
23 import java.io.Serializable;
24
25 import org.onap.so.logger.MessageEnum;
26 import org.onap.so.logger.ErrorCode;
27
28
29
30 public class ErrorLoggerInfo implements Serializable{
31     /**
32          * 
33          */
34         private static final long serialVersionUID = -2917784544098682110L;
35         private MessageEnum loggerMessageType;
36     private String errorSource;
37     private String targetEntity;
38     private String targetServiceName;
39     private ErrorCode errorCode;
40
41     private ErrorLoggerInfo(MessageEnum loggerMessageType, String errorSource, String targetEntity, String targetServiceName, ErrorCode errorCode){
42         this.loggerMessageType = loggerMessageType;
43         this.errorSource = errorSource;
44         this.targetEntity = targetEntity;
45         this.targetServiceName = targetServiceName;
46         this.errorCode = errorCode;
47     }
48
49     public MessageEnum getLoggerMessageType() {
50         return loggerMessageType;
51     }
52
53     public String getErrorSource() {
54         return errorSource;
55     }
56
57     public String getTargetEntity() {
58         return targetEntity;
59     }
60
61     public String getTargetServiceName() {
62         return targetServiceName;
63     }
64
65     public ErrorCode getErrorCode() {
66         return errorCode;
67     }
68
69     public static class Builder{
70         private MessageEnum loggerMessageType;
71         private String errorSource = "";
72         private String targetEntity = "";
73         private String targetServiceName = "";
74         private ErrorCode errorCode;
75
76         public Builder(MessageEnum loggerMessageType, ErrorCode errorCode){
77             this.loggerMessageType = loggerMessageType;
78             this.errorCode = errorCode;
79         }
80
81         public Builder loggerMessageType(MessageEnum loggerMessageType){
82             this.loggerMessageType = loggerMessageType;
83             return this;
84         }
85
86         public Builder errorSource(String errorSource){
87             this.errorSource = errorSource;
88             return this;
89         }
90
91         public Builder targetEntity(String targetEntity){
92             this.targetEntity = targetEntity;
93             return this;
94         }
95
96         public Builder targetServiceName(String targetServiceName){
97             this.targetServiceName = targetServiceName;
98             return this;
99         }
100
101         public Builder errorCode(ErrorCode errorCode){
102             this.errorCode = errorCode;
103             return this;
104         }
105
106         public ErrorLoggerInfo build(){
107             return new ErrorLoggerInfo(loggerMessageType, errorSource, targetEntity, targetServiceName, errorCode);
108         }
109
110     }
111 }