aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/WorkflowException.java
blob: 559ec6df008c4e3135a0e4146c4e13587e72cdec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*-
 * ============LICENSE_START=======================================================
 * OPENECOMP - MSO
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.mso.bpmn.core;

import java.io.Serializable;

/**
 * An object that represents a workflow exception.
 */
public class WorkflowException implements Serializable {
	private static final long serialVersionUID = 1L;

	private final String processKey;
	private final int errorCode;
	private final String errorMessage;
	
	/**
	 * Constructor
	 * @param processKey the process key for the process that generated the exception
	 * @param errorCode the numeric error code (normally 1xxx or greater)
	 * @param errorMessage a short error message
	 */
	public WorkflowException(String processKey, int errorCode,
			String errorMessage) {
		this.processKey = processKey;
		this.errorCode = errorCode;
		this.errorMessage = errorMessage;
	}
			
	/**
	 * Returns the process key.
	 */
	public String getProcessKey() {
		return processKey;
	}
	
	/**
	 * Returns the error code.
	 */
	public int getErrorCode() {
		return errorCode;
	}
	
	/**
	 * Returns the error message.
	 */
	public String getErrorMessage() {
		return errorMessage;
	}
	
	/**
	 * Returns a string representation of this object.
	 */
	public String toString() {
		StringBuilder out = new StringBuilder();
		out.append(getClass().getSimpleName());
		out.append("[processKey=");
		out.append(getProcessKey());
		out.append(",errorCode=");
		out.append(getErrorCode());
		out.append(",errorMessage=");
		out.append(getErrorMessage());
		out.append("]");
		return out.toString();
	}
}