Skip to content

Commit a4f499a

Browse files
authored
Deprecated methods cleanup (#43)
fixes #39
1 parent fde2634 commit a4f499a

File tree

4 files changed

+26
-207
lines changed

4 files changed

+26
-207
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,8 @@
6262
- Tags are now added, therefore it can be replaced by ingest method.
6363
- overwriteExisting flag has been fixed and works as expected now!
6464
- Introduce `includeInternalPublication` in Events API `getAll`, `get` and `getPublications` methods [#37]
65+
- Deprecated methods cleanup! [#39]
66+
- `OcWorkflow->getStatistics()`
67+
- `OcWorkflow->getInstances()`
68+
- `OcSeries->getTitles()`
69+
- `OcSeries->getAll()`

src/OpencastApi/Rest/OcSeries.php

Lines changed: 9 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function getCount()
2525
/**
2626
* Returns the access control list for the series with the given identifier as JSON (Object) by default or XLM (text).
2727
*
28-
* @param string $seriesId The series identifier
28+
* @param string $seriesId The series identifier
2929
* @param string $format (optional) The output format (json or xml) of the response body. (Default value = 'json')
3030
*
3131
* @return array the response result ['code' => 200, 'body' => '{The access control list as JSON (Object) or XML (text)}']
@@ -40,17 +40,6 @@ public function getAcl($seriesId, $format = '')
4040
return $this->restClient->performGet($uri);
4141
}
4242

43-
/**
44-
* Returns a list of identifier and title of all series
45-
* @return array the response result ['code' => 200, 'body' => '{JSON (object) list of identifier and title of all series}']
46-
* @deprecated since version v1.3, removed from Opencast Version 12
47-
*/
48-
public function getTitles()
49-
{
50-
$uri = self::URI . "/allSeriesIdTitle.json";
51-
return $this->restClient->performGet($uri);
52-
}
53-
5443
/**
5544
* Returns the series with the given identifier as JSON (Object) by default or XLM (text).
5645
*
@@ -68,7 +57,7 @@ public function get($seriesId, $format = '')
6857

6958
return $this->restClient->performGet($uri);
7059
}
71-
60+
7261
/**
7362
* Returns the series element
7463
*
@@ -113,7 +102,7 @@ public function getProperties($seriesId)
113102
* Returns a series property value
114103
*
115104
* @param string $seriesId The series identifier
116-
* @param string $propertyName Name of series property
105+
* @param string $propertyName Name of series property
117106
*
118107
* @return array the response result ['code' => 200, 'body' => '{JSON (object) series property value}']
119108
*/
@@ -123,83 +112,6 @@ public function getProperty($seriesId, $propertyName)
123112
return $this->restClient->performGet($uri);
124113
}
125114

126-
/**
127-
* Returns the series matching the query parameters as JSON (array) by default or XLM (text).
128-
*
129-
* @param array $params (optional) The list of query params to pass which can contain the followings:
130-
* [
131-
* 'q' => '{Free text search}',
132-
* 'edit' => '(boolean){Whether this query should return only series that are editable}',
133-
* 'fuzzyMatch' => '(boolean){Whether the seriesId can be used for a partial match. The default is an exact match}',
134-
* 'seriesId' => '{The series identifier}',
135-
* 'seriesTitle' => '{The series title}',
136-
* 'creator' => '{The series creator}',
137-
* 'contributor' => '{The series contributor}',
138-
* 'publisher' => '{The series publisher}',
139-
* 'rightsholder' => '{The series rights holder}',
140-
* 'createdfrom' => '{Filter results by created from (yyyy-MM-dd'T'HH:mm:ss'Z') }',
141-
* 'createdto' => '{Filter results by created to (yyyy-MM-dd'T'HH:mm:ss'Z')) }',
142-
* 'language' => '{The series language}',
143-
* 'license' => '{The series license}',
144-
* 'subject' => '{The series subject}',
145-
* 'abstract' => '{The series abstract}',
146-
* 'description' => '{The series description}',
147-
* 'sort' => '{The sort order. May include any of the following: TITLE, SUBJECT, CREATOR, PUBLISHER, CONTRIBUTOR, ABSTRACT, DESCRIPTION, CREATED, AVAILABLE_FROM, AVAILABLE_TO, LANGUAGE, RIGHTS_HOLDER, SPATIAL, TEMPORAL, IS_PART_OF, REPLACES, TYPE, ACCESS, LICENCE. Add '_DESC' to reverse the sort order (e.g. TITLE_DESC)}',
148-
* 'startPage' => '{The page offset}',
149-
* 'count' => '{Results per page (max 100)}',
150-
* ]
151-
* @param string $format (optional) The output format (json or xml) of the response body. (Default value = 'json')
152-
*
153-
* @return array the response result ['code' => 200, 'body' => '{the series search results as JSON (array) or XML (text)}']
154-
* @deprecated Deprecated since version 1.3 - since it is removed from Opencast Verrsion 12.
155-
*/
156-
public function getAll($params = [], $format = '')
157-
{
158-
$uri = self::URI . "/series.json";
159-
if (!empty($format) && strtolower($format) == 'xml') {
160-
$uri = str_replace('.json', '.xml', $uri);
161-
}
162-
163-
$query = [];
164-
$acceptableParams = [
165-
'q', 'edit', 'fuzzyMatch', 'seriesId', 'seriesTitle',
166-
'creator', 'contributor', 'publisher', 'rightsholder', 'createdfrom',
167-
'createdto', 'language', 'license', 'subject', 'abstract',
168-
'description', 'startPage', 'count'
169-
];
170-
foreach ($params as $param_name => $param_value) {
171-
if (in_array($param_name, $acceptableParams)) {
172-
if ((($param_name == 'edit' || $param_name == 'fuzzyMatch') && is_bool($param_value)) || !empty($param_value)) {
173-
if ($param_name == 'count') {
174-
$param_value = intval($param_value);
175-
$param_value = ($param_value <= 100) ?: 100;
176-
}
177-
$query[$param_name] = $param_value;
178-
}
179-
}
180-
}
181-
$sortsASC = [
182-
'TITLE', 'SUBJECT', 'CREATOR', 'PUBLISHER',
183-
'CONTRIBUTOR', 'ABSTRACT', 'DESCRIPTION', 'CREATED',
184-
'AVAILABLE_FROM', 'AVAILABLE_TO','LANGUAGE', 'RIGHTS_HOLDER',
185-
'SPATIAL', 'TEMPORAL', 'IS_PART_OF', 'REPLACES', 'TYPE',
186-
'ACCESS', 'LICENCE'
187-
];
188-
$sortsDESC = array_map(function ($sort) {
189-
return "{$sort}_DESC";
190-
}, $sortsASC);
191-
192-
$sorts = array_merge($sortsASC, $sortsDESC);
193-
194-
if (array_key_exists('sort', $params) && !empty($params['sort']) &&
195-
in_array($params['sort'], $sorts)) {
196-
$query['sort'] = $params['sort'];
197-
}
198-
199-
$options = $this->restClient->getQueryParams($query);
200-
return $this->restClient->performGet($uri, $options);
201-
}
202-
203115
/**
204116
* Deletes a series
205117
*
@@ -215,9 +127,9 @@ public function delete($seriesId)
215127

216128
/**
217129
* Deletes a series element
218-
*
130+
*
219131
* @param string $seriesId The series identifier
220-
* @param string $elementType The element type
132+
* @param string $elementType The element type
221133
*
222134
* @return array the response result ['code' => 204, 'reason' => 'No Content'] (Series element deleted)
223135
*/
@@ -229,7 +141,7 @@ public function deleteElement($seriesId, $elementType)
229141

230142
/**
231143
* Deletes a series property
232-
*
144+
*
233145
* @param string $seriesId The series identifier
234146
* @param string $propertyName Name of series property
235147
*
@@ -307,8 +219,8 @@ public function updateAcl($seriesId, $acl, $override = false)
307219
*
308220
* @return array the response result:
309221
* ['code' => 201, 'reason' => 'Created'] (series created)
310-
* ['code' => 204, 'reason' => 'No Content'] (series updated)
311-
*
222+
* ['code' => 204, 'reason' => 'No Content'] (series updated)
223+
*
312224
*/
313225
public function update($params, $override = false)
314226
{
@@ -374,4 +286,4 @@ public function updateProperty($seriesId, $name, $value)
374286
return $this->restClient->performPost($uri, $options);
375287
}
376288
}
377-
?>
289+
?>

src/OpencastApi/Rest/OcWorkflow.php

Lines changed: 12 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function __construct($restClient)
1414
/**
1515
* Get the configuration panel for a specific workflow
1616
*
17-
* @param string $definitionId (optional) The workflow definition identifier
17+
* @param string $definitionId (optional) The workflow definition identifier
1818
*
1919
* @return array the response result ['code' => 200, 'body' => '{The HTML workflow configuration panel}']
2020
*/
@@ -26,15 +26,15 @@ public function getConfigurationPanel($definitionId = '')
2626
if (!empty($definitionId)) {
2727
$query['definitionId'] = $definitionId;
2828
}
29-
29+
3030
$options = $this->restClient->getQueryParams($query);
3131
return $this->restClient->performGet($uri, $options);
3232
}
3333

3434
/**
3535
* Returns the number of workflow instances in a specific state and operation
3636
*
37-
* @param string $state (optional) The workflow state
37+
* @param string $state (optional) The workflow state
3838
* @param string $operation (optional) The current operation
3939
*
4040
* @return array the response result ['code' => 200, 'body' => '{The number of workflow instances}']
@@ -50,7 +50,7 @@ public function getCount($state = '', $operation = '')
5050
if (!empty($operation)) {
5151
$query['operation'] = $operation;
5252
}
53-
53+
5454
$options = $this->restClient->getQueryParams($query);
5555
return $this->restClient->performGet($uri, $options);
5656
}
@@ -112,26 +112,9 @@ public function getStateMappings()
112112
return $this->restClient->performGet($uri);
113113
}
114114

115-
/**
116-
* Returns the workflow statistics as JSON (Object) by default or XLM (text)
117-
*
118-
* @param string $format (optional) The output format (json or xml) of the response body. (Default value = 'json')
119-
*
120-
* @return array the response result ['code' => 200, 'body' => '{A JSON (object) | XML (text) representation of the workflow statistics }']
121-
* @deprecated from version v1.3 and will be removed in v1.4
122-
*/
123-
public function getStatistics($format = '')
124-
{
125-
$uri = self::URI . "/statistics.json";
126-
if (!empty($format) && strtolower($format) == 'xml') {
127-
$uri = str_replace('.json', '.xml', $uri);
128-
}
129-
return $this->restClient->performGet($uri);
130-
}
131-
132115
/**
133116
* Get a specific workflow instance as JSON (Object) by default or XLM (text).
134-
*
117+
*
135118
* @param string $instanceId The workflow instance identifier
136119
* @param string $format (optional) The output format (json or xml) of the response body. (Default value = 'json')
137120
*
@@ -146,82 +129,11 @@ public function getInstance($instanceId, $format = '')
146129
return $this->restClient->performGet($uri);
147130
}
148131

149-
/**
150-
* List all workflow instances matching the query parameters as JSON (Object) by default or XLM (text).
151-
*
152-
* @param array $params (optional) The list of query params to pass which can contain the followings:
153-
* [
154-
* 'state' => '{Filter results by workflows' current state}',
155-
* 'q' => '{Filter results by free text query}',
156-
* 'seriesId' => '{ Filter results by series identifier }',
157-
* 'seriesTitle' => '{ Filter results by series title }',
158-
* 'creator' => '{ Filter results by the mediapackage's creator }',
159-
* 'contributor' => '{Filter results by the mediapackage's contributor}',
160-
* 'fromdate' => '{Filter results by workflow start date}',
161-
* 'todate' => '{Filter results by workflow start date}',
162-
* 'language' => '{Filter results by mediapackage's language.}',
163-
* 'license' => '{Filter results by mediapackage's license}',
164-
* 'title' => '{Filter results by mediapackage's title}',
165-
* 'subject' => '{Filter results by mediapackage's subject}',
166-
* 'workflowdefinition' => '{Filter results by workflow definition}',
167-
* 'mp' => '{Filter results by mediapackage identifier.}',
168-
* 'op' => '{ Filter results by workflows' current operation}',
169-
* 'sort' => '{The sort order. May include any of the following: DATE_CREATED, TITLE, SERIES_TITLE, SERIES_ID, MEDIA_PACKAGE_ID, WORKFLOW_DEFINITION_ID, CREATOR, CONTRIBUTOR, LANGUAGE, LICENSE, SUBJECT. Add '_DESC' to reverse the sort order (e.g. TITLE_DESC)}',
170-
* 'startPage' => '{(Default value=0): The paging offset }',
171-
* 'count' => '{(Default value=0): The number of results to return.}',
172-
* 'compact' => '{Whether to return a compact version of the workflow instance, with mediapackage elements, workflow and workflow operation configurations and non-current operations removed}',
173-
* ]
174-
* @param string $format (optional) The output format (json or xml) of the response body. (Default value = 'json')
175-
*
176-
* @return array the response result ['code' => 200, 'body' => '{A JSON (object) | XML (text) representation of the workflow set }']
177-
* @deprecated from version v1.3 and will be removed in v1.4
178-
*/
179-
public function getInstances($params = [], $format = '')
180-
{
181-
$uri = self::URI . "/instances.json";
182-
if (!empty($format) && strtolower($format) == 'xml') {
183-
$uri = str_replace('.json', '.xml', $uri);
184-
}
185-
186-
$query = [];
187-
188-
$sortsASC = [
189-
'DATE_CREATED', 'TITLE', 'SERIES_TITLE', 'SERIES_ID',
190-
'MEDIA_PACKAGE_ID', 'WORKFLOW_DEFINITION_ID', 'CREATOR', 'CONTRIBUTOR',
191-
'LANGUAGE', 'LICENSE','SUBJECT'
192-
];
193-
$sortsDESC = array_map(function ($sort) {
194-
return "{$sort}_DESC";
195-
}, $sortsASC);
196-
197-
$sorts = array_merge($sortsASC, $sortsDESC);
198-
199-
if (array_key_exists('sort', $params) && !empty($params['sort']) &&
200-
in_array($params['sort'], $sorts)) {
201-
$query['sort'] = $params['sort'];
202-
}
203-
204-
$acceptableParams = [
205-
'state', 'q', 'seriesId', 'seriesTitle', 'creator', 'contributor',
206-
'fromdate', 'todate', 'language', 'license', 'title', 'subject',
207-
'workflowdefinition', 'mp', 'op', 'startPage', 'count', 'compact'
208-
];
209-
210-
foreach ($params as $param_name => $param_value) {
211-
if (in_array($param_name, $acceptableParams) && !array_key_exists($param_name, $query)) {
212-
$query[$param_name] = $param_value;
213-
}
214-
}
215-
216-
$options = $this->restClient->getQueryParams($query);
217-
return $this->restClient->performGet($uri, $options);
218-
}
219-
220132
/**
221133
* (Danger!) Permenantly removes a workflow instance including all its child jobs.
222134
* In most circumstances, /stop is what you should use.
223135
*
224-
* @param string $instanceId The workflow instance identifier
136+
* @param string $instanceId The workflow instance identifier
225137
* @param boolean $force (optional) If the workflow status should be ignored and the workflow removed anyway (Default value=false)
226138
*
227139
* @return array the response result ['code' => 204, 'reason' => 'No Content'] (If workflow instance could be removed successfully, no content is returned)
@@ -246,7 +158,7 @@ public function removeInstance($instanceId, $force = false)
246158
* @param array|string $mediapackage (Optional) The new Mediapackage
247159
* @param array|string $properties (Optional) Properties
248160
*
249-
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the updated and resumed workflow instance}']
161+
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the updated and resumed workflow instance}']
250162
*/
251163
public function replaceAndresume($instanceId, $mediapackage = '', $properties = '')
252164
{
@@ -271,7 +183,7 @@ public function replaceAndresume($instanceId, $mediapackage = '', $properties =
271183
*
272184
* @param string $instanceId The workflow instance identifier
273185
*
274-
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the resumed workflow instance.}']
186+
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the resumed workflow instance.}']
275187
*/
276188
public function resume($instanceId)
277189
{
@@ -293,7 +205,7 @@ public function resume($instanceId)
293205
* @param string $parent (Optional) An optional parent workflow instance identifier
294206
* @param string|array $properties (Optional) An optional set of key=value properties
295207
*
296-
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the new workflow instance.}']
208+
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the new workflow instance.}']
297209
*/
298210
public function start($definition, $mediapackage, $parent = '', $properties = '')
299211
{
@@ -319,7 +231,7 @@ public function start($definition, $mediapackage, $parent = '', $properties = ''
319231
*
320232
* @param string $instanceId The workflow instance identifier
321233
*
322-
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the stopped workflow instance.}']
234+
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the stopped workflow instance.}']
323235
*/
324236
public function stop($instanceId)
325237
{
@@ -338,7 +250,7 @@ public function stop($instanceId)
338250
*
339251
* @param string $identifier The workflow instance identifier
340252
*
341-
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the suspended workflow instance.}']
253+
* @return array the response result ['code' => 200, 'body' => '{An XML (as text) representation of the suspended workflow instance.}']
342254
*/
343255
public function suspend($instanceId)
344256
{
@@ -371,4 +283,4 @@ public function update($workflow)
371283
return $this->restClient->performPost($uri, $options);
372284
}
373285
}
374-
?>
286+
?>

tests/Unit/OcWorkflowTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,6 @@ public function getters_test(): void
5050
$responseGetStateMappings = $this->ocWorkflow->getStateMappings();
5151
$this->assertSame(200, $responseGetStateMappings['code'], 'Failure to get State Mappings');
5252

53-
// Get statistics @depricated
54-
// $responseGetStatistics = $this->ocWorkflow->getStatistics();
55-
// $this->assertSame(200, $responseGetStatistics['code'], 'Failure to get statistics');
56-
57-
// Get All Instances @depricated
58-
// $responseGetInstances = $this->ocWorkflow->getInstances();
59-
// $this->assertSame(200, $responseGetInstances['code'], 'Failure to get workflow Instances');
60-
// $instances = $responseGetInstances['body']->workflows->workflow;
61-
// $this->assertNotEmpty($instances);
62-
6353
// Get Single Instance
6454
$dummyInstanceId = 1234567890;
6555
$responseGetInstance = $this->ocWorkflow->getInstance($dummyInstanceId);

0 commit comments

Comments
 (0)