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\TaskLogBroker;
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\TaskLogCollection;
29use oat\taoTaskQueue\model\TaskLog\TaskLogCollectionInterface;
30use oat\taoTaskQueue\model\TaskLog\TaskLogFilter;
31use Zend\ServiceManager\ServiceLocatorAwareInterface;
32
33/**
34 * Interface TaskLogBrokerInterface
35 *
36 * @deprecated Use \oat\tao\model\taskQueue\TaskLog\Broker\TaskLogBrokerInterface
37 *
38 * @author Gyula Szucs <gyula@taotesting.com>
39 */
40interface TaskLogBrokerInterface extends ServiceLocatorAwareInterface
41{
42    public const DEFAULT_CONTAINER_NAME = 'task_log';
43
44    public const COLUMN_ID = 'id';
45    public const COLUMN_PARENT_ID = 'parent_id';
46    public const COLUMN_MASTER_STATUS = 'master_status';
47    public const COLUMN_TASK_NAME = 'task_name';
48    public const COLUMN_PARAMETERS = 'parameters';
49    public const COLUMN_LABEL = 'label';
50    public const COLUMN_STATUS = 'status';
51    public const COLUMN_OWNER = 'owner';
52    public const COLUMN_REPORT = 'report';
53    public const COLUMN_CREATED_AT = 'created_at';
54    public const COLUMN_UPDATED_AT = 'updated_at';
55
56    /**
57     * Creates the container where the task logs will be stored.
58     *
59     * @return void
60     */
61    public function createContainer();
62
63    /**
64     * RDS table name.
65     *
66     * @return string
67     */
68    public function getTableName();
69
70    /**
71     * Inserts a new task log with status for a task.
72     *
73     * @param TaskInterface $task
74     * @param string        $status
75     * @param null|string   $label
76     * @return void
77     */
78    public function add(TaskInterface $task, $status, $label = null);
79
80    /**
81     * Update the status of a task.
82     *
83     * The previous status can be used for querying the record.
84     *
85     * @param string      $taskId
86     * @param string      $newStatus
87     * @param string|null $prevStatus
88     * @return int count of touched records
89     */
90    public function updateStatus($taskId, $newStatus, $prevStatus = null);
91
92    /**
93     * Gets the status of a task.
94     *
95     * @param string $taskId
96     * @return string
97     */
98    public function getStatus($taskId);
99
100    /**
101     * Add a report for a task. New status can be supplied as well.
102     *
103     * @param string      $taskId
104     * @param Report      $report
105     * @param null|string $newStatus
106     * @return int
107     */
108    public function addReport($taskId, Report $report, $newStatus = null);
109
110    /**
111     * Gets a report for a task.
112     *
113     * @param string $taskId
114     * @return Report|null
115     */
116    public function getReport($taskId);
117
118    /**
119     * Search for task logs by defined filters.
120     *
121     * @param TaskLogFilter $filter
122     * @return TaskLogCollection|TaskLogEntity[]
123     */
124    public function search(TaskLogFilter $filter);
125
126    /**
127     * Counts task logs by defined filters.
128     *
129     * @param TaskLogFilter $filter
130     * @return int
131     */
132    public function count(TaskLogFilter $filter);
133
134    /**
135     * @param TaskLogFilter $filter
136     * @return TasksLogsStats
137     */
138    public function getStats(TaskLogFilter $filter);
139
140    /**
141     * Setting the status to archive, the record is kept. (Soft Delete)
142     *
143     * @param TaskLogEntity $entity
144     * @return bool
145     */
146    public function archive(TaskLogEntity $entity);
147
148    /**
149     * @param TaskLogCollectionInterface $collection
150     * @return int
151     */
152    public function archiveCollection(TaskLogCollectionInterface $collection);
153
154    /**
155     * Delete the task log by id. (Hard Delete)
156     *
157     * @param string $taskId
158     * @return bool
159     */
160    public function deleteById($taskId);
161}