diff --git a/workflow/engine/classes/class.api.php b/workflow/engine/classes/class.api.php index 2129ffb15..88ec29fdf 100644 --- a/workflow/engine/classes/class.api.php +++ b/workflow/engine/classes/class.api.php @@ -6,7 +6,8 @@ class Api private static $workspace; private static $userId; - const SYSTEM_EXCEPTION_STATUS = 500; + const STAT_CREATED = 201; + const STAT_APP_EXCEPTION = 400; public function __costruct() { diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Application.php b/workflow/engine/src/Services/Api/ProcessMaker/Application.php deleted file mode 100644 index 3baf8f02a..000000000 --- a/workflow/engine/src/Services/Api/ProcessMaker/Application.php +++ /dev/null @@ -1,32 +0,0 @@ - $this->getUserId(), - "APP_UID" => $id, - "PRO_UID" => "13885168416038181883131343548151", - "DUMMY" => "sample data", - "WS" => $this->getWorkspace() - ); - - return $data; - } - - public function post($requestData = null) - { - $requestData['processed'] = true; - - return $requestData; - } -} \ No newline at end of file diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Process.php b/workflow/engine/src/Services/Api/ProcessMaker/Process.php index e2aa373b4..26ee2c3e1 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Process.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Process.php @@ -4,7 +4,10 @@ namespace Services\Api\ProcessMaker; use \ProcessMaker\Api; use \Luracast\Restler\RestException; +//TODO we need Refactor this class + /** + * * Process Api Controller * * @protected @@ -36,7 +39,7 @@ class Process extends Api return $response; } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -54,7 +57,7 @@ class Process extends Api $response["message"] = "Process load successfully"; $response["data"] = $data; } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } return $response; @@ -71,7 +74,7 @@ class Process extends Api return $process->createProcess($userUid, $request_data); } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -90,7 +93,7 @@ class Process extends Api $response["message"] = "Process updated successfully"; $response["data"] = $data; } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } return $response; @@ -109,7 +112,7 @@ class Process extends Api $response["success"] = true; $response["message"] = "Process was deleted successfully"; } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } return $response; diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity.php index 7579fc1c8..6bad72a1a 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity.php @@ -38,7 +38,7 @@ class Activity extends Api return $response; } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -53,7 +53,7 @@ class Activity extends Api $task = new \BusinessModel\Task(); $properties = $task->updateProperties($activityUid, $projectUid, $request_data); } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -68,7 +68,7 @@ class Activity extends Api $task = new \BusinessModel\Task(); $task->deleteTask($activityUid); } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } } diff --git a/workflow/engine/src/Services/Api/ProcessMaker/ProjectActivity.php b/workflow/engine/src/Services/Api/ProcessMaker/ProjectActivity.php deleted file mode 100644 index cfe049005..000000000 --- a/workflow/engine/src/Services/Api/ProcessMaker/ProjectActivity.php +++ /dev/null @@ -1,75 +0,0 @@ -getProperties($activityUid, true, false); - } - - $response = array( - 'definition' => $definition, - 'properties' => $properties - ); - - return $response; - } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); - } - } - - - - /** - * @url PUT /:projectUid/activity/:activityUid - */ - public function doPutProjectActivity($projectUid, $activityUid, $request_data = array()) - { - try { - $task = new \BusinessModel\Task(); - $properties = $task->updateProperties($activityUid, $projectUid, $request_data); - } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); - } - } - - - - /** - * @url DELETE /:projectUid/activity/:activityUid - */ - public function doDeleteProjectActivity($projectUid, $activityUid) - { - try { - $task = new \BusinessModel\Task(); - $task->deleteTask($activityUid); - } catch (\Exception $e) { - throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage()); - } - } -} -