added svcapi ui and camunda code
[it/otf.git] / otf-camunda / src / main / java / org / oran / otf / camunda / exception / WorkflowException.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP - SO\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package org.oran.otf.camunda.exception;\r
22 \r
23 import java.io.Serializable;\r
24 \r
25 /**\r
26  * An object that represents a workflow exception.\r
27  */\r
28 public class WorkflowException implements Serializable {\r
29 \r
30   private static final long serialVersionUID = 1L;\r
31 \r
32   private final String processKey;\r
33   private final int errorCode;\r
34   private final String errorMessage;\r
35   private final String workStep;\r
36 \r
37   /**\r
38    * Constructor\r
39    *\r
40    * @param processKey the process key for the process that generated the exception\r
41    * @param errorCode the numeric error code (normally 1xxx or greater)\r
42    * @param errorMessage a short error message\r
43    */\r
44   public WorkflowException(String processKey, int errorCode, String errorMessage) {\r
45     this.processKey = processKey;\r
46     this.errorCode = errorCode;\r
47     this.errorMessage = errorMessage;\r
48     workStep = "*";\r
49   }\r
50 \r
51   public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep) {\r
52     this.processKey = processKey;\r
53     this.errorCode = errorCode;\r
54     this.errorMessage = errorMessage;\r
55     this.workStep = workStep;\r
56   }\r
57 \r
58   /**\r
59    * Returns the process key.\r
60    */\r
61   public String getProcessKey() {\r
62     return processKey;\r
63   }\r
64 \r
65   /**\r
66    * Returns the error code.\r
67    */\r
68   public int getErrorCode() {\r
69     return errorCode;\r
70   }\r
71 \r
72   /**\r
73    * Returns the error message.\r
74    */\r
75   public String getErrorMessage() {\r
76     return errorMessage;\r
77   }\r
78 \r
79   /**\r
80    * Returns the error message.\r
81    */\r
82   public String getWorkStep() {\r
83     return workStep;\r
84   }\r
85 \r
86   /**\r
87    * Returns a string representation of this object.\r
88    */\r
89   @Override\r
90   public String toString() {\r
91     return getClass().getSimpleName() + "[processKey=" + getProcessKey() + ",errorCode="\r
92         + getErrorCode()\r
93         + ",errorMessage=" + getErrorMessage() + ",workStep=" + getWorkStep() + "]";\r
94   }\r
95 }\r