Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2017 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\tao\model\taskQueue\Task; |
| 23 | |
| 24 | /** |
| 25 | * @author Gyula Szucs <gyula@taotesting.com> |
| 26 | */ |
| 27 | interface TaskInterface extends WorkerContextAwareInterface, ChildTaskAwareInterface, \JsonSerializable |
| 28 | { |
| 29 | // Fully Qualified Class Name |
| 30 | public const JSON_TASK_CLASS_NAME_KEY = 'taskFqcn'; |
| 31 | public const JSON_METADATA_KEY = 'metadata'; |
| 32 | public const JSON_METADATA_ID_KEY = '__id__'; |
| 33 | public const JSON_METADATA_PARENT_ID_KEY = '__parent_id__'; |
| 34 | public const JSON_METADATA_MASTER_STATUS_KEY = '__master_status__'; |
| 35 | public const JSON_METADATA_OWNER_KEY = '__owner__'; |
| 36 | public const JSON_METADATA_CREATED_AT_KEY = '__created_at__'; |
| 37 | public const JSON_METADATA_LABEL_KEY = '__label__'; |
| 38 | public const JSON_PARAMETERS_KEY = 'parameters'; |
| 39 | |
| 40 | /** |
| 41 | * @param string $id Should be a unique id. Use \common_Utils::getNewUri() to get one. |
| 42 | * @param string $owner |
| 43 | */ |
| 44 | public function __construct($id, $owner); |
| 45 | |
| 46 | /** |
| 47 | * @return \common_report_Report |
| 48 | */ |
| 49 | public function __invoke(); |
| 50 | |
| 51 | /** |
| 52 | * @return string |
| 53 | */ |
| 54 | public function __toString(); |
| 55 | |
| 56 | /** |
| 57 | * Gets the internally generated message id. |
| 58 | * |
| 59 | * @return string |
| 60 | */ |
| 61 | public function getId(); |
| 62 | |
| 63 | /** |
| 64 | * Sets the id of the parent task. |
| 65 | * |
| 66 | * @param string $taskId |
| 67 | * @return TaskInterface |
| 68 | */ |
| 69 | public function setParentId($taskId); |
| 70 | |
| 71 | /** |
| 72 | * Sets master status for non editable by child task |
| 73 | * @param boolean $masterStatus |
| 74 | * @return TaskInterface |
| 75 | */ |
| 76 | public function setMasterStatus($masterStatus); |
| 77 | |
| 78 | /** |
| 79 | * Is there a status has master privilege |
| 80 | * @return boolean |
| 81 | */ |
| 82 | public function isMasterStatus(); |
| 83 | |
| 84 | /** |
| 85 | * Is there a parent for the given task? |
| 86 | * |
| 87 | * @return bool |
| 88 | */ |
| 89 | public function hasParent(); |
| 90 | |
| 91 | /** |
| 92 | * Gets the id of the parent task. |
| 93 | * |
| 94 | * @return string |
| 95 | */ |
| 96 | public function getParentId(); |
| 97 | |
| 98 | /** |
| 99 | * Set message metadata |
| 100 | * |
| 101 | * @param string|array|\Traversable $spec |
| 102 | * @param mixed $value |
| 103 | */ |
| 104 | public function setMetadata($spec, $value = null); |
| 105 | |
| 106 | /** |
| 107 | * @param string $key |
| 108 | * @param mixed $default |
| 109 | * @return mixed |
| 110 | */ |
| 111 | public function getMetadata($key, $default = null); |
| 112 | |
| 113 | /** |
| 114 | * Set task parameter |
| 115 | * |
| 116 | * @param string|array|\Traversable $spec |
| 117 | * @param mixed $value |
| 118 | * @return TaskInterface |
| 119 | */ |
| 120 | public function setParameter($spec, $value = null); |
| 121 | |
| 122 | /** |
| 123 | * @param string $key |
| 124 | * @param mixed $default |
| 125 | * @return mixed |
| 126 | */ |
| 127 | public function getParameter($key, $default = null); |
| 128 | |
| 129 | /** |
| 130 | * Return all parameters |
| 131 | * |
| 132 | * @return array |
| 133 | */ |
| 134 | public function getParameters(); |
| 135 | |
| 136 | /** |
| 137 | * @param \DateTime $dateTime |
| 138 | * @return TaskInterface |
| 139 | */ |
| 140 | public function setCreatedAt(\DateTime $dateTime); |
| 141 | |
| 142 | /** |
| 143 | * @return \DateTime |
| 144 | */ |
| 145 | public function getCreatedAt(); |
| 146 | |
| 147 | /** |
| 148 | * @param string $owner |
| 149 | * @return TaskInterface |
| 150 | */ |
| 151 | public function setOwner($owner); |
| 152 | |
| 153 | /** |
| 154 | * @return string |
| 155 | */ |
| 156 | public function getOwner(); |
| 157 | |
| 158 | /** |
| 159 | * @param string $label |
| 160 | * @return TaskInterface |
| 161 | */ |
| 162 | public function setLabel($label); |
| 163 | |
| 164 | /** |
| 165 | * @return string |
| 166 | */ |
| 167 | public function getLabel(); |
| 168 | } |