Commit d5a5058c authored by Alexandre Morin's avatar Alexandre Morin
Browse files

Revert "Merge branch 'feature/6024-AsyncDeposit' into 'develop'"

This reverts commit 1976ef11
parent 1976ef11
......@@ -27,7 +27,8 @@ namespace ext\thirdPartyArchiving\bundle\medona\Controller;
* @package Medona
* @author Alexis Ragot <alexis.ragot@maarch.org>
*/
class Acknowledgement extends abstractMessage implements AcknowledgementInterface
class Acknowledgement
extends abstractMessage
{
/**
......@@ -70,9 +71,34 @@ class Acknowledgement extends abstractMessage implements AcknowledgementInterfac
}
try {
$archiveTransferReplyController = \laabs::newController($message->schema.'/Acknowledgement');
$archiveTransferReplyController->send($message);
if ($message->schema != 'medona') {
$archiveTransferReplyController = \laabs::newController($message->schema.'/Acknowledgement');
$archiveTransferReplyController->send($message);
} else {
/*$archiveTransferReply = $this->sendMessage($message);
$message->object = $archiveTransferReply;
$archiveTransferReply->replyCode = $this->sendReplyCode($message->replyCode);
if (isset($message->requestReference)) {
$archiveTransferReply->messageRequestIdentifier = \laabs::newInstance('medona/Identifier', $message->requestReference);
}
if (isset($message->operationDate)) {
$archiveTransferReply->grantDate = (string) $message->operationDate;
}
$archiveTransferReply->archivalAgency = $this->sendOrganization($message->senderOrg);
$archiveTransferReply->transferringAgency = $this->sendOrganization($message->recipientOrg);
// Generate XML
$this->generate($message);
$this->save($message);*/
}
$operationResult = true;
} catch (\Exception $e) {
......
<?php
/*
* Copyright (C) 2018 Maarch
*
* This file is part of bundle medona.
*
* Bundle medona is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle medona is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bundle medona. If not, see <http://www.gnu.org/licenses/>.
*/
namespace ext\thirdPartyArchiving\bundle\medona\Controller;
/**
* Acknowledgement interface
*
* @package Medona
* @author Alexis Ragot <alexis.ragot@maarch.org>
*/
interface AcknowledgementInterface
{
/**
* Send an aknowledgement
* @param mixed $receivedMessage The received message or it's identifier
*
* @return object The acknowledgement
*/
public function send($receivedMessage);
}
......@@ -49,20 +49,22 @@ class ArchivalProfileModificationNotification extends ArchiveNotification
$messages = array();
$this->retentionRuleController = \laabs::newController('recordsManagement/retentionRule');
$retentionRule = $this->retentionRuleController->read($profile->retentionRuleCode);
$profile->retentionRuleDuration = $retentionRule->duration;
$profile->retentionRuleFinalDisposition = $retentionRule->finalDisposition;
$this->accessRuleController = \laabs::newController('recordsManagement/accessRule');
$accessRule = $this->accessRuleController->edit($profile->accessRuleCode);
$profile->accessRuleDuration = $accessRule->duration;
if (!\laabs::hasBundle("seda")) {
$this->retentionRuleController = \laabs::newController('recordsManagement/retentionRule');
$retentionRule = $this->retentionRuleController->read($profile->retentionRuleCode);
$profile->retentionRuleDuration = $retentionRule->duration;
$profile->retentionRuleFinalDisposition = $retentionRule->finalDisposition;
$this->accessRuleController = \laabs::newController('recordsManagement/accessRule');
$accessRule = $this->accessRuleController->edit($profile->accessRuleCode);
$profile->accessRuleDuration = $accessRule->duration;
}
foreach ($recipients as $recipient) {
$message = \laabs::newInstance('medona/message');
$message->messageId = \laabs::newId();
$message->type = "ArchivalProfileModificationNotification";
$message->schema = "recordsManagement";
$message->schema = "medona";
$message->status = "sent";
$message->date = \laabs::newDatetime(null, "UTC");
$message->receptionDate = $message->date;
......
......@@ -46,7 +46,7 @@ class ArchiveConversionRequest extends abstractMessage
$message = \laabs::newInstance('medona/message');
$message->messageId = \laabs::newId();
$message->schema = "recordsManagement";
$message->schema = "medona";
$message->type = "ArchiveConversionRequest";
$message->status = 'processWait';
$message->date = \laabs::newDatetime(null, "UTC");
......
......@@ -175,7 +175,7 @@ class ArchiveDeliveryRequest extends abstractMessage
$message = \laabs::newInstance('medona/message');
$message->messageId = \laabs::newId();
$schema = "recordsManagement";
$schema = "medona";
if (\laabs::hasBundle('seda') && $archives[0]->descriptionClass == 'archivesPubliques/content') {
$schema = "seda";
}
......@@ -212,10 +212,22 @@ class ArchiveDeliveryRequest extends abstractMessage
}
try {
$archiveDeliveryRequestController = \laabs::newController($message->schema.'/ArchiveDeliveryRequest');
$archiveDeliveryRequestController->send($message);
if ($message->schema != 'medona') {
$archiveDeliveryRequestController = \laabs::newController($message->schema.'/ArchiveDeliveryRequest');
$archiveDeliveryRequestController->send($message);
} else {
$archiveDeliveryRequest = $this->sendMessage($message);
$message->object = $archiveDeliveryRequest;
$archiveDeliveryRequest->requester = $this->sendOrganization($message->senderOrg);
if ($userName) {
$archiveDeliveryRequest->requester->userName = $userName;
}
$archiveDeliveryRequest->archivalAgency = $this->sendOrganization($message->recipientOrg);
$message->object->unitIdentifier = $message->unitIdentifier;
}
$operationResult = true;
$this->create($message);
......
<?php
/*
* Copyright (C) 2018 Maarch
*
* This file is part of bundle medona.
*
* Bundle medona is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle medona is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bundle medona. If not, see <http://www.gnu.org/licenses/>.
*/
namespace ext\thirdPartyArchiving\bundle\medona\Controller;
/**
* Archive delivery request interface
*
* @package Medona
* @author Alexis Ragot <alexis.ragot@maarch.org>
*/
interface ArchiveDeliveryRequestInterface
{
/**
* Send an archive delivery request
* @param Object $message The message
*/
public function send($message);
}
......@@ -127,9 +127,19 @@ class ArchiveDeliveryRequestReply extends abstractMessage
try {
mkdir($this->messageDirectory.DIRECTORY_SEPARATOR.(string) $message->messageId, 0777, true);
$archiveDeliveryRequestReplyController = \laabs::newController($message->schema.'/ArchiveDeliveryRequestReply');
$archiveDeliveryRequestReplyController->send($message);
if ($message->schema != 'medona') {
$archiveDeliveryRequestReplyController = \laabs::newController($message->schema.'/ArchiveDeliveryRequestReply');
$archiveDeliveryRequestReplyController->send($message);
} else {
$archiveDeliveryRequestReply = $this->sendMessage($message);
$message->object = $archiveDeliveryRequestReply;
$archiveDeliveryRequestReply->requester = $this->sendOrganization($message->senderOrg);
$archiveDeliveryRequestReply->archivalAgency = $this->sendOrganization($message->recipientOrg);
$this->generate($message);
$this->save($message);
}
$operationResult = true;
} catch (\Exception $e) {
$message->status = "invalid";
......
<?php
/*
* Copyright (C) 2018 Maarch
*
* This file is part of bundle medona.
*
* Bundle medona is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle medona is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bundle medona. If not, see <http://www.gnu.org/licenses/>.
*/
namespace ext\thirdPartyArchiving\bundle\medona\Controller;
/**
* Archive delivery request reply interface
*
* @package Medona
* @author Alexis Ragot <alexis.ragot@maarch.org>
*/
interface ArchiveDeliveryRequestReplyInterface
{
/**
* Send message with all contents embedded
* @param object $message The message
*/
public function send($message);
}
......@@ -41,7 +41,7 @@ class ArchiveDestructionNotification extends ArchiveNotification
$message->messageId = \laabs::newId();
$message->type = "ArchiveDestructionNotification";
$schema = "recordsManagement";
$schema = "medona";
if (\laabs::hasBundle('seda') && $archives[0]->descriptionClass == 'archivesPubliques/content') {
$schema = "seda";
}
......@@ -62,9 +62,16 @@ class ArchiveDestructionNotification extends ArchiveNotification
$message->dataObjectCount = count($message->archive);
try {
$archiveModificationNotificationController = \laabs::newController($message->schema.'/ArchiveModificationNotification');
$archiveModificationNotificationController->send($message);
if ($message->schema != 'medona') {
$archiveModificationNotificationController = \laabs::newController($message->schema.'/ArchiveModificationNotification');
$archiveModificationNotificationController->send($message);
} else {
$this->generate($message);
$this->save($message);
}
$operationResult = true;
} catch (\Exception $e) {
......
......@@ -105,7 +105,7 @@ class ArchiveDestructionRequest extends abstractMessage
$message = \laabs::newInstance('medona/message');
$message->messageId = \laabs::newId();
$schema = "recordsManagement";
$schema = "medona";
if (\laabs::hasBundle('seda') && $archives[0]->descriptionClass == 'archivesPubliques/content') {
$schema = "seda";
}
......@@ -133,8 +133,21 @@ class ArchiveDestructionRequest extends abstractMessage
$message->unitIdentifier[] = $unitIdentifier;
}
$archiveDestructionRequestController = \laabs::newController($message->schema.'/ArchiveDestructionRequest');
$archiveDestructionRequestController->send($message);
if ($message->schema != 'medona') {
$archiveDestructionRequestController = \laabs::newController($message->schema.'/ArchiveDestructionRequest');
$archiveDestructionRequestController->send($message);
} else {
$archiveDestructionRequest = $this->sendMessage($message);
$message->object = $archiveDestructionRequest;
$archiveDestructionRequest->originatingAgency = $this->sendOrganization($message->senderOrg);
$archiveDestructionRequest->archivalAgency = $this->sendOrganization($message->recipientOrg);
$message->object->unitIdentifier = $message->unitIdentifier;
$this->generate($message);
$this->save($message);
}
$this->create($message);
} catch (\Exception $e) {
......
......@@ -45,7 +45,7 @@ class ArchiveModificationNotification extends ArchiveNotification
$message->messageId = \laabs::newId();
$message->type = "ArchiveModificationNotification";
$schema = "recordsManagement";
$schema = "medona";
if (\laabs::hasBundle('seda') && $archives[0]->descriptionClass == 'archivesPubliques/content') {
$schema = "seda";
}
......@@ -77,9 +77,23 @@ class ArchiveModificationNotification extends ArchiveNotification
$message->dataObjectCount = count($message->archive);
try {
$archiveModificationNotificationController = \laabs::newController($message->schema.'/ArchiveModificationNotification');
$archiveModificationNotificationController->send($message);
if ($message->schema != 'medona') {
$archiveModificationNotificationController = \laabs::newController($message->schema.'/ArchiveModificationNotification');
$archiveModificationNotificationController->send($message);
} else {
$archiveModificationNotification = $this->sendMessage($message);
$message->object = $archiveModificationNotification;
$archiveModificationNotification->originatingAgency = $this->sendOrganization($message->senderOrg);
$archiveModificationNotification->archivalAgency = $this->sendOrganization($message->recipientOrg);
$message->object->unitIdentifier = $message->unitIdentifier;
$this->generate($message);
$this->save($message);
}
$operationResult = true;
} catch (\Exception $e) {
......
......@@ -177,9 +177,19 @@ class ArchiveRestitution extends abstractMessage
try {
mkdir($this->messageDirectory.DIRECTORY_SEPARATOR.(string) $message->messageId, 0777, true);
$archiveRestitutionController = \laabs::newController($message->schema.'/ArchiveRestitution');
$archiveRestitutionController->send($message);
if ($message->schema != 'medona') {
$archiveRestitutionController = \laabs::newController($message->schema.'/ArchiveRestitution');
$archiveRestitutionController->send($message);
} else {
$archiveRestitution = $this->sendMessage($message);
$message->object = $archiveRestitution;
$archiveRestitution->requester = $this->sendOrganization($message->senderOrg);
$archiveRestitution->archivalAgency = $this->sendOrganization($message->recipientOrg);
$this->generate($message);
$this->save($message);
}
$operationResult = true;
} catch (\Exception $e) {
......
......@@ -129,7 +129,7 @@ class ArchiveRestitutionRequest extends abstractMessage
$message = \laabs::newInstance('medona/message');
$message->messageId = \laabs::newId();
$message->schema = "recordsManagement";
$message->schema = "medona";
if (\laabs::hasBundle('seda') && $archives[0]->descriptionClass == 'archivesPubliques/content') {
$message->schema = "seda";
}
......@@ -157,8 +157,23 @@ class ArchiveRestitutionRequest extends abstractMessage
$message->unitIdentifier[] = $unitIdentifier;
}
$archiveRestitutionRequestController = \laabs::newController($message->schema.'/ArchiveRestitutionRequest');
$archiveRestitutionRequestController->send($message);
if ($message->schema != 'medona') {
$archiveRestitutionRequestController = \laabs::newController($message->schema.'/ArchiveRestitutionRequest');
$archiveRestitutionRequestController->send($message);
} else {
$archiveRestitutionRequest = $this->sendMessage($message);
$message->object = $archiveRestitutionRequest;
$archiveRestitutionRequest->requester = $this->sendOrganization($message->senderOrg);
if ($userName) {
$archiveRestitutionRequest->requester->userName = $userName;
}
$archiveRestitutionRequest->archivalAgency = $this->sendOrganization($message->recipientOrg);
$this->generate($message);
$this->save($message);
}
$operationResult = true;
......@@ -209,8 +224,19 @@ class ArchiveRestitutionRequest extends abstractMessage
$this->readOrgs($message); // read org names, addresses, communications, contacts
try {
$archiveRestitutionRequestController = \laabs::newController($message->schema.'/ArchiveRestitutionRequest');
$archiveRestitutionRequestController->send($message);
if ($message->schema != 'medona') {
$archiveRestitutionRequestController = \laabs::newController($message->schema.'/ArchiveRestitutionRequest');
$archiveRestitutionRequestController->send($message);
} else {
$archiveRestitutionRequest = $this->sendMessage($message);
$message->object = $archiveRestitutionRequest;
$archiveRestitutionRequest->requester = $this->sendOrganization($message->senderOrg);
$archiveRestitutionRequest->archivalAgency = $this->sendOrganization($message->recipientOrg);
$this->generate($message);
$this->save($message);
}
$message->unitIdentifier = $this->sdoFactory->readChildren('medona/unitIdentifier', $requestMessage);
foreach ($message->unitIdentifier as $unitIdentifier) {
......
......@@ -74,9 +74,19 @@ class ArchiveRestitutionRequestReply extends abstractMessage
try {
mkdir($this->messageDirectory.DIRECTORY_SEPARATOR.(string) $message->messageId, 0777, true);
$archiveRestitutionRequestReplyController = \laabs::newController($message->schema.'/ArchiveRestitutionRequestReply');
$archiveRestitutionRequestReplyController->send($message);
if ($message->schema != 'medona') {
$archiveRestitutionRequestReplyController = \laabs::newController($message->schema.'/ArchiveRestitutionRequestReply');
$archiveRestitutionRequestReplyController->send($message);
} else {
$archiveRestitutionRequestReply = $this->sendMessage($message);
$message->object = $archiveRestitutionRequestReply;
$archiveRestitutionRequestReply->requester = $this->sendOrganization($message->senderOrg);
$archiveRestitutionRequestReply->archivalAgency = $this->sendOrganization($message->recipientOrg);
$this->generate($message);
$this->save($message);
}
$operationResult = true;
} catch (\Exception $e) {
......
<?php
/*
* Copyright (C) 2018 Maarch
*
* This file is part of bundle medona.
*
* Bundle medona is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle medona is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bundle medona. If not, see <http://www.gnu.org/licenses/>.
*/
namespace ext\thirdPartyArchiving\bundle\medona\Controller;
/**
* Archive transfer interface
*
* @package Medona
* @author Alexis Ragot <alexis.ragot@maarch.org>
*/
interface ArchiveTransferInterface
{
/**
* Receive message with all contents embedded
* @param string $messageFile The message binary contents OR a filename
* @param array $attachments An array of attachment binary data
* @param string $schema The transfer schema
*
* @return medona/message The acknowledgement
*/
public function receive($messageFile, $attachments = array(), $schema = null);
/**
* Validate message against schema and rules
* @param string $messageId The message identifier
* @param object $archivalAgreement The archival agreement
*
* @return boolean The validation result
*/
public function validate($messageId, $archivalAgreement = null);
/**
* Process the archive transfer
* @param mixed $messageId The message object or the message identifier
*
* @return string The reply message identifier
*/
public function process($messageId);
}
......@@ -27,7 +27,7 @@ namespace ext\thirdPartyArchiving\bundle\medona\Controller;
* @package Medona
* @author Alexis Ragot <alexis.ragot@maarch.org>
*/
class ArchiveTransferReply extends abstractMessage implements ArchiveTransferReplyInterface
class ArchiveTransferReply extends abstractMessage
{
/**
......@@ -82,10 +82,57 @@ class ArchiveTransferReply extends abstractMessage implements ArchiveTransferRep
$message->senderOrg = $recipientOrg;
}
/*if ($archives) {
foreach ($archives as $archive) {
$unitIdentifier = \laabs::newInstance("medona/unitIdentifier");
$unitIdentifier->messageId = $message->messageId;
$unitIdentifier->objectId = (string) $archive->archiveId;
$unitIdentifier->objectClass = "recordsManagement/archive";
$message->unitIdentifier[] = $unitIdentifier;
}
}
$message->archive = $archives;*/
/*$message->lifeCycleEventId = \laabs::newTokenList();
foreach ($archives as $archive) {
foreach ($archives as $archive) {
if ($archive->lifeCycleEvent) {
foreach ($archive->lifeCycleEvent as $event) {
$message->lifeCycleEventId[] = (string) $event->eventId;
}
}
}
}*/
try {
$archiveTransferReplyController = \laabs::newController($message->schema.'/ArchiveTransferReply');
$archiveTransferReplyController->send($message);
if ($message->schema != 'medona') {
$archiveTransferReplyController = \laabs::newController($message->schema.'/ArchiveTransferReply');
$archiveTransferReplyController->send($message);
} else {
$archiveTransferReply = $this->sendMessage($message);
$message->object = $archiveTransferReply;
$archiveTransferReply->replyCode = $this->sendReplyCode($message->replyCode);
if (isset($message->requestReference)) {
$archiveTransferReply->messageRequestIdentifier = \laabs::newInstance('medona/Identifier', $message->requestReference);
}
if (isset($message->operationDate)) {
$archiveTransferReply->grantDate = (string) $message->operationDate;
}
$archiveTransferReply->archivalAgency = $this->sendOrganization($message->senderOrg);
$archiveTransferReply->transferringAgency = $this->sendOrganization($message->recipientOrg);
// Generate XML
$this->generate($message);
$this->save($message);
}
$operationResult = true;
} catch (\Exception $e) {
$message->status = "error";
...