CMISObjectService.inc.php
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
// really wanted to keep KT code out of here but I don't see how
require_once(KT_DIR . '/ktapi/ktapi.inc.php');
require_once(CMIS_DIR . '/objecttypes/CMISDocumentObject.inc.php');
require_once(CMIS_DIR . '/objecttypes/CMISFolderObject.inc.php');
require_once(CMIS_DIR . '/classes/CMISRepository.inc.php');
require_once(CMIS_DIR . '/util/CMISUtil.inc.php');
class CMISObjectService {
protected $ktapi;
function CMISObjectService(&$ktapi)
{
$this->ktapi = $ktapi;
}
/**
* Fetches the properties for the specified object
*
* @param string $repositoryId
* @param string $objectId
* @param boolean $includeAllowableActions
* @param boolean $includeRelationships
* @param boolean $returnVersion
* @param string $filter
* @return object CMIS object properties
*/
// TODO optional parameter support
// TODO FilterNotValidException: The Repository SHALL throw this exception if this property filter input parameter is not valid
function getProperties($repositoryId, $objectId, $includeAllowableActions, $includeRelationships,
$returnVersion = false, $filter = '')
{
$repository = new CMISRepository($repositoryId);
// TODO a better default value?
$properties = array();
$typeId = CMISUtil::decodeObjectId($objectId);
switch($typeId)
{
case 'Document':
$CMISObject = new CMISDocumentObject($this->ktapi, $repository->getRepositoryURI());
break;
case 'Folder':
$CMISObject = new CMISFolderObject($this->ktapi, $repository->getRepositoryURI());
break;
}
$CMISObject->get($objectId);
$properties = $CMISObject->getProperties();
return $properties;
}
}
?>