public function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $returnVersion = false, $filter = '') { $repository = new CMISRepository($repositoryId); // TODO a better default value? $properties = array(); $objectId = CMISUtil::decodeObjectId($objectId, $typeId); if ($typeId == 'Unknown') { throw new ObjectNotFoundException('The type of the requested object could not be determined'); } switch ($typeId) { case 'Document': $CMISObject = new CMISDocumentObject($objectId, $this->ktapi, $repository->getRepositoryURI()); break; case 'Folder': $CMISObject = new CMISFolderObject($objectId, $this->ktapi, $repository->getRepositoryURI()); break; } // check that we were actually able to retrieve a real object $objectId = $CMISObject->getProperty('ObjectId'); if (empty($objectId)) { throw new ObjectNotFoundException('The requested object could not be found'); } $properties = $CMISObject->getProperties(); return $properties; }
/** * Checks for the root folder * * @param unknown_type $repositoryId * @param unknown_type $folderId * @param unknown_type $ktapi * @return unknown */ public static function isRootFolder($repositoryId, $folderId, &$ktapi) { $repository = new CMISRepository($repositoryId); $repositoryInfo = $repository->getRepositoryInfo(); // NOTE this call is required to accomodate the definition of the root folder id in the config as required by the drupal module // we should try to update the drupal module to not require this, but this way is just easier at the moment, and most of // the code accomodates it without any serious hacks $rootFolder = self::getIdFromName($repositoryInfo->getRootFolderId(), $ktapi); return $folderId == $rootFolder; }
function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, $maxItems = 0, $skipCount = 0, &$hasMoreItems = false) { if ($typeId != '') { try { $typeDefinition = $this->getTypeDefinition($repositoryId, $typeId); } catch (Exception $e) { throw new InvalidArgumentException('Type ' . $typeId . ' is not supported'); } } $repository = new CMISRepository($repositoryId); $supportedTypes = $repository->getTypes(); $types = array(); // determine which types are actually supported based on available class definitions // compared with the repository's declaration of the types it supports $objectTypes = new CMISObjectTypes(); $types = $objectTypes->getObjectTypes(); foreach ($types as $key => $objectType) { // filter this list according to what is defined for the selected repository // additionally filter based on typeId if set if (!in_array($objectType, $supportedTypes) || $typeId != '' && $typeId != $objectType) { unset($types[$key]); continue; } $types[$key] = $this->getTypeDefinition($repositoryId, $objectType); // only return properties if explicitly requested if (!$returnPropertyDefinitions) { unset($types[$key]['properties']); } } return $types; }