DCAE-D be initial commit
[sdc/dcae-d/dt-be-main.git] / dcaedt_catalog / asdc / src / main / java / org / onap / sdc / dcae / errormng / RequestError.java
1 package org.onap.sdc.dcae.errormng;
2
3 import com.fasterxml.jackson.annotation.JsonInclude;
4
5 import java.util.List;
6
7 @JsonInclude(JsonInclude.Include.NON_NULL)
8 public class RequestError {
9         private PolicyException policyException;
10         private ServiceException serviceException;
11         private OkResponseInfo okResponseInfo;
12         private List<ServiceException> serviceExceptions;
13
14         public PolicyException getPolicyException() {
15                 return policyException;
16         }
17
18         public ServiceException getServiceException() {
19                 return serviceException;
20         }
21
22         public OkResponseInfo getOkResponseInfo() {
23                 return okResponseInfo;
24         }
25
26         public void setPolicyException(PolicyException policyException) {
27                 this.policyException = policyException;
28         }
29
30         void setServiceException(ServiceException serviceException) {
31                 this.serviceException = serviceException;
32         }
33
34         void setOkResponseInfo(OkResponseInfo okResponseInfo) {
35                 this.okResponseInfo = okResponseInfo;
36         }
37
38         public List<ServiceException> getServiceExceptions() {
39                 return serviceExceptions;
40         }
41
42         void setServiceExceptions(List<ServiceException> serviceExceptions) {
43                 this.serviceExceptions = serviceExceptions;
44         }
45         
46         String getFormattedMessage() {
47                 return getError().getFormattedErrorMessage();
48         }
49
50         String getMessageId() {
51                 return getError().getMessageId();
52         }
53
54         String[] getVariables() {
55                 return getError().getVariables();
56         }
57
58         String getText() {
59                 return getError().getText();
60         }
61
62         AbstractSdncException getError() {
63                 return null != serviceException ? serviceException : null != policyException ? policyException : okResponseInfo;
64         }
65 }