48f317d5d6b870da49c2bc2848d3026974b9fa85
[so.git] / bpmn / MSOCoreBPMN / src / main / java / org / openecomp / mso / bpmn / core / WorkflowException.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.openecomp.mso.bpmn.core;
22
23 import java.io.Serializable;
24
25 /**
26  * An object that represents a workflow exception.
27  */
28 public class WorkflowException implements Serializable {
29         private static final long serialVersionUID = 1L;
30
31         private final String processKey;
32         private final int errorCode;
33         private final String errorMessage;
34         
35         /**
36          * Constructor
37          * @param processKey the process key for the process that generated the exception
38          * @param errorCode the numeric error code (normally 1xxx or greater)
39          * @param errorMessage a short error message
40          */
41         public WorkflowException(String processKey, int errorCode,
42                         String errorMessage) {
43                 this.processKey = processKey;
44                 this.errorCode = errorCode;
45                 this.errorMessage = errorMessage;
46         }
47                         
48         /**
49          * Returns the process key.
50          */
51         public String getProcessKey() {
52                 return processKey;
53         }
54         
55         /**
56          * Returns the error code.
57          */
58         public int getErrorCode() {
59                 return errorCode;
60         }
61         
62         /**
63          * Returns the error message.
64          */
65         public String getErrorMessage() {
66                 return errorMessage;
67         }
68         
69         /**
70          * Returns a string representation of this object.
71          */
72         public String toString() {
73                 StringBuilder out = new StringBuilder();
74                 out.append(getClass().getSimpleName());
75                 out.append("[processKey=");
76                 out.append(getProcessKey());
77                 out.append(",errorCode=");
78                 out.append(getErrorCode());
79                 out.append(",errorMessage=");
80                 out.append(getErrorMessage());
81                 out.append("]");
82                 return out.toString();
83         }
84 }