コード例 #1
0
 /**
  * Returns a list of checked out documents from the selected repository
  *
  * @param string $repositoryId
  * @param string $folderId The folder for which checked out docs are requested
  * @param string $filter
  * @param int $maxItems
  * @param int $skipCount
  * @return array $checkedout The collection of checked out documents
  */
 function getCheckedOutDocs($repositoryId, $folderId = null, $filter = '', $maxItems = 0, $skipCount = 0)
 {
     $result = parent::getCheckedOutDocs($repositoryId, $folderId, $filter, $maxItems, $skipCount);
     if ($result['status_code'] == 0) {
         return $result['results'];
     }
 }
コード例 #2
0
ファイル: testCmisApi.php プロジェクト: 5haman/knowledgetree
 function testVersioningService()
 {
     $VersioningService = new KTVersioningService($this->ktapi);
     $NavigationService = new KTNavigationService($this->ktapi);
     // set up the folder/doc tree structure with which we will be testing
     $this->createFolderDocStructure();
     $RepositoryService = new KTRepositoryService();
     $response = $RepositoryService->getRepositories();
     $this->assertEqual($response['status_code'], 0);
     $this->assertNotNull($response['results'][0]);
     //
     // we only expect one repository
     $repository = $response['results'][0];
     $repositoryId = $repository['repositoryId'];
     // test deletion of document via deleteAllVersions
     $versionSeriesId = 'D' . $this->docs[0]->get_documentid();
     $response = $VersioningService->deleteAllVersions($repositoryId, $versionSeriesId);
     $this->assertEqual($response['status_code'], 0);
     $this->assertNotNull($response['results']);
     // TODO test checkout of document
     $documentId = CMISUtil::encodeObjectId('Document', $this->docs[1]->get_documentid());
     $response = $VersioningService->checkOut($repositoryId, $documentId);
     $this->assertEqual($response['status_code'], 0);
     $this->assertNotNull($response['results']);
     ////        // use this id for cancel checkout and checkin, not the original document id
     ////        $pwcId = $response['results'];
     $pwcId = CMISUtil::encodeObjectId(DOCUMENT, $this->docs[1]->get_documentid());
     // try again, this time it should fail - not working at the moment as ktapi registers the same user for download
     // even if already checked out, so no error is generated unless a different user attempts to do a checkout
     /*
     $response = $VersioningService->checkOut($repositoryId, $documentId);
     $this->assertEqual($response['status_code'], 1);
     $this->assertNotNull($response['message']);
     */
     // test cancel checkout
     //        echo "WITH: $pwcId<BR>";
     $response = $VersioningService->cancelCheckOut($repositoryId, $pwcId);
     $this->assertEqual($response['status_code'], 0);
     $this->assertNotNull($response['results']);
     // test cancel checkout of document no longer checked out
     $response = $VersioningService->cancelCheckOut($repositoryId, $pwcId);
     $this->assertEqual($response['status_code'], 1);
     $this->assertNotNull($response['message']);
     // test listing of checked out documents
     // first check out the document again :)
     $response = $VersioningService->checkOut($repositoryId, $documentId);
     // now check that it appears in the listing
     $response = $NavigationService->getCheckedOutDocs($repositoryId, false, false);
     $this->assertEqual($response['status_code'], 0);
     $this->assertNotNull($response['results']);
     $this->assertTrue($this->findInPropertiesArray('ObjectId', $documentId, $response['results']));
     // now let's cancel the checkout so that we can delete later during cleanup :)
     $response = $VersioningService->cancelCheckOut($repositoryId, $pwcId);
     // TODO test checkin
     // TODO add testing of failure conditions - e.g. checked out/immutable document (for all appropriate functions)
     // tear down the folder/doc tree structure with which we were testing
     $this->cleanupFolderDocStructure();
 }