sam_api = $sam_api; } /** * list all archives * http://sam2_dev.localhost/openapi.html#operation/recordsManagement/archives/read * @return array[]|mixed[] */ public function read () { $ws_route = "get /recordsManagement/archives"; $url_params = []; $query_params = [ "archiveId" => "", "profileReference" => "", "status" => "", "archiveName" => "", "agreementReference" => "", "archiveExpired" => "", "finalDisposition" => "", "originatorOrgRegNumber" => "", "originatorOwnerOrgId" => "", "originatorArchiveId" => "", "originatingDate" => "", "filePlanPosition" => "", "hasParent" => "", "description" => "", "partialRetentionRule" => "", "retentionRuleCode" => "", "depositStartDate" => "", "depositEndDate" => "", "originatingStartDate" => "", "originatingEndDate" => "", "archiverArchiveId" => "", "maxResults" => "", ]; $body_params = []; list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); if(!empty($body)) return $body; else null; } /** * list archives only inside an organization / folder * @param string $registrationNumber * @param string $folderId * @return array[]|mixed[] */ public function readList ($registrationNumber = "", $folderId = "") { $ws_route = "get /recordsManagement/archives/List"; $url_params = []; $query_params = [ "originatorOrgRegNumber" => $registrationNumber, // registrationNumber : m183129110301321 "filePlanPosition" => $folderId, // folderId : SAM_rak426-6xon-f8ywrz "archiveUnit" => "" ]; $body_params = []; list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); if(!empty($body)) return $body; else null; } /** * get a particular archive * @param $id * @return array[]|mixed[] */ public function getArchiveById ($id) { $ws_route = " get /recordsManagement/archiveDescription/{archiveId}"; $url_params = [ "archiveId" => $id, ]; $query_params = [ "isCommunication" => "", ]; $body_params = []; list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); if(!empty($body)) return $body; else null; } /** * get archive metadata * @param $archive_id * @return array[]|mixed[] */ public function getMetadata ($archiveId, $originatorOwnerOrgRegNumber, $originatorOrgRegNumber) { $ws_route = " get /digitalSafe/digitalSafe/{originatorOwnerOrgRegNumber}/{originatorOrgRegNumber}/{archiveId}/Metadata"; $url_params = [ "originatorOwnerOrgRegNumber" => $originatorOwnerOrgRegNumber, "originatorOrgRegNumber" => $originatorOrgRegNumber, "archiveId" => $archiveId, ]; $query_params = []; $body_params = []; list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); return $body; } /** * get a resoure's content base 64 encoded * @param $archive_id * @param $resource_id * @return array[]|mixed[] */ public function getResources ($archive_id, $originatorOwnerOrgRegNumber, $originatorOrgRegNumber) { $ws_route = " get /digitalSafe/digitalSafe/{originatorOwnerOrgRegNumber}/{originatorOrgRegNumber}/{archiveId}"; $url_params = [ "archiveId" => $archive_id, "originatorOwnerOrgRegNumber" => $originatorOwnerOrgRegNumber, "originatorOrgRegNumber" => $originatorOrgRegNumber, ]; $query_params = []; $body_params = []; list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); return $body; } /** * create an archive * @param $archive_name * @param $originatorOrgRegNumber * @param $file_plan_position * @return array[]|mixed[] */ public function createArchiveWithResources ($archiveId, $originatorOwnerOrgRegNumber, $originatorOrgRegNumber, $contents, $file_names, $hashs, $hashAlgorithms) { $ws_route = " post /digitalSafe/digitalSafe/{originatorOwnerOrgRegNumber}/{originatorOrgRegNumber}"; $url_params = [ "originatorOwnerOrgRegNumber" => $originatorOwnerOrgRegNumber, "originatorOrgRegNumber" => $originatorOrgRegNumber ]; $query_params = []; $digitalResources = []; foreach ($contents as $key => $content) { $digitalResources[] = [ "handler" => base64_encode($content), "fileName" => $file_names[$key], "hash" => $hashs[$key], "hashAlgorithm" => $hashAlgorithms[$key] ]; } $body_params = [ "originatorArchiveId" => $archiveId, "digitalResources" => $digitalResources ]; list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); return $body; } /** * count all archives * @return array[]|mixed[] */ public function count ($originatorOwnerOrgRegNumber, $originatorOrgRegNumber) { $ws_route = "get /digitalSafe/digitalSafe/{originatorOwnerOrgRegNumber}/{originatorOrgRegNumber}/Count"; $url_params = [ "originatorOwnerOrgRegNumber" => $originatorOwnerOrgRegNumber, "originatorOrgRegNumber" => $originatorOrgRegNumber ]; $query_params = []; $body_params = []; list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); return $body; } /** * ask for an archive destruction * @param $originatorOwnerOrgRegNumber * @param $originatorOrgRegNumber * @param $archiveId * @return array[]|mixed[] */ public function destruct ($originatorOwnerOrgRegNumber, $originatorOrgRegNumber, $archiveId) { $ws_route = " delete /digitalSafe/digitalSafe/{originatorOwnerOrgRegNumber}/{originatorOrgRegNumber}/{archiveId}"; $url_params = [ "originatorOwnerOrgRegNumber" => $originatorOwnerOrgRegNumber, "originatorOrgRegNumber" => $originatorOrgRegNumber, "archiveId" => $archiveId, ]; $query_params = []; $body_params = []; list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); return $body; } /** * ask for an archive integrity check * @param $archiveId * @return array[]|mixed[] */ public function checkIntegrity ($originatorOwnerOrgRegNumber, $originatorOrgRegNumber, $archiveId) { $ws_route = " get /digitalSafe/digitalSafe/{originatorOwnerOrgRegNumber}/{originatorOrgRegNumber}/{archiveId}/Integritycheck"; $url_params = [ "originatorOwnerOrgRegNumber" => $originatorOwnerOrgRegNumber, "originatorOrgRegNumber" => $originatorOrgRegNumber, "archiveId" => $archiveId, ]; $query_params = []; $body_params = []; list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); return $body; } }