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
22namespace oat\taoTaskQueue\model;
23
24use common_report_Report as Report;
25use oat\taoTaskQueue\model\Entity\TaskLogEntity;
26use oat\taoTaskQueue\model\Entity\TasksLogsStats;
27use oat\taoTaskQueue\model\Task\TaskInterface;
28use oat\taoTaskQueue\model\TaskLog\DataTablePayload;
29use oat\taoTaskQueue\model\TaskLog\TaskLogCollectionInterface;
30use oat\taoTaskQueue\model\TaskLog\TaskLogFilter;
31use oat\taoTaskQueue\model\TaskLogBroker\TaskLogBrokerInterface;
32use oat\taoTaskQueue\model\TaskLog\TaskLogCollection;
33use Psr\Log\LoggerAwareInterface;
34
35/**
36 * Interface TaskLogInterface
37 *
38 * @deprecated Use \oat\tao\model\taskQueue\TaskLogInterface
39 *
40 * @author Gyula Szucs <gyula@taotesting.com>
41 */
42interface TaskLogInterface extends LoggerAwareInterface
43{
44    /** @deprecated  */
45    public const SERVICE_ID = 'taoTaskQueue/taskLog';
46
47    public const OPTION_TASK_LOG_BROKER = 'task_log_broker';
48
49    /**
50     * An array of tasks names with the specified category.
51     */
52    public const OPTION_TASK_TO_CATEGORY_ASSOCIATIONS = 'task_to_category_associations';
53
54    public const STATUS_ENQUEUED = 'enqueued';
55    public const STATUS_DEQUEUED = 'dequeued';
56    public const STATUS_RUNNING = 'running';
57    public const STATUS_CHILD_RUNNING = 'child_running';
58    public const STATUS_COMPLETED = 'completed';
59    public const STATUS_FAILED = 'failed';
60    public const STATUS_ARCHIVED = 'archived';
61    public const STATUS_UNKNOWN = 'unknown';
62
63    public const CATEGORY_UNKNOWN = 'unknown';
64    public const CATEGORY_IMPORT = 'import';
65    public const CATEGORY_EXPORT = 'export';
66    public const CATEGORY_DELIVERY_COMPILATION = 'delivery_comp';
67    public const CATEGORY_CREATE = 'create';
68    public const CATEGORY_UPDATE = 'update';
69    public const CATEGORY_DELETE = 'delete';
70
71    public const DEFAULT_LIMIT = 20;
72
73    public const SUPER_USER = 'SuperUser';
74
75    /**
76     * @return void
77     */
78    public function createContainer();
79
80    /**
81     * Insert a new task with status into the container.
82     *
83     * @param TaskInterface $task
84     * @param string        $status
85     * @param null|string   $label
86     * @return TaskLogInterface
87     */
88    public function add(TaskInterface $task, $status, $label = null);
89
90    /**
91     * Set a status for a task.
92     *
93     * @param string $taskId
94     * @param string $newStatus
95     * @param string|null $prevStatus
96     * @return int
97     */
98    public function setStatus($taskId, $newStatus, $prevStatus = null);
99
100    /**
101     * Gets the status of a task.
102     *
103     * @param string $taskId
104     * @return string
105     */
106    public function getStatus($taskId);
107
108    /**
109     * Saves the report and a status for a task.
110     *
111     * @param string $taskId
112     * @param Report $report
113     * @param string|null $newStatus
114     * @return TaskLogInterface
115     */
116    public function setReport($taskId, Report $report, $newStatus = null);
117
118    /**
119     * Gets the report for a task if that exists.
120     *
121     * @param string $taskId
122     * @return Report|null
123     */
124    public function getReport($taskId);
125
126    /**
127     * Updates the parent task.
128     *
129     * @param string $parentTaskId
130     * @return TaskLogInterface
131     */
132    public function updateParent($parentTaskId);
133
134    /**
135     * @param TaskLogFilter $filter
136     * @return TaskLogCollection|TaskLogEntity[]
137     */
138    public function search(TaskLogFilter $filter);
139
140    /**
141     * @param TaskLogFilter $filter
142     * @return DataTablePayload
143     */
144    public function getDataTablePayload(TaskLogFilter $filter);
145
146    /**
147     * @param string $userId
148     * @param null   $limit
149     * @param null   $offset
150     * @return TaskLogEntity[]|TaskLogCollection
151     */
152    public function findAvailableByUser($userId, $limit = null, $offset = null);
153
154    /**
155     * @param string $userId
156     * @return TasksLogsStats
157     */
158    public function getStats($userId);
159
160    /**
161     * @param string $taskId
162     * @return TaskLogEntity
163     *
164     * @throws \common_exception_NotFound
165     */
166    public function getById($taskId);
167
168    /**
169     * @param string $taskId
170     * @param string $userId
171     * @return TaskLogEntity
172     *
173     * @throws \common_exception_NotFound
174     */
175    public function getByIdAndUser($taskId, $userId);
176
177    /**
178     * @param TaskLogEntity $entity
179     * @param bool $forceArchive
180     * @return bool
181     *
182     * @throws \Exception
183     */
184    public function archive(TaskLogEntity $entity, $forceArchive = false);
185
186    /**
187     * @param TaskLogCollectionInterface $collection
188     * @param bool $forceArchive
189     * @return bool
190     */
191    public function archiveCollection(TaskLogCollectionInterface $collection, $forceArchive = false);
192
193    /**
194     * Gets the current broker instance.
195     *
196     * @return TaskLogBrokerInterface
197     */
198    public function getBroker();
199
200    /**
201     * Is the current broker RDS based?
202     *
203     * @return bool
204     */
205    public function isRds();
206
207    /**
208     * Link a task to a category.
209     *
210     * @param string|object $taskName
211     * @param string $category
212     * @return QueueDispatcherInterface
213     */
214    public function linkTaskToCategory($taskName, $category);
215
216    /**
217     * Returns the defined category for a task.
218     *
219     * @param string|object $taskName
220     * @return string
221     */
222    public function getCategoryForTask($taskName);
223
224    /**
225     * Returns the possible categories for a task.
226     *
227     * @return array
228     */
229    public function getTaskCategories();
230}