Commit 8d8cc51e authored by Cyril Vazquez's avatar Cyril Vazquez
Browse files

Restitution batch processing

parent f1f5a86e
...@@ -322,6 +322,30 @@ class ArchiveRestitutionRequest extends abstractMessage ...@@ -322,6 +322,30 @@ class ArchiveRestitutionRequest extends abstractMessage
return $replyMessage; return $replyMessage;
} }
/**
* Process the messages
*
* @return medona/message $message
*/
public function processBatch()
{
$results = array();
$messages = $this->sdoFactory->find("medona/message", "status='accepted' AND type='ArchiveRestitutionRequest' AND active=true");
foreach ($messages as $message) {
$this->changeStatus($message->messageId, "processing");
$this->loadData($message);
try {
$results[(string) $message->messageId] = $this->process($message);
} catch (\Exception $e) {
$results[(string) $message->messageId] = $e;
}
}
return $results;
}
/** /**
* Validate message against schema and rules * Validate message against schema and rules
* @param medona/message $message * @param medona/message $message
......
...@@ -151,6 +151,14 @@ interface archiveRestitutionInterface extends messageInterface ...@@ -151,6 +151,14 @@ interface archiveRestitutionInterface extends messageInterface
*/ */
public function updateProcess_message_(); public function updateProcess_message_();
/**
* Processes messages
*
* @action medona/ArchiveRestitutionRequest/processBatch
*/
public function updateProcessBatch();
/** /**
* Flag archives for restitution * Flag archives for restitution
* @param array $archiveIds Array of archive identifier * @param array $archiveIds Array of archive identifier
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment