mirror of
https://github.com/Karaka-Management/oms-Workflow.git
synced 2026-02-11 11:48:40 +00:00
Quick backup before crash
This commit is contained in:
parent
b14c20c165
commit
05dc7bfaeb
|
|
@ -95,6 +95,16 @@ final class Installer extends InstallerAbstract
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a workflow template
|
||||||
|
*
|
||||||
|
* @param ApplicationAbstract $app Application
|
||||||
|
* @param array $data Workflow schemas
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private static function createWorkflows(ApplicationAbstract $app, array $data) : void
|
private static function createWorkflows(ApplicationAbstract $app, array $data) : void
|
||||||
{
|
{
|
||||||
/** @var \Modules\Workflow\Controller\ApiController $module */
|
/** @var \Modules\Workflow\Controller\ApiController $module */
|
||||||
|
|
|
||||||
|
|
@ -399,8 +399,6 @@ final class ApiController extends Controller
|
||||||
$request->header->account
|
$request->header->account
|
||||||
);
|
);
|
||||||
|
|
||||||
var_dump($collection->id);
|
|
||||||
|
|
||||||
if ($collection->id === 0) {
|
if ($collection->id === 0) {
|
||||||
$response->header->status = RequestStatusCode::R_403;
|
$response->header->status = RequestStatusCode::R_403;
|
||||||
$this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Template', 'Couldn\'t create collection for template', null);
|
$this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Template', 'Couldn\'t create collection for template', null);
|
||||||
|
|
@ -440,9 +438,21 @@ final class ApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// perform other workflow installation actions
|
// perform other workflow installation actions
|
||||||
$actions = \json_decode(\file_get_contents(__DIR__ . '/../Definitions/actions.json'), true);
|
$actionContent = \file_get_contents(__DIR__ . '/../Definitions/actions.json');
|
||||||
$this->installWorkflowModel($template, $actions);
|
if ($actionContent === false) {
|
||||||
|
$this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Template', 'Template creation failed', $template);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$actions = \json_decode(\file_get_contents(__DIR__ . '/../Definitions/actions.json'), true);
|
||||||
|
if (!\is_array($actions)) {
|
||||||
|
$this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Template', 'Template creation failed', $template);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->installWorkflowModel($template, $actions);
|
||||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Template', 'Template successfully created', $template);
|
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Template', 'Template successfully created', $template);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -168,16 +168,27 @@ final class CliController extends Controller
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function startInstance(RequestAbstract $request, ResponseAbstract $response, WorkflowInstanceAbstract $instance)
|
/**
|
||||||
|
* Start a workflow instance
|
||||||
|
*
|
||||||
|
* @param RequestAbstract $request Request
|
||||||
|
* @param ResponseAbstract $response Response
|
||||||
|
* @param WorkflowInstanceAbstract $instance Workflow instance
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private function startInstance(RequestAbstract $request, ResponseAbstract $response, WorkflowInstanceAbstract $instance) : void
|
||||||
{
|
{
|
||||||
$actionString = \file_get_contents(__DIR__ . '/../Definitions/actions.json');
|
$actionString = \file_get_contents(__DIR__ . '/../Definitions/actions.json');
|
||||||
if ($actionString === false) {
|
if ($actionString === false) {
|
||||||
return $instance;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$actions = \json_decode($actionString, true);
|
$actions = \json_decode($actionString, true);
|
||||||
if (!\is_array($actions)) {
|
if (!\is_array($actions)) {
|
||||||
return $instance;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($instance->template->schema as $e) {
|
foreach ($instance->template->schema as $e) {
|
||||||
|
|
@ -189,6 +200,19 @@ final class CliController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run a workflow element
|
||||||
|
*
|
||||||
|
* @param RequestAbstract $request Request
|
||||||
|
* @param ResponseAbstract $response Response
|
||||||
|
* @param array $actions All available actions
|
||||||
|
* @param WorkflowInstanceAbstract $instance Current workflow instance
|
||||||
|
* @param array $element Workflow element to run
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function runWorkflowElement(
|
public function runWorkflowElement(
|
||||||
RequestAbstract $request, ResponseAbstract $response,
|
RequestAbstract $request, ResponseAbstract $response,
|
||||||
array $actions, WorkflowInstanceAbstract $instance, array $element
|
array $actions, WorkflowInstanceAbstract $instance, array $element
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user