Initial source code
[oam/tr069-adapter.git] / common / src / main / java / org / commscope / tr069adapter / common / scheduler / SchedulerError.java
diff --git a/common/src/main/java/org/commscope/tr069adapter/common/scheduler/SchedulerError.java b/common/src/main/java/org/commscope/tr069adapter/common/scheduler/SchedulerError.java
new file mode 100644 (file)
index 0000000..7dd7a85
--- /dev/null
@@ -0,0 +1,79 @@
+/*\r
+ * ============LICENSE_START========================================================================\r
+ * ONAP : tr-069-adapter\r
+ * =================================================================================================\r
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
+ * =================================================================================================\r
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
+ * may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
+ * either express or implied. See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ===============LICENSE_END=======================================================================\r
+ */\r
+\r
+package org.commscope.tr069adapter.common.scheduler;\r
+\r
+public enum SchedulerError {\r
+\r
+  INVALID_STARTDATE("QRTZ_01", "Given date is past date",\r
+      "Please provide a future date"), INVALID_TIME_INTERVAL("QRTZ_02",\r
+          "Invalid provided is zero or negative",\r
+          "Provide positive interval"), INVALID_ENDDATE("QRTZ_03", "Given date is past date",\r
+              "Please provide a future date"), UNKNOWN_ERROR("QRTZ_04", "Unexpected Exception",\r
+                  "Please see the system logs for more details."), INVALID_CRON_EXPRESSION(\r
+                      "QRTZ_05", "Not a valid cron expression",\r
+                      "Please provide valid cron expression for schedule"), SCHEDULE_DOES_NOT_EXIST(\r
+                          "QRTZ_06", "Schedule name provided does not exist",\r
+                          "Please provide a valid schedule name"), SCHEDULE_EXIST_ALREADY("QRTZ_07",\r
+                              "Schedule name provided is already exist in the system",\r
+                              "Please modify the existing or add new job with different name."), JOB_EXECUTION_ERROR(\r
+                                  "QRTZ_08", "Unexepcted exeception while executing the job",\r
+                                  "Please look in to system logs for more information"), DATABASE_ERROR(\r
+                                      "QRTZ_09", "There database problem with Sheduling",\r
+                                      "please see the logs for more information"), INVALID_CONFIG(\r
+                                          "QRTZ_10",\r
+                                          "There is some problem with Quartz scheduler configuration.",\r
+                                          "Please look in to system logs for more information "), INTERRUPT_ERROR(\r
+                                              "QRTZ_11", "Not able to interrupt the running job",\r
+                                              "Please look in  to system logs for more information");\r
+\r
+\r
+  private String errorCode;\r
+  private String errorDescription;\r
+  private String resolution;\r
+\r
+  SchedulerError(String errorCode, String errorDescription, String resolution) {\r
+    this.errorCode = errorCode;\r
+    this.errorDescription = errorDescription;\r
+    this.resolution = resolution;\r
+  }\r
+\r
+  public String getErrorCode() {\r
+    return errorCode;\r
+  }\r
+\r
+  public String getErrorMessage() {\r
+    return errorDescription;\r
+  }\r
+\r
+  public String getResolution() {\r
+    return resolution;\r
+  }\r
+\r
+  @Override\r
+  public String toString() {\r
+    StringBuilder str =\r
+        new StringBuilder("**********************************************************\n");\r
+    str.append("* Error Code : " + errorCode + " *\n");\r
+    str.append("* Error : " + errorDescription + " *\n");\r
+    str.append("* Resolution : " + resolution + " *\n");\r
+    str.append("**********************************************************");\r
+    return str.toString();\r
+  }\r
+\r
+}\r