Commit 13cfde16bca1ad1935de5c0c7d7508339ee579b9
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
10 changed files
with
112 additions
and
508 deletions
lib/api/ktcmis/services/CMISVersioningService.inc.php
| ... | ... | @@ -201,8 +201,9 @@ class CMISVersioningService { |
| 201 | 201 | public function checkIn($repositoryId, $objectId, $major = true, $properties = array(), $contentStream = null, |
| 202 | 202 | $checkinComment = '', $policies = array(), $addACEs = array(), $removeACEs = array()) |
| 203 | 203 | { |
| 204 | + | |
| 204 | 205 | $objectId = CMISUtil::decodeObjectId($objectId, $typeId); |
| 205 | - | |
| 206 | + | |
| 206 | 207 | // throw updateConflictException if the operation is attempting to update an object that is no longer current (as determined by the repository). |
| 207 | 208 | try { |
| 208 | 209 | $pwc = new CMISDocumentObject($objectId, $this->ktapi); |
| ... | ... | @@ -210,7 +211,7 @@ class CMISVersioningService { |
| 210 | 211 | catch (exception $e) { |
| 211 | 212 | throw new UpdateConflictException($e->getMessage()); |
| 212 | 213 | } |
| 213 | - | |
| 214 | + | |
| 214 | 215 | // throw exception if the object is not versionable |
| 215 | 216 | if (!$pwc->getAttribute('versionable')) { |
| 216 | 217 | throw new ConstraintViolationException('This document is not versionable and may not be checked in'); |
| ... | ... | @@ -224,7 +225,7 @@ class CMISVersioningService { |
| 224 | 225 | // if we can't get the type definition, then we can't store the content |
| 225 | 226 | throw new StorageException($e->getMessage()); |
| 226 | 227 | } |
| 227 | - | |
| 228 | + | |
| 228 | 229 | // if content stream is required (capabilityPWCUpdatability == false) and no content stream is supplied, |
| 229 | 230 | // throw a ConstraintViolationException |
| 230 | 231 | if (($typeDefinition['attributes']['contentStreamAllowed'] == 'required') && is_null($contentStream)) { |
| ... | ... | @@ -244,7 +245,7 @@ class CMISVersioningService { |
| 244 | 245 | $tempfilename = CMISUtil::createTemporaryFile($contentStream); |
| 245 | 246 | $reason = 'CMIS object checkin'; |
| 246 | 247 | $response = $this->ktapi->checkin_document($objectId, $pwc->getProperty('contentStreamFilename'), $reason, $tempfilename, $major, |
| 247 | - $sig_username, $sig_password); | |
| 248 | + $sig_username, $sig_password); | |
| 248 | 249 | |
| 249 | 250 | // if there was any error checking in |
| 250 | 251 | if ($response['status_code'] == 1) { | ... | ... |
webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php
| ... | ... | @@ -31,15 +31,12 @@ When POSTing an Atom Document, the atom fields take precedence over the CMIS pro |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | 33 | // load all available CMIS services |
| 34 | -include_once CMIS_ATOM_LIB_FOLDER . 'RepositoryService.inc.php'; | |
| 35 | -include_once CMIS_ATOM_LIB_FOLDER . 'NavigationService.inc.php'; | |
| 36 | -include_once CMIS_ATOM_LIB_FOLDER . 'ObjectService.inc.php'; | |
| 34 | +include_once CMIS_API . '/ktRepositoryService.inc.php'; | |
| 35 | +include_once CMIS_API . '/ktNavigationService.inc.php'; | |
| 36 | +include_once CMIS_API . '/ktObjectService.inc.php'; | |
| 37 | 37 | include_once CMIS_API . '/ktVersioningService.inc.php'; |
| 38 | 38 | include_once 'KT_cmis_atom_service_helper.inc.php'; |
| 39 | 39 | |
| 40 | -// TODO consider changing all responses from the webservice layer to return PEAR errors or success results instead of the half/half we have at the moment. | |
| 41 | -// the half/half occurred because on initial services PEAR Error seemed unnecessary, but it has proven useful for some of the newer functions | |
| 42 | - | |
| 43 | 40 | // TODO proper first/last links |
| 44 | 41 | // FIXME any incorrect or missing links |
| 45 | 42 | // FIXME ContentStreamAllowed tag is empty (at least sometimes) |
| ... | ... | @@ -75,14 +72,17 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 75 | 72 | else if (($this->params[1] == 'children') || ($this->params[1] == 'descendants')) |
| 76 | 73 | { |
| 77 | 74 | $folderId = $this->params[0]; |
| 78 | - $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 75 | + $ObjectService = new KTObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 79 | 76 | $response = $ObjectService->getProperties($repositoryId, $folderId, false, false); |
| 80 | 77 | |
| 81 | - if (PEAR::isError($response)) { | |
| 82 | - $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); | |
| 78 | + if ($response['status_code'] == 1) { | |
| 79 | + $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response['message']); | |
| 83 | 80 | $this->responseFeed = $feed; |
| 84 | 81 | return null; |
| 85 | 82 | } |
| 83 | + else { | |
| 84 | + $response = $response['results']; | |
| 85 | + } | |
| 86 | 86 | |
| 87 | 87 | $folderName = $response['properties']['Name']['value']; |
| 88 | 88 | } |
| ... | ... | @@ -94,14 +94,17 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 94 | 94 | // abstract this to be used also by the document service (and the PWC service?) ??? |
| 95 | 95 | // alternatively use getFolderParent here makes sense and use getObjectParents when document service? |
| 96 | 96 | $folderId = $this->params[0]; |
| 97 | - $NavigationService = new NavigationService(KT_cmis_atom_service_helper::getKt()); | |
| 97 | + $NavigationService = new KTNavigationService(KT_cmis_atom_service_helper::getKt()); | |
| 98 | 98 | $response = $NavigationService->getFolderParent($repositoryId, $folderId, false, false, false); |
| 99 | 99 | |
| 100 | - if (PEAR::isError($response)) { | |
| 101 | - $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); | |
| 100 | + if ($response['status_code'] == 1) { | |
| 101 | + $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response['message']); | |
| 102 | 102 | $this->responseFeed = $feed; |
| 103 | 103 | return null; |
| 104 | 104 | } |
| 105 | + else { | |
| 106 | + $response = $response['results']; | |
| 107 | + } | |
| 105 | 108 | |
| 106 | 109 | // we know that a folder will only have one parent, so we can assume element 0 |
| 107 | 110 | $folderId = $response[0]['properties']['objectId']['value']; |
| ... | ... | @@ -113,12 +116,12 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 113 | 116 | |
| 114 | 117 | if (!empty($this->params[1]) && (($this->params[1] == 'children') || ($this->params[1] == 'descendants'))) |
| 115 | 118 | { |
| 116 | - $NavigationService = new NavigationService(KT_cmis_atom_service_helper::getKt()); | |
| 119 | + $NavigationService = new KTNavigationService(KT_cmis_atom_service_helper::getKt()); | |
| 117 | 120 | $feed = $this->getFolderChildrenFeed($NavigationService, $repositoryId, $folderId, $folderName, $this->params[1]); |
| 118 | 121 | } |
| 119 | 122 | else |
| 120 | 123 | { |
| 121 | - $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 124 | + $ObjectService = new KTObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 122 | 125 | $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $folderId); |
| 123 | 126 | } |
| 124 | 127 | |
| ... | ... | @@ -175,7 +178,7 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 175 | 178 | |
| 176 | 179 | // determine type if object is being moved |
| 177 | 180 | if (!is_null($objectId)) { |
| 178 | - CMISUtil::decodeObjectId($objectId, $cmisObjectProperties['cmis:objectTypeId']); | |
| 181 | + CMISUtil::decodeObjectId($objectId, $typeId); | |
| 179 | 182 | } |
| 180 | 183 | |
| 181 | 184 | // check for content stream |
| ... | ... | @@ -187,22 +190,26 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 187 | 190 | ? $content['cmisra:text'] |
| 188 | 191 | : null)); |
| 189 | 192 | |
| 190 | - $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 193 | + $ObjectService = new KTObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 191 | 194 | |
| 192 | 195 | $success = false; |
| 193 | 196 | $error = null; |
| 194 | 197 | if ($action == 'create') |
| 195 | 198 | { |
| 196 | 199 | // TODO detection and passing of optional parameters (policies, ACEs, etc...) as well as support for other object-types |
| 197 | - if ($cmisObjectProperties['cmis:objectTypeId'] == 'folder') | |
| 198 | - $newObjectId = $ObjectService->createFolder($repositoryId, ucwords($cmisObjectProperties['cmis:objectTypeId']), $properties, $folderId); | |
| 199 | - else | |
| 200 | + if ($cmisObjectProperties['cmis:objectTypeId'] == 'folder') { | |
| 201 | + $newObjectId = $ObjectService->createFolder($repositoryId, ucwords($cmisObjectProperties['cmis:objectTypeId']), | |
| 202 | + $properties, $folderId); | |
| 203 | + } | |
| 204 | + else { | |
| 200 | 205 | // NOTE for the moment only creation in minor versioning state |
| 201 | 206 | $newObjectId = $ObjectService->createDocument($repositoryId, $properties, $folderId, $cmisContent, 'minor'); |
| 207 | + } | |
| 202 | 208 | |
| 203 | - if (!PEAR::isError($newObjectId)) { | |
| 209 | + if ($newObjectId['status_code'] == 0) { | |
| 210 | + $newObjectId = $newObjectId['results']; | |
| 204 | 211 | // check if returned Object Id is a valid CMIS Object Id |
| 205 | - CMISUtil::decodeObjectId($newObjectId, $cmisObjectProperties['cmis:objectTypeId']); | |
| 212 | + CMISUtil::decodeObjectId($newObjectId, $typeId); | |
| 206 | 213 | if ($typeId != 'Unknown') { |
| 207 | 214 | $success = true; |
| 208 | 215 | } |
| ... | ... | @@ -211,18 +218,18 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 211 | 218 | } |
| 212 | 219 | } |
| 213 | 220 | else { |
| 214 | - $error = $newObjectId->getMessage(); | |
| 221 | + $error = $newObjectId['message']; | |
| 215 | 222 | } |
| 216 | 223 | } |
| 217 | 224 | else if ($action == 'move') |
| 218 | 225 | { |
| 219 | 226 | $response = $ObjectService->moveObject($repositoryId, $objectId, '', $folderId); |
| 220 | 227 | |
| 221 | - if (!PEAR::isError($response)) { | |
| 228 | + if ($response['status_code'] == 0) { | |
| 222 | 229 | $success = true; |
| 223 | 230 | } |
| 224 | 231 | else { |
| 225 | - $error = $response->getMessage(); | |
| 232 | + $error = $response['message']; | |
| 226 | 233 | } |
| 227 | 234 | |
| 228 | 235 | // same object as before |
| ... | ... | @@ -258,19 +265,21 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 258 | 265 | |
| 259 | 266 | $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); |
| 260 | 267 | |
| 261 | - $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 268 | + $ObjectService = new KTObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 262 | 269 | |
| 263 | 270 | // attempt delete |
| 264 | 271 | $response = $ObjectService->deleteTree($repositoryId, $this->params[0]); |
| 265 | 272 | |
| 266 | 273 | // error? |
| 267 | - if (PEAR::isError($response)) | |
| 268 | - { | |
| 269 | - $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $response->getMessage()); | |
| 274 | + if ($response['status_code'] == 1) { | |
| 275 | + $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $response['message']); | |
| 270 | 276 | // Expose the responseFeed |
| 271 | 277 | $this->responseFeed = $feed; |
| 272 | 278 | return null; |
| 273 | 279 | } |
| 280 | + else { | |
| 281 | + $response = $response['results']; | |
| 282 | + } | |
| 274 | 283 | |
| 275 | 284 | // list of failed objects? |
| 276 | 285 | if (is_array($response)) |
| ... | ... | @@ -322,6 +331,9 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 322 | 331 | else { |
| 323 | 332 | // error, we shouldn't be here, if we are then the wrong service/function was called |
| 324 | 333 | } |
| 334 | + | |
| 335 | + // hack, for removing one level of access | |
| 336 | + $entries = $entries['results']; | |
| 325 | 337 | |
| 326 | 338 | // $baseURI=NULL,$title=NULL,$link=NULL,$updated=NULL,$author=NULL,$id=NULL |
| 327 | 339 | $feed = new KT_cmis_atom_responseFeed_GET(CMIS_APP_BASE_URI); |
| ... | ... | @@ -350,12 +362,8 @@ class KT_cmis_atom_service_folder extends KT_cmis_atom_service { |
| 350 | 362 | $link->appendChild($feed->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/folder/' . $folderId)); |
| 351 | 363 | $feed->appendChild($link); |
| 352 | 364 | |
| 353 | - foreach($entries as $cmisEntry) | |
| 354 | - { | |
| 365 | + foreach($entries as $cmisEntry) { | |
| 355 | 366 | KT_cmis_atom_service_helper::createObjectEntry($feed, $cmisEntry, $folderName); |
| 356 | - | |
| 357 | - // after each entry, add app:edited tag | |
| 358 | - $feed->newField('app:edited', KT_cmis_atom_service_helper::formatDatestamp(), $feed); | |
| 359 | 367 | } |
| 360 | 368 | |
| 361 | 369 | $feed->newField('cmis:hasMoreItems', 'false', $feed); |
| ... | ... | @@ -379,7 +387,7 @@ class KT_cmis_atom_service_document extends KT_cmis_atom_service { |
| 379 | 387 | { |
| 380 | 388 | $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); |
| 381 | 389 | |
| 382 | - $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 390 | + $ObjectService = new KTObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 383 | 391 | |
| 384 | 392 | $objectId = $this->params[0]; |
| 385 | 393 | |
| ... | ... | @@ -392,11 +400,14 @@ class KT_cmis_atom_service_document extends KT_cmis_atom_service { |
| 392 | 400 | $NavigationService = new NavigationService(KT_cmis_atom_service_helper::getKt()); |
| 393 | 401 | $response = $NavigationService->getObjectParents($repositoryId, $objectId, false, false); |
| 394 | 402 | |
| 395 | - if (PEAR::isError($response)) { | |
| 396 | - $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); | |
| 403 | + if ($response['status_code'] == 1) { | |
| 404 | + $feed = KT_cmis_atom_service_helper::getErrorFeed($this, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response['message']); | |
| 397 | 405 | $this->responseFeed = $feed; |
| 398 | 406 | return null; |
| 399 | 407 | } |
| 408 | + else { | |
| 409 | + $response = $response['results']; | |
| 410 | + } | |
| 400 | 411 | |
| 401 | 412 | // for now a document will only have one parent as KnowledgeTree does not support multi-filing |
| 402 | 413 | // TODO update this code if/when multi-filing support is added |
| ... | ... | @@ -435,10 +446,8 @@ class KT_cmis_atom_service_document extends KT_cmis_atom_service { |
| 435 | 446 | // attempt delete |
| 436 | 447 | $response = $VersioningService->deleteAllVersions($repositoryId, $this->params[0]); |
| 437 | 448 | |
| 438 | - // error? | |
| 439 | - if (PEAR::isError($response)) | |
| 440 | - { | |
| 441 | - $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $response->getMessage()); | |
| 449 | + if ($response['status_code'] == 1) { | |
| 450 | + $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $response['message']); | |
| 442 | 451 | // Expose the responseFeed |
| 443 | 452 | $this->responseFeed = $feed; |
| 444 | 453 | return null; |
| ... | ... | @@ -462,7 +471,7 @@ class KT_cmis_atom_service_pwc extends KT_cmis_atom_service { |
| 462 | 471 | { |
| 463 | 472 | $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); |
| 464 | 473 | |
| 465 | - $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 474 | + $ObjectService = new KTObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 466 | 475 | |
| 467 | 476 | // determine whether we want the Private Working Copy entry feed or the actual physical Private Working Copy content. |
| 468 | 477 | // this depends on $this->params[1] |
| ... | ... | @@ -489,10 +498,9 @@ class KT_cmis_atom_service_pwc extends KT_cmis_atom_service { |
| 489 | 498 | { |
| 490 | 499 | // call the cancel checkout function |
| 491 | 500 | |
| 492 | - $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); | |
| 493 | - | |
| 501 | + $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); | |
| 494 | 502 | $VersioningService = new KTVersioningService(KT_cmis_atom_service_helper::getKt()); |
| 495 | - | |
| 503 | + | |
| 496 | 504 | $response = $VersioningService->cancelCheckout($repositoryId, $this->params[0]); |
| 497 | 505 | |
| 498 | 506 | if ($response['status_code'] == 1) { |
| ... | ... | @@ -510,7 +518,7 @@ class KT_cmis_atom_service_pwc extends KT_cmis_atom_service { |
| 510 | 518 | { |
| 511 | 519 | $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); |
| 512 | 520 | $VersioningService = new KTVersioningService(KT_cmis_atom_service_helper::getKt()); |
| 513 | - $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 521 | + $ObjectService = new KTObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 514 | 522 | |
| 515 | 523 | // get object properties |
| 516 | 524 | $cmisObjectProperties = KT_cmis_atom_service_helper::getCmisProperties($this->rawContent); |
| ... | ... | @@ -568,10 +576,12 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { |
| 568 | 576 | public function GET_action() |
| 569 | 577 | { |
| 570 | 578 | $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); |
| 571 | - | |
| 572 | - $NavigationService = new NavigationService(KT_cmis_atom_service_helper::getKt()); | |
| 579 | + $NavigationService = new KTNavigationService(KT_cmis_atom_service_helper::getKt()); | |
| 573 | 580 | |
| 574 | 581 | $checkedout = $NavigationService->getCheckedOutDocs($repositoryId); |
| 582 | + | |
| 583 | + // hack, for removing one level of access | |
| 584 | + $checkedout = $checkedout['results']; | |
| 575 | 585 | |
| 576 | 586 | //Create a new response feed |
| 577 | 587 | $feed = new KT_cmis_atom_responseFeed_GET(CMIS_APP_BASE_URI); |
| ... | ... | @@ -607,12 +617,8 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { |
| 607 | 617 | $link->appendChild($feed->newAttr('type', 'application/atom+xml;type=feed')); |
| 608 | 618 | $feed->appendChild($link); |
| 609 | 619 | |
| 610 | - foreach($checkedout as $cmisEntry) | |
| 611 | - { | |
| 620 | + foreach($checkedout as $cmisEntry) { | |
| 612 | 621 | KT_cmis_atom_service_helper::createObjectEntry($feed, $cmisEntry, $folderName, true); |
| 613 | - | |
| 614 | -// // after each entry, add app:edited tag | |
| 615 | -// $feed->newField('app:edited', KT_cmis_atom_service_helper::formatDatestamp(), $feed); | |
| 616 | 622 | } |
| 617 | 623 | |
| 618 | 624 | $feed->newField('cmis:hasMoreItems', 'false', $feed); |
| ... | ... | @@ -624,9 +630,8 @@ class KT_cmis_atom_service_checkedout extends KT_cmis_atom_service { |
| 624 | 630 | public function POST_action() |
| 625 | 631 | { |
| 626 | 632 | $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); |
| 627 | - | |
| 628 | 633 | $VersioningService = new KTVersioningService(KT_cmis_atom_service_helper::getKt()); |
| 629 | - $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 634 | + $ObjectService = new KTObjectService(KT_cmis_atom_service_helper::getKt()); | |
| 630 | 635 | |
| 631 | 636 | $cmisObjectProperties = KT_cmis_atom_service_helper::getCmisProperties($this->rawContent); |
| 632 | 637 | |
| ... | ... | @@ -664,10 +669,14 @@ class KT_cmis_atom_service_types extends KT_cmis_atom_service { |
| 664 | 669 | |
| 665 | 670 | public function GET_action() |
| 666 | 671 | { |
| 667 | - $RepositoryService = new RepositoryService(); | |
| 672 | + $RepositoryService = new KTRepositoryService(); | |
| 668 | 673 | $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); |
| 669 | 674 | |
| 670 | 675 | $types = $RepositoryService->getTypes($repositoryId); |
| 676 | + | |
| 677 | + // hack for removing one level of access | |
| 678 | + $types = $types['results']; | |
| 679 | + | |
| 671 | 680 | $type = ((empty($this->params[0])) ? 'all' : $this->params[0]); |
| 672 | 681 | $feed = KT_cmis_atom_service_helper::getTypeFeed($type, $types); |
| 673 | 682 | |
| ... | ... | @@ -684,7 +693,7 @@ class KT_cmis_atom_service_type extends KT_cmis_atom_service { |
| 684 | 693 | |
| 685 | 694 | public function GET_action() |
| 686 | 695 | { |
| 687 | - $RepositoryService = new RepositoryService(); | |
| 696 | + $RepositoryService = new KTRepositoryService(); | |
| 688 | 697 | $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService); |
| 689 | 698 | |
| 690 | 699 | if (!isset($this->params[1])) { |
| ... | ... | @@ -696,6 +705,10 @@ class KT_cmis_atom_service_type extends KT_cmis_atom_service { |
| 696 | 705 | // call directly from here rather than via getTypeFeed. |
| 697 | 706 | $type = ucwords($this->params[0]); |
| 698 | 707 | $types = $RepositoryService->getTypes($repositoryId, $type); |
| 708 | + | |
| 709 | + // hack for removing one level of access | |
| 710 | + $types = $types['results']; | |
| 711 | + | |
| 699 | 712 | $feed = KT_cmis_atom_service_helper::getTypeFeed($type, $types); |
| 700 | 713 | } |
| 701 | 714 | else { |
| ... | ... | @@ -720,7 +733,6 @@ class KT_cmis_atom_service_type extends KT_cmis_atom_service { |
| 720 | 733 | private function getTypeChildrenFeed() |
| 721 | 734 | { |
| 722 | 735 | //Create a new response feed |
| 723 | - // $baseURI=NULL,$title=NULL,$link=NULL,$updated=NULL,$author=NULL,$id=NULL | |
| 724 | 736 | $feed = new KT_cmis_atom_responseFeed_GET(CMIS_APP_BASE_URI); |
| 725 | 737 | |
| 726 | 738 | $feed->newField('title', 'Child Types of ' . ucwords($this->params[0]), $feed); | ... | ... |
webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php
| ... | ... | @@ -16,11 +16,14 @@ class KT_cmis_atom_service_helper { |
| 16 | 16 | static public function setRepositoryId(&$RepositoryService = null) |
| 17 | 17 | { |
| 18 | 18 | if (is_null($RepositoryService)) { |
| 19 | - $RepositoryService = new RepositoryService(); | |
| 19 | + $RepositoryService = new KTRepositoryService(); | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $repositories = $RepositoryService->getRepositories(); |
| 23 | 23 | |
| 24 | + // hack for removing one level of access | |
| 25 | + $repositories = $repositories['results']; | |
| 26 | + | |
| 24 | 27 | // TODO handle multiple repositories |
| 25 | 28 | self::$repositoryId = $repositories[0]['repositoryId']; |
| 26 | 29 | } |
| ... | ... | @@ -60,11 +63,11 @@ class KT_cmis_atom_service_helper { |
| 60 | 63 | $serviceType = $service->getServiceType(); |
| 61 | 64 | $response = $ObjectService->getProperties($repositoryId, $objectId, false, false); |
| 62 | 65 | |
| 63 | - if (PEAR::isError($response)) { | |
| 64 | - return KT_cmis_atom_service_helper::getErrorFeed($service, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); | |
| 66 | + if ($response['status_code'] == 1) { | |
| 67 | + return KT_cmis_atom_service_helper::getErrorFeed($service, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response['message']); | |
| 65 | 68 | } |
| 66 | - | |
| 67 | - $cmisEntry = $response; | |
| 69 | + | |
| 70 | + $cmisEntry = $response['results']; | |
| 68 | 71 | $response = null; |
| 69 | 72 | |
| 70 | 73 | // POST/PWC responses only send back an entry, not a feed |
| ... | ... | @@ -84,11 +87,6 @@ class KT_cmis_atom_service_helper { |
| 84 | 87 | |
| 85 | 88 | if ($serviceType == 'PWC') $pwc = true; else $pwc = false; |
| 86 | 89 | KT_cmis_atom_service_helper::createObjectEntry($response, $cmisEntry, $cmisEntry['properties']['parentId']['value'], $pwc, $method); |
| 87 | - | |
| 88 | - // Don't think this should be here...only one item so why would we need to say there are no more? | |
| 89 | - /*if ($method == 'GET') { | |
| 90 | - $response->newField('cmis:hasMoreItems', 'false', $response); | |
| 91 | - }*/ | |
| 92 | 90 | |
| 93 | 91 | return $response; |
| 94 | 92 | } |
| ... | ... | @@ -639,12 +637,15 @@ class KT_cmis_atom_service_helper { |
| 639 | 637 | static public function getContentStream(&$service, &$ObjectService, $repositoryId) |
| 640 | 638 | { |
| 641 | 639 | $response = $ObjectService->getProperties($repositoryId, $service->params[0], false, false); |
| 642 | - if (PEAR::isError($response)) { | |
| 640 | + if ($response['status_code'] == 1) { | |
| 643 | 641 | return null; |
| 644 | 642 | } |
| 645 | 643 | |
| 646 | 644 | $contentStream = $ObjectService->getContentStream($repositoryId, $service->params[0]); |
| 647 | 645 | |
| 646 | + // hack for removing one level of access | |
| 647 | + $contentStream = $contentStream['results']; | |
| 648 | + | |
| 648 | 649 | return $contentStream; |
| 649 | 650 | } |
| 650 | 651 | /** |
| ... | ... | @@ -657,11 +658,14 @@ class KT_cmis_atom_service_helper { |
| 657 | 658 | static public function downloadContentStream(&$service, &$ObjectService, $repositoryId) |
| 658 | 659 | { |
| 659 | 660 | $response = $ObjectService->getProperties($repositoryId, $service->params[0], false, false); |
| 660 | - if (PEAR::isError($response)) { | |
| 661 | - $feed = KT_cmis_atom_service_helper::getErrorFeed($service, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response->getMessage()); | |
| 661 | + if ($response['status_code'] == 1) { | |
| 662 | + $feed = KT_cmis_atom_service_helper::getErrorFeed($service, KT_cmis_atom_service::STATUS_SERVER_ERROR, $response['message']); | |
| 662 | 663 | $service->responseFeed = $feed; |
| 663 | 664 | return null; |
| 664 | 665 | } |
| 666 | + else { | |
| 667 | + $response = $response['results']; | |
| 668 | + } | |
| 665 | 669 | |
| 666 | 670 | // TODO also check If-Modified-Since? |
| 667 | 671 | // $service->headers['If-Modified-Since'] => 2009-07-24 17:16:54 |
| ... | ... | @@ -678,6 +682,9 @@ class KT_cmis_atom_service_helper { |
| 678 | 682 | |
| 679 | 683 | $contentStream = $ObjectService->getContentStream($repositoryId, $service->params[0]); |
| 680 | 684 | |
| 685 | + // hack for removing one level of access | |
| 686 | + $contentStream = $contentStream['results']; | |
| 687 | + | |
| 681 | 688 | // headers specific to output |
| 682 | 689 | $service->setEtag($eTag); |
| 683 | 690 | $service->setHeader('Last-Modified', $response['properties']['lastModificationDate']['value']); | ... | ... |
webservice/classes/atompub/KT_atom_serviceDoc.inc.php
| ... | ... | @@ -43,7 +43,6 @@ |
| 43 | 43 | */ |
| 44 | 44 | include_once('KT_atom_baseDoc.inc.php'); |
| 45 | 45 | |
| 46 | - | |
| 47 | 46 | class KT_atom_serviceDoc extends KT_atom_baseDoc { |
| 48 | 47 | |
| 49 | 48 | protected $baseURI=NULL; |
| ... | ... | @@ -97,11 +96,6 @@ class KT_atom_serviceDoc extends KT_atom_baseDoc { |
| 97 | 96 | |
| 98 | 97 | |
| 99 | 98 | |
| 100 | - | |
| 101 | - | |
| 102 | - | |
| 103 | - | |
| 104 | - | |
| 105 | 99 | /** |
| 106 | 100 | <?xml version="1.0" encoding="utf-8"?> |
| 107 | 101 | <service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"> | ... | ... |
webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | include_once(KT_ATOM_LIB_FOLDER . 'KT_atom_server.inc.php'); |
| 4 | -require_once('RepositoryService.inc.php'); | |
| 4 | +require_once(CMIS_API . '/ktRepositoryService.inc.php'); | |
| 5 | 5 | |
| 6 | 6 | class KT_cmis_atom_server extends KT_atom_server { |
| 7 | 7 | |
| ... | ... | @@ -45,12 +45,18 @@ class KT_cmis_atom_server extends KT_atom_server { |
| 45 | 45 | $workspace = strtolower(trim($queryArray[0])); |
| 46 | 46 | if ($workspace == 'servicedocument') |
| 47 | 47 | { |
| 48 | - $RepositoryService = new RepositoryService(); | |
| 48 | + $RepositoryService = new KTRepositoryService(); | |
| 49 | 49 | |
| 50 | 50 | // fetch data for response |
| 51 | 51 | $repositories = $RepositoryService->getRepositories(); |
| 52 | + | |
| 53 | + // hack for removing one level of access | |
| 54 | + $repositories = $repositories['results']; | |
| 55 | + | |
| 52 | 56 | // fetch for default first repo; NOTE that this will probably have to change at some point, quick and dirty for now |
| 53 | - $this->repositoryInfo = $RepositoryService->getRepositoryInfo($repositories[0]['repositoryId']); | |
| 57 | + // hack for removing one level of access | |
| 58 | + $repositoryInfo = $RepositoryService->getRepositoryInfo($repositories[0]['repositoryId']); | |
| 59 | + $this->repositoryInfo = $repositoryInfo['results']; | |
| 54 | 60 | } |
| 55 | 61 | } |
| 56 | 62 | ... | ... |
webservice/classes/atompub/cmis/KT_cmis_atom_serviceDoc.inc.php
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | * Includes |
| 44 | 44 | */ |
| 45 | 45 | include_once(KT_ATOM_LIB_FOLDER.'KT_atom_serviceDoc.inc.php'); |
| 46 | -require_once('RepositoryService.inc.php'); | |
| 46 | +require_once(CMIS_API . '/ktRepositoryService.inc.php'); | |
| 47 | 47 | |
| 48 | 48 | class KT_cmis_atom_serviceDoc extends KT_atom_serviceDoc { |
| 49 | 49 | |
| ... | ... | @@ -58,12 +58,18 @@ class KT_cmis_atom_serviceDoc extends KT_atom_serviceDoc { |
| 58 | 58 | // get repositoryInfo |
| 59 | 59 | // NOTE currently we only support one repository, which will be the first one found in the repositories.xml config |
| 60 | 60 | // TODO multiple repositories as individual workspaces |
| 61 | - $RepositoryService = new RepositoryService(); | |
| 61 | + $RepositoryService = new KTRepositoryService(); | |
| 62 | 62 | |
| 63 | 63 | // fetch data for response |
| 64 | 64 | $repositories = $RepositoryService->getRepositories(); |
| 65 | + | |
| 66 | + // hack for removing one level of access | |
| 67 | + $repositories = $repositories['results']; | |
| 68 | + | |
| 65 | 69 | // fetch for default first repo; NOTE that this will probably have to change at some point, quick and dirty for now |
| 66 | - $this->repositoryInfo = $RepositoryService->getRepositoryInfo($repositories[0]['repositoryId']); | |
| 70 | + // hack for removing one level of access | |
| 71 | + $repositoryInfo = $RepositoryService->getRepositoryInfo($repositories[0]['repositoryId']); | |
| 72 | + $this->repositoryInfo = $repositoryInfo['results']; | |
| 67 | 73 | } |
| 68 | 74 | |
| 69 | 75 | protected function constructServiceDocumentHeaders() | ... | ... |
webservice/classes/atompub/cmis/NavigationService.inc.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -require_once KT_LIB_DIR . '/api/ktcmis/ktNavigationService.inc.php'; | |
| 4 | - | |
| 5 | -/** | |
| 6 | - * CMIS Service class which hooks into the KnowledgeTree interface | |
| 7 | - * for processing of CMIS queries and responses via atompub/webservices | |
| 8 | - */ | |
| 9 | - | |
| 10 | -class NavigationService extends KTNavigationService { | |
| 11 | - | |
| 12 | - /** | |
| 13 | - * Get descendents of the specified folder, up to the depth indicated | |
| 14 | - * | |
| 15 | - * @param string $repositoryId | |
| 16 | - * @param string $folderId | |
| 17 | - * @param boolean $includeAllowableActions | |
| 18 | - * @param boolean $includeRelationships | |
| 19 | - * @param string $typeID | |
| 20 | - * @param int $depth | |
| 21 | - * @param string $filter | |
| 22 | - * @return cmisObjectType[] | |
| 23 | - */ | |
| 24 | - public function getDescendants($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, | |
| 25 | - $depth = 1, $typeID = 'Any', $filter = '') | |
| 26 | - { | |
| 27 | - $result = parent::getDescendants($repositoryId, $folderId, $includeAllowableActions, | |
| 28 | - $includeRelationships, $depth, $typeID, $filter); | |
| 29 | - | |
| 30 | - if ($result['status_code'] == 0) | |
| 31 | - { | |
| 32 | - return $result['results']; | |
| 33 | - } | |
| 34 | - } | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * Get direct children of the specified folder | |
| 38 | - * | |
| 39 | - * @param string $repositoryId | |
| 40 | - * @param string $folderId | |
| 41 | - * @param boolean $includeAllowableActions | |
| 42 | - * @param boolean $includeRelationships | |
| 43 | - * @param string $typeID | |
| 44 | - * @param string $filter | |
| 45 | - * @param int $maxItems | |
| 46 | - * @param int $skipCount | |
| 47 | - * @return cmisObjectType[] | |
| 48 | - */ | |
| 49 | - public function getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, | |
| 50 | - $typeID = 'Any', $filter = '', $maxItems = 0, $skipCount = 0) | |
| 51 | - { | |
| 52 | - $result = parent::getChildren($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, | |
| 53 | - $typeID, $filter, $maxItems, $skipCount); | |
| 54 | - | |
| 55 | - if ($result['status_code'] == 0) | |
| 56 | - { | |
| 57 | - return $result['results']; | |
| 58 | - } | |
| 59 | - } | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * Gets the parent of the selected folder | |
| 63 | - * | |
| 64 | - * @param string $repositoryId | |
| 65 | - * @param string $folderId | |
| 66 | - * @param boolean $includeAllowableActions | |
| 67 | - * @param boolean $includeRelationships | |
| 68 | - * @param boolean $returnToRoot | |
| 69 | - * @param string $filter | |
| 70 | - * @return cmisObjectType[] | |
| 71 | - */ | |
| 72 | - public function getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter = '') | |
| 73 | - { | |
| 74 | - $result = parent::getFolderParent($repositoryId, $folderId, $includeAllowableActions, $includeRelationships, $returnToRoot, $filter); | |
| 75 | - | |
| 76 | - if ($result['status_code'] == 0) | |
| 77 | - { | |
| 78 | - return $result['results']; | |
| 79 | - } | |
| 80 | - else { | |
| 81 | - return new PEAR_Error($result['message']); | |
| 82 | - } | |
| 83 | - } | |
| 84 | - | |
| 85 | - /** | |
| 86 | - * Gets the parents for the selected object | |
| 87 | - * | |
| 88 | - * @param string $repositoryId | |
| 89 | - * @param string $folderId | |
| 90 | - * @param boolean $includeAllowableActions | |
| 91 | - * @param boolean $includeRelationships | |
| 92 | - * @param string $filter | |
| 93 | - * @return cmisObjectType[] | |
| 94 | - */ | |
| 95 | - public function getObjectParents($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $filter = '') | |
| 96 | - { | |
| 97 | - $result = parent::getObjectParents($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $filter); | |
| 98 | - | |
| 99 | - if ($result['status_code'] == 0) | |
| 100 | - { | |
| 101 | - return $result['results']; | |
| 102 | - } | |
| 103 | - } | |
| 104 | - | |
| 105 | - /** | |
| 106 | - * Returns a list of checked out documents from the selected repository | |
| 107 | - * | |
| 108 | - * @param string $repositoryId | |
| 109 | - * @param string $folderId The folder for which checked out docs are requested | |
| 110 | - * @param string $filter | |
| 111 | - * @param int $maxItems | |
| 112 | - * @param int $skipCount | |
| 113 | - * @return array $checkedout The collection of checked out documents | |
| 114 | - */ | |
| 115 | - function getCheckedOutDocs($repositoryId, $folderId = null, $filter = '', $maxItems = 0, $skipCount = 0) | |
| 116 | - { | |
| 117 | - $result = parent::getCheckedOutDocs($repositoryId, $folderId, $filter, $maxItems, $skipCount); | |
| 118 | - | |
| 119 | - if ($result['status_code'] == 0) | |
| 120 | - { | |
| 121 | - return $result['results']; | |
| 122 | - } | |
| 123 | - } | |
| 124 | - | |
| 125 | -} | |
| 126 | - | |
| 127 | -?> |
webservice/classes/atompub/cmis/ObjectService.inc.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -require_once KT_LIB_DIR . '/api/ktcmis/ktObjectService.inc.php'; | |
| 4 | - | |
| 5 | -/** | |
| 6 | - * CMIS Service class which hooks into the KnowledgeTree interface | |
| 7 | - * for processing of CMIS queries and responses via atompub/webservices | |
| 8 | - */ | |
| 9 | - | |
| 10 | -class ObjectService extends KTObjectService { | |
| 11 | - | |
| 12 | - /** | |
| 13 | - * Fetches the properties for the specified object | |
| 14 | - * | |
| 15 | - * @param string $repositoryId | |
| 16 | - * @param string $objectId | |
| 17 | - * @param boolean $includeAllowableActions | |
| 18 | - * @param boolean $includeRelationships | |
| 19 | - * @param boolean $returnVersion | |
| 20 | - * @param string $filter | |
| 21 | - * @return object CMIS object properties | |
| 22 | - */ | |
| 23 | - public function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, | |
| 24 | - $returnVersion = false, $filter = '') | |
| 25 | - { | |
| 26 | - $result = parent::getProperties($repositoryId, $objectId, $includeAllowableActions, | |
| 27 | - $returnVersion, $filter); | |
| 28 | - | |
| 29 | - if ($result['status_code'] == 0) { | |
| 30 | - return $result['results']; | |
| 31 | - } | |
| 32 | - else { | |
| 33 | - return new PEAR_Error($result['message']); | |
| 34 | - } | |
| 35 | - } | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * Creates a new document within the repository | |
| 39 | - * | |
| 40 | - * @param string $repositoryId The repository to which the document must be added | |
| 41 | - * @param array $properties Array of properties which must be applied to the created document object | |
| 42 | - * @param string $folderId The id of the folder which will be the parent of the created document object | |
| 43 | - * This parameter is optional IF unfilingCapability is supported | |
| 44 | - * @param string $contentStream optional content stream data - expected as a base64 encoded string | |
| 45 | - * @param string $versioningState optional version state value: none/checkedout/major/minor | |
| 46 | - * @param $policies List of policy ids that MUST be applied | |
| 47 | - * @param $addACEs List of ACEs that MUST be added | |
| 48 | - * @param $removeACEs List of ACEs that MUST be removed | |
| 49 | - * @return string $objectId The id of the created folder object | |
| 50 | - */ | |
| 51 | - public function createDocument($repositoryId, $properties, $folderId = null, $contentStream = null, | |
| 52 | - $versioningState = 'none', $policies = array(), $addACEs = array(), | |
| 53 | - $removeACEs = array()) | |
| 54 | - { | |
| 55 | - $result = parent::createDocument($repositoryId, $properties, $folderId, $contentStream, $versioningState, | |
| 56 | - $policies, $addACEs, $removeACEs); | |
| 57 | - | |
| 58 | - if ($result['status_code'] == 0) { | |
| 59 | - return $result['results']; | |
| 60 | - } | |
| 61 | - else { | |
| 62 | - return new PEAR_Error($result['message']); | |
| 63 | - } | |
| 64 | - } | |
| 65 | - | |
| 66 | - /** | |
| 67 | - * Creates a new folder within the repository | |
| 68 | - * | |
| 69 | - * @param string $repositoryId The repository to which the folder must be added | |
| 70 | - * @param string $typeId Object Type id for the folder object being created | |
| 71 | - * @param array $properties Array of properties which must be applied to the created folder object | |
| 72 | - * @param string $folderId The id of the folder which will be the parent of the created folder object | |
| 73 | - * @return string $objectId The id of the created folder object | |
| 74 | - */ | |
| 75 | - public function createFolder($repositoryId, $typeId, $properties, $folderId) | |
| 76 | - { | |
| 77 | - $result = parent::createFolder($repositoryId, $typeId, $properties, $folderId); | |
| 78 | - | |
| 79 | - if ($result['status_code'] == 0) { | |
| 80 | - return $result['results']; | |
| 81 | - } | |
| 82 | - else { | |
| 83 | - return new PEAR_Error($result['message']); | |
| 84 | - } | |
| 85 | - } | |
| 86 | - | |
| 87 | - /** | |
| 88 | - * Fetches the content stream data for an object | |
| 89 | - * | |
| 90 | - * @param string $repositoryId | |
| 91 | - * @param string $objectId | |
| 92 | - * @param string $streamId [optional for documents] Specifies the rendition to retrieve if not original document | |
| 93 | - * @return string $contentStream (binary or text data) | |
| 94 | - */ | |
| 95 | - function getContentStream($repositoryId, $objectId, $streamId = null) | |
| 96 | - { | |
| 97 | - $result = parent::getContentStream($repositoryId, $objectId, $streamId); | |
| 98 | - | |
| 99 | - if ($result['status_code'] == 0) { | |
| 100 | - return $result['results']; | |
| 101 | - } | |
| 102 | - else { | |
| 103 | - return new PEAR_Error($result['message']); | |
| 104 | - } | |
| 105 | - } | |
| 106 | - | |
| 107 | - /** | |
| 108 | - * Moves a fileable object from one folder to another. | |
| 109 | - * | |
| 110 | - * @param object $repositoryId | |
| 111 | - * @param object $objectId | |
| 112 | - * @param object $changeToken [optional] | |
| 113 | - * @param object $targetFolderId | |
| 114 | - * @param object $sourceFolderId [optional] | |
| 115 | - */ | |
| 116 | - public function moveObject($repositoryId, $objectId, $changeToken = '', $targetFolderId, $sourceFolderId = null) | |
| 117 | - { | |
| 118 | - $result = parent::moveObject($repositoryId, $objectId, $changeToken, $targetFolderId, $sourceFolderId); | |
| 119 | - | |
| 120 | - if ($result['status_code'] == 0) { | |
| 121 | - return $result['results']; | |
| 122 | - } | |
| 123 | - else { | |
| 124 | - return new PEAR_Error($result['message']); | |
| 125 | - } | |
| 126 | - } | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * Deletes an object from the repository | |
| 130 | - * | |
| 131 | - * @param string $repositoryId | |
| 132 | - * @param string $objectId | |
| 133 | - * @param string $changeToken [optional] | |
| 134 | - * @return boolean true on success, false on failure | |
| 135 | - */ | |
| 136 | - // NOTE Invoking this service method on an object SHALL not delete the entire version series for a Document Object. | |
| 137 | - // To delete an entire version series, use the deleteAllVersions() service | |
| 138 | - public function deleteObject($repositoryId, $objectId, $changeToken = null) | |
| 139 | - { | |
| 140 | - $result = parent::deleteObject($repositoryId, $objectId, $changeToken); | |
| 141 | - | |
| 142 | - if ($result['status_code'] == 0) { | |
| 143 | - return $result['results']; | |
| 144 | - } | |
| 145 | - else { | |
| 146 | - return new PEAR_Error($result['message']); | |
| 147 | - } | |
| 148 | - } | |
| 149 | - | |
| 150 | - /** | |
| 151 | - * Deletes an entire tree including all subfolders and other filed objects | |
| 152 | - * | |
| 153 | - * @param string $repositoryId | |
| 154 | - * @param string $objectId | |
| 155 | - * @param string $changeToken [optional] | |
| 156 | - * @param boolean $unfileNonfolderObject [optional] - note that since KnowledgeTree does not allow unfiling this will be ignored | |
| 157 | - * @param boolean $continueOnFailure [optional] - note that since KnowledgeTree does not allow continue on failure this will be ignored | |
| 158 | - * @return array $failedToDelete A list of identifiers of objects in the folder tree that were not deleted. | |
| 159 | - */ | |
| 160 | - public function deleteTree($repositoryId, $objectId, $changeToken = null, $unfileNonfolderObject = 'delete', $continueOnFailure = false) | |
| 161 | - { | |
| 162 | - $result = parent::deleteTree($repositoryId, $objectId, $changeToken, $unfileNonfolderObject, $continueOnFailure); | |
| 163 | - | |
| 164 | - if ($result['status_code'] == 0) { | |
| 165 | - return $result['results']; | |
| 166 | - } | |
| 167 | - else if (is_array($result['message'])) { | |
| 168 | - return $result['message']; | |
| 169 | - } | |
| 170 | - else { | |
| 171 | - return new PEAR_Error($result['message']); | |
| 172 | - } | |
| 173 | - } | |
| 174 | - | |
| 175 | -} | |
| 176 | - | |
| 177 | -?> |
webservice/classes/atompub/cmis/RepositoryService.inc.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * CMIS Service class which hooks into the KnowledgeTree interface | |
| 5 | - * for processing of CMIS queries and responses via atompub/webservices | |
| 6 | - */ | |
| 7 | - | |
| 8 | -require_once KT_LIB_DIR . '/api/ktcmis/ktRepositoryService.inc.php'; | |
| 9 | - | |
| 10 | -class RepositoryService extends KTRepositoryService { | |
| 11 | - | |
| 12 | - /** | |
| 13 | - * Fetches a list of available repositories | |
| 14 | - * | |
| 15 | - * @return cmisRepositoryEntryType[] | |
| 16 | - */ | |
| 17 | - public function getRepositories() | |
| 18 | - { | |
| 19 | - $result = parent::getRepositories(); | |
| 20 | - | |
| 21 | - if ($result['status_code'] == 0) | |
| 22 | - { | |
| 23 | - return $result['results']; | |
| 24 | - } | |
| 25 | - } | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * Fetches information about the selected repository | |
| 29 | - * | |
| 30 | - * @param string $repositoryId | |
| 31 | - * @return cmisRepositoryInfoType | |
| 32 | - */ | |
| 33 | - public function getRepositoryInfo($repositoryId) | |
| 34 | - { | |
| 35 | - $result = parent::getRepositoryInfo($repositoryId); | |
| 36 | - | |
| 37 | - if ($result['status_code'] == 0) | |
| 38 | - { | |
| 39 | - return $result['results']; | |
| 40 | - } | |
| 41 | - } | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * Fetch the list of supported object types for the selected repository | |
| 45 | - * | |
| 46 | - * @param string $repositoryId The ID of the repository for which object types must be returned | |
| 47 | - * @param string $typeId The type to return, ALL if not set | |
| 48 | - * @param boolean $returnPropertyDefinitions Return property definitions as well if TRUE | |
| 49 | - * @param int $maxItems The maximum number of items to return | |
| 50 | - * @param int $skipCount The number of items to skip before starting to return results | |
| 51 | - * @param boolean $hasMoreItems TRUE if there are more items to return than were requested | |
| 52 | - * @return cmisTypeDefinitionType[] | |
| 53 | - */ | |
| 54 | - public function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, | |
| 55 | - $maxItems = 0, $skipCount = 0, &$hasMoreItems = false) | |
| 56 | - { | |
| 57 | - $result = parent::getTypes($repositoryId, $typeId, $returnPropertyDefinitions, | |
| 58 | - $maxItems, $skipCount, $hasMoreItems); | |
| 59 | - | |
| 60 | - if ($result['status_code'] == 0) | |
| 61 | - { | |
| 62 | - return $result['results']; | |
| 63 | - } | |
| 64 | - } | |
| 65 | - | |
| 66 | - /** | |
| 67 | - * Fetch the object type definition for the requested type | |
| 68 | - * | |
| 69 | - * @param string $repositoryId | |
| 70 | - * @param string $typeId | |
| 71 | - * @return cmisTypeDefinitionType | |
| 72 | - */ | |
| 73 | - public function getTypeDefinition($repositoryId, $typeId) | |
| 74 | - { | |
| 75 | - $result = parent::getTypeDefinition($repositoryId, $typeId); | |
| 76 | - | |
| 77 | - if ($result['status_code'] == 0) | |
| 78 | - { | |
| 79 | - return $result['results']; | |
| 80 | - } | |
| 81 | - } | |
| 82 | - | |
| 83 | -} | |
| 84 | - | |
| 85 | -?> |
webservice/classes/atompub/cmis/VersioningService.inc.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -require_once KT_LIB_DIR . '/api/ktcmis/ktVersioningService.inc.php'; | |
| 4 | - | |
| 5 | -/** | |
| 6 | - * CMIS Service class which hooks into the KnowledgeTree interface | |
| 7 | - * for processing of CMIS queries and responses via atompub/webservices | |
| 8 | - */ | |
| 9 | - | |
| 10 | -class VersioningService extends KTVersioningService { | |
| 11 | - | |
| 12 | - /** | |
| 13 | - * Deletes all Document Objects in the specified Version Series, including the Private Working Copy | |
| 14 | - * | |
| 15 | - * @param string $repositoryId | |
| 16 | - * @param string $versionSeriesId | |
| 17 | - * @return boolean true if successful | |
| 18 | - */ | |
| 19 | - public function deleteAllVersions($repositoryId, $versionSeriesId) | |
| 20 | - { | |
| 21 | - $result = parent::deleteAllVersions($repositoryId, $versionSeriesId); | |
| 22 | - | |
| 23 | - if ($result['status_code'] == 0) { | |
| 24 | - return $result['results']; | |
| 25 | - } | |
| 26 | - else { | |
| 27 | - return new PEAR_Error($result['message']); | |
| 28 | - } | |
| 29 | - } | |
| 30 | - | |
| 31 | -} | |
| 32 | - | |
| 33 | -?> |