|
|
|
@ -110,11 +110,13 @@ class Archive |
|
|
|
* @param $archive_id |
|
|
|
* @return array[]|mixed[] |
|
|
|
*/ |
|
|
|
public function getMetadata ($archive_id) |
|
|
|
public function getMetadata ($archiveId, $originatorOwnerOrgRegNumber, $originatorOrgRegNumber) |
|
|
|
{ |
|
|
|
$ws_route = " get /recordsManagement/archive/Metadata/{archiveId}"; |
|
|
|
$ws_route = " get /digitalSafe/digitalSafe/{originatorOwnerOrgRegNumber}/{originatorOrgRegNumber}/{archiveId}/Metadata"; |
|
|
|
$url_params = [ |
|
|
|
"archiveId" => $archive_id, |
|
|
|
"originatorOwnerOrgRegNumber" => $originatorOwnerOrgRegNumber, |
|
|
|
"originatorOrgRegNumber" => $originatorOrgRegNumber, |
|
|
|
"archiveId" => $archiveId, |
|
|
|
]; |
|
|
|
$query_params = []; |
|
|
|
$body_params = []; |
|
|
|
@ -129,50 +131,16 @@ class Archive |
|
|
|
* @param $resource_id |
|
|
|
* @return array[]|mixed[] |
|
|
|
*/ |
|
|
|
public function getResourceContentBase64 ($archive_id, $resource_id) |
|
|
|
public function getResources ($archive_id, $originatorOwnerOrgRegNumber, $originatorOrgRegNumber) |
|
|
|
{ |
|
|
|
$ws_route = " get /recordsManagement/archive/Consultation/{archiveId}/Digitalresource/{resId}"; |
|
|
|
$ws_route = " get /digitalSafe/digitalSafe/{originatorOwnerOrgRegNumber}/{originatorOrgRegNumber}/{archiveId}"; |
|
|
|
$url_params = [ |
|
|
|
"archiveId" => $archive_id, |
|
|
|
"resId" => $resource_id, |
|
|
|
]; |
|
|
|
$query_params = [ |
|
|
|
"isCommunication" => "", |
|
|
|
"embedded" => "", |
|
|
|
"originatorOwnerOrgRegNumber" => $originatorOwnerOrgRegNumber, |
|
|
|
"originatorOrgRegNumber" => $originatorOrgRegNumber, |
|
|
|
]; |
|
|
|
$body_params = []; |
|
|
|
list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); |
|
|
|
return $body; // use ["attachment"]["data"] for direct access to base64 content
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* create an archive |
|
|
|
* @param $archive_name |
|
|
|
* @param $originatorOrgRegNumber |
|
|
|
* @param $file_plan_position |
|
|
|
* @return array[]|mixed[] |
|
|
|
*/ |
|
|
|
public function createArchive ($archive_name, $originatorOrgRegNumber, $file_plan_position) |
|
|
|
{ |
|
|
|
$ws_route = " post /recordsManagement/archive"; |
|
|
|
$url_params = []; |
|
|
|
$query_params = []; |
|
|
|
$body_params = [ |
|
|
|
"archive" => [ |
|
|
|
"archiveName" => $archive_name, |
|
|
|
"filePlanPosition" => $file_plan_position, |
|
|
|
], |
|
|
|
"zipContainer" => false, |
|
|
|
]; |
|
|
|
$body_params = [ |
|
|
|
"archive" => [ |
|
|
|
"archiveName" => $archive_name, |
|
|
|
"originatorOrgRegNumber" => $originatorOrgRegNumber,// organization registration number (registrationNumber)
|
|
|
|
"filePlanPosition" => $file_plan_position, // folder id (folderId), or null if root of an organization
|
|
|
|
], |
|
|
|
"zipContainer" => false, |
|
|
|
]; |
|
|
|
$body_params = []; |
|
|
|
list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); |
|
|
|
return $body; |
|
|
|
} |
|
|
|
@ -209,54 +177,18 @@ class Archive |
|
|
|
return $body; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* add resource content (base 64 encoded) to an archive |
|
|
|
* @param $archive_id |
|
|
|
* @param $content |
|
|
|
* @param $file_name |
|
|
|
* count all archives |
|
|
|
* @return array[]|mixed[] |
|
|
|
*/ |
|
|
|
public function addResourceBase64ToArchive ($archive_id, $content, $file_name) |
|
|
|
public function count ($originatorOwnerOrgRegNumber, $originatorOrgRegNumber) |
|
|
|
{ |
|
|
|
$ws_route = " post /recordsManagement/archive/{archiveId}/Digitalresource"; |
|
|
|
$ws_route = "get /digitalSafe/digitalSafe/{originatorOwnerOrgRegNumber}/{originatorOrgRegNumber}/Count"; |
|
|
|
$url_params = [ |
|
|
|
"archiveId" => $archive_id, |
|
|
|
"originatorOwnerOrgRegNumber" => $originatorOwnerOrgRegNumber, |
|
|
|
"originatorOrgRegNumber" => $originatorOrgRegNumber |
|
|
|
]; |
|
|
|
$query_params = []; |
|
|
|
$body_params = [ |
|
|
|
"contents" => $content, |
|
|
|
"filename" => $file_name, |
|
|
|
]; |
|
|
|
list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); |
|
|
|
return $body; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* add resource content (raw) to an archive |
|
|
|
* @param $archive_id |
|
|
|
* @param $content |
|
|
|
* @param $file_name |
|
|
|
* @return array|mixed[] |
|
|
|
*/ |
|
|
|
public function addResourceToArchive ($archive_id, $content, $file_name) |
|
|
|
{ |
|
|
|
return $this->addResourceBase64ToArchive($archive_id, base64_encode($content), $file_name); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* count all archives |
|
|
|
* @return array[]|mixed[] |
|
|
|
*/ |
|
|
|
public function count () |
|
|
|
{ |
|
|
|
$ws_route = "get /recordsManagement/archives/Count"; |
|
|
|
$url_params = []; |
|
|
|
$query_params = [ |
|
|
|
"originatorOrgRegNumber" => "", |
|
|
|
"filePlanPosition" => "", |
|
|
|
]; |
|
|
|
$body_params = []; |
|
|
|
list($headers, $body) = $this->sam_api->query($ws_route, $url_params, $query_params, $body_params); |
|
|
|
return $body; |
|
|
|
@ -290,13 +222,15 @@ class Archive |
|
|
|
* @param $archiveId |
|
|
|
* @return array[]|mixed[] |
|
|
|
*/ |
|
|
|
public function checkIntegrity ($archiveId) |
|
|
|
public function checkIntegrity ($originatorOwnerOrgRegNumber, $originatorOrgRegNumber, $archiveId) |
|
|
|
{ |
|
|
|
$ws_route = " get /recordsManagement/archives/Integritycheck"; |
|
|
|
$url_params = []; |
|
|
|
$query_params = [ |
|
|
|
"archiveIds" => [$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; |
|
|
|
|