added svcapi ui and camunda code
[it/otf.git] / otf-camunda / src / main / java / org / oran / otf / camunda / exception / WorkflowException.java
diff --git a/otf-camunda/src/main/java/org/oran/otf/camunda/exception/WorkflowException.java b/otf-camunda/src/main/java/org/oran/otf/camunda/exception/WorkflowException.java
new file mode 100644 (file)
index 0000000..605c6b0
--- /dev/null
@@ -0,0 +1,95 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.oran.otf.camunda.exception;\r
+\r
+import java.io.Serializable;\r
+\r
+/**\r
+ * An object that represents a workflow exception.\r
+ */\r
+public class WorkflowException implements Serializable {\r
+\r
+  private static final long serialVersionUID = 1L;\r
+\r
+  private final String processKey;\r
+  private final int errorCode;\r
+  private final String errorMessage;\r
+  private final String workStep;\r
+\r
+  /**\r
+   * Constructor\r
+   *\r
+   * @param processKey the process key for the process that generated the exception\r
+   * @param errorCode the numeric error code (normally 1xxx or greater)\r
+   * @param errorMessage a short error message\r
+   */\r
+  public WorkflowException(String processKey, int errorCode, String errorMessage) {\r
+    this.processKey = processKey;\r
+    this.errorCode = errorCode;\r
+    this.errorMessage = errorMessage;\r
+    workStep = "*";\r
+  }\r
+\r
+  public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep) {\r
+    this.processKey = processKey;\r
+    this.errorCode = errorCode;\r
+    this.errorMessage = errorMessage;\r
+    this.workStep = workStep;\r
+  }\r
+\r
+  /**\r
+   * Returns the process key.\r
+   */\r
+  public String getProcessKey() {\r
+    return processKey;\r
+  }\r
+\r
+  /**\r
+   * Returns the error code.\r
+   */\r
+  public int getErrorCode() {\r
+    return errorCode;\r
+  }\r
+\r
+  /**\r
+   * Returns the error message.\r
+   */\r
+  public String getErrorMessage() {\r
+    return errorMessage;\r
+  }\r
+\r
+  /**\r
+   * Returns the error message.\r
+   */\r
+  public String getWorkStep() {\r
+    return workStep;\r
+  }\r
+\r
+  /**\r
+   * Returns a string representation of this object.\r
+   */\r
+  @Override\r
+  public String toString() {\r
+    return getClass().getSimpleName() + "[processKey=" + getProcessKey() + ",errorCode="\r
+        + getErrorCode()\r
+        + ",errorMessage=" + getErrorMessage() + ",workStep=" + getWorkStep() + "]";\r
+  }\r
+}\r