Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / MSOCoreBPMN / src / main / java / org / onap / so / 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.onap.so.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     private final String workStep;
35
36     /**
37      * Constructor
38      * 
39      * @param processKey the process key for the process that generated the exception
40      * @param errorCode the numeric error code (normally 1xxx or greater)
41      * @param errorMessage a short error message
42      */
43     public WorkflowException(String processKey, int errorCode, String errorMessage) {
44         this.processKey = processKey;
45         this.errorCode = errorCode;
46         this.errorMessage = errorMessage;
47         workStep = "*";
48     }
49
50     public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep) {
51         this.processKey = processKey;
52         this.errorCode = errorCode;
53         this.errorMessage = errorMessage;
54         this.workStep = workStep;
55     }
56
57     /**
58      * Returns the process key.
59      */
60     public String getProcessKey() {
61         return processKey;
62     }
63
64     /**
65      * Returns the error code.
66      */
67     public int getErrorCode() {
68         return errorCode;
69     }
70
71     /**
72      * Returns the error message.
73      */
74     public String getErrorMessage() {
75         return errorMessage;
76     }
77
78     /**
79      * Returns the error message.
80      */
81     public String getWorkStep() {
82         return workStep;
83     }
84
85     /**
86      * Returns a string representation of this object.
87      */
88     @Override
89     public String toString() {
90         return getClass().getSimpleName() + "[processKey=" + getProcessKey() + ",errorCode=" + getErrorCode()
91                 + ",errorMessage=" + getErrorMessage() + ",workStep=" + getWorkStep() + "]";
92     }
93 }