public function edit(p\Workflow $wf = NULL, WorkflowDefinition $wd = NULL, $new_workflow_name = "", $comment = "") { $asset = new \stdClass(); if (isset($wd)) { $wf_config = new \stdClass(); $wf_config->workflowDefinitionId = $wd->getId(); $wf_config->workflowComments = $comment; if (isset($wf)) { $wf_config->workflowName = $wf->getName(); } else { if (trim($new_workflow_name) == "") { throw new e\EmptyValueException(c\M::EMPTY_WORKFLOW_NAME); } $wf_config->workflowName = $new_workflow_name; } $asset->workflowConfiguration = $wf_config; } $this->getProperty()->metadata = $this->getMetadata()->toStdClass(); $asset->{$p = $this->getPropertyName()} = $this->getProperty(); // edit asset $service = $this->getService(); $service->edit($asset); if (!$service->isSuccessful()) { throw new e\EditingFailureException(S_SPAN . c\M::EDIT_ASSET_FAILURE . E_SPAN . $service->getMessage()); } return $this->reloadProperty(); }
public function addWorkflow(WorkflowDefinition $wf) { $this->getWorkflowSettings()->addWorkflowDefinition($wf->getIdentifier()); return $this; }
public function edit(p\Workflow $wf = NULL, WorkflowDefinition $wd = NULL, $new_workflow_name = "", $comment = "", $exception = true) { $asset = new \stdClass(); $page = $this->getProperty(); if (self::DEBUG && self::DUMP) { u\DebugUtility::dump($page->pageConfigurations); } $page->metadata = $this->getMetadata()->toStdClass(); if (isset($this->structured_data)) { $page->structuredData = $this->structured_data->toStdClass(); $page->xhtml = NULL; } else { $page->structuredData = NULL; if (isset($this->xhtml)) { $page->xhtml = $this->xhtml; } } $page->pageConfigurations->pageConfiguration = array(); foreach ($this->page_configurations as $config) { $page->pageConfigurations->pageConfiguration[] = $config->toStdClass(); } if (self::DEBUG && self::DUMP) { u\DebugUtility::dump($page->pageConfigurations); } if (isset($wd)) { $wf_config = new \stdClass(); $wf_config->workflowDefinitionId = $wd->getId(); $wf_config->workflowComments = $comment; if (isset($wf)) { $wf_config->workflowName = $wf->getName(); } else { if (trim($new_workflow_name) == "") { throw new e\EmptyValueException(c\M::EMPTY_WORKFLOW_NAME); } $wf_config->workflowName = $new_workflow_name; } $asset->workflowConfiguration = $wf_config; } $asset->{$p = $this->getPropertyName()} = $page; if (self::DEBUG && self::DUMP) { u\DebugUtility::dump($page); } // edit asset $service = $this->getService(); $service->edit($asset); if (!$service->isSuccessful()) { throw new e\EditingFailureException(S_SPAN . c\M::EDIT_ASSET_FAILURE . E_SPAN . $service->getMessage()); } if ($exception) { $this->reloadProperty(); } if (isset($this->data_definition_id) && $exception) { $this->processStructuredData($this->data_definition_id); } return $this; }
public function setWorkflowMode($mode = c\T::NONE, WorkflowDefinition $wd = NULL) { if (!c\WorkflowModeValues::isWorkflowMode($mode)) { throw new e\UnacceptableWorkflowModeException(S_SPAN . "The workflow mode {$mode} is unacceptable." . E_SPAN); } if ($mode == self::WORKFLOW_MODE_FACTORY) { if ($wd == NULL) { throw new e\NullAssetException(S_SPAN . c\M::NULL_WORKFLOW_DEFINITION . E_SPAN); } else { $this->getProperty()->workflowDefinitionId = $wd->getId(); $this->getProperty()->workflowDefinitionPath = $wd->getPath(); } } else { $this->getProperty()->workflowDefinitionId = NULL; $this->getProperty()->workflowDefinitionPath = NULL; } $this->getProperty()->workflowMode = $mode; return $this; }