Skip to content

Commit ea89735

Browse files
committed
updates for deleteDatastream and add remove content models
1 parent 8915a86 commit ea89735

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

includes/ObjectManagement.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,27 @@ function __destruct() {
99

1010
/**
1111
* Deletes the given datastream.
12+
*
1213
* @param string $pid
1314
* Fedora object PID
1415
* @param string $dsid
1516
* DSID of the datastream to be deleted
1617
* @param array $params
17-
* @return int|string
18+
* array with logMessage element for audit trail *
19+
*
20+
* @return int
21+
* returns an int which will get passed back to Taverna 0 = success
1822
*/
1923
function deleteDatastream($pid, $dsid, $params) {
20-
$object = $this->fedora_object;
21-
$datastream = $object[$dsid];
22-
24+
$return = MS_SUCCESS;
2325
try {
24-
$object->purgeDatastream($datastream->id);
25-
$return = MS_SUCCESS;
26+
$this->fedora_object->repository->api->m->purgeDatastream($this->fedora_object->id, $dsid, $params);
2627
$this->log->lwrite("Successfully deleted datastream.", 'DELETE_DATASTREAM', $pid, $dsid, 'SUCCESS');
27-
//$arr['logMessage'] = "$dsid datastream successfully deleted using ObjectManagement->deleteDatastream() || SUCCESS";
28-
//$this->fedora_object->repository->api->m->modifyDatastream($this->fedora_object->id, $dsid, $arr);
29-
} catch (Exception $e) {
28+
}
29+
catch (Exception $e) {
3030
$return = MS_FEDORA_EXCEPTION;
31-
$this->log->lwrite("Error deleting datastream.", 'DELETE_DATASTREAM', $pid, $dsid, 'ERROR');
32-
//$arr['logMessage'] = "$dsid datastream failed to delete using ObjectManagement->deleteDatastream() || ERROR";
33-
//$this->fedora_object->repository->api->m->modifyDatastream($this->fedora_object->id, $dsid, $arr);
31+
$this->log->lwrite("Error deleting datastream. " . $e->getMessage(), 'DELETE_DATASTREAM', $pid, $dsid, 'ERROR');
3432
}
35-
3633
return $return;
3734
}
3835
}

includes/Relationships.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ function addImageDimensionsToRels($dsid, $label = 'RELS-INT') {
9696
function addCModelToObject($outputdsid, $label = 'RELS-EXT', $params) {
9797
$item = $this->fedora_object;
9898
$cmodel = $params['cmodel'];
99-
99+
$return = MS_SUCCESS;
100100
try{
101101
$item->relationships->add('info:fedora/fedora-system:def/model#', 'hasModel', $cmodel);
102-
$return = MS_SUCCESS;
103102
$this->log->lwrite("$cmodel CModel relationship successfully added.", 'PROCESS_DATASTREAM', $this->pid, $this->incoming_dsid, 'SUCCESS');
104103
} catch (Exception $e){
105104
$return = MS_FEDORA_EXCEPTION;
@@ -120,10 +119,9 @@ function addCModelToObject($outputdsid, $label = 'RELS-EXT', $params) {
120119
function removeCModelFromObject($outputdsid, $label, $params) {
121120
$item = $this->fedora_object;
122121
$cmodel = $params['cmodel'];
123-
122+
$return = MS_SUCCESS;
124123
try {
125124
$item->relationships->remove('info:fedora/fedora-system:def/model#', 'hasModel', $cmodel);
126-
$return = MS_SUCCESS;
127125
$this->log->lwrite("$cmodel CModel relationship successfully removed.", 'PROCESS_DATASTREAM', $this->pid, $this->incoming_dsid, 'SUCCESS');
128126
} catch (Exception $e) {
129127
$return = MS_FEDORA_EXCEPTION;

soap_server/RoblibServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ function deleteDatastream($pid, $dsid) {
259259
$params = array(
260260
'class' => 'ObjectManagement',
261261
'function' => 'deleteDatastream',
262+
'logMessage' => "$dsid datastream successfully deleted using microservices funcion ObjectManagement->deleteDatastream() || SUCCESS",
262263
);
263-
264264
return $this->service($pid, $dsid, $dsid, $dsid, $params);
265265
}
266266

0 commit comments

Comments
 (0)