From 007187de5030af1113a8bec66d3282734e25c85f Mon Sep 17 00:00:00 2001 From: Paul Barrett Date: Thu, 4 Mar 2010 11:19:28 +0200 Subject: [PATCH] Fix issue with document creation caused by changes in getTypeDefinition --- lib/api/ktcmis/services/CMISObjectService.inc.php | 9 +++------ lib/api/ktcmis/services/CMISRepositoryService.inc.php | 5 +---- webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php | 2 +- webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php | 3 --- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/api/ktcmis/services/CMISObjectService.inc.php b/lib/api/ktcmis/services/CMISObjectService.inc.php index a501fba..82e005c 100644 --- a/lib/api/ktcmis/services/CMISObjectService.inc.php +++ b/lib/api/ktcmis/services/CMISObjectService.inc.php @@ -70,8 +70,7 @@ class CMISObjectService { throw new ConstraintViolationException('Object base type could not be determined. ' . $e->getMessage()); } - if ($typeDefinition['attributes']['baseId'] != 'cmis:document') - { + if ($typeDefinition['attributes']['baseId'] != 'cmis:document') { throw new ConstraintViolationException('Object is not of base type document'); } @@ -306,8 +305,6 @@ class CMISObjectService { // an ACE provided which is not supported by the repository. public function createFolder($repositoryId, $properties, $folderId, $policies = array(), $addACEs = array(), $removeACEs = array()) { - global $default; - $default->log->info('try create folder'); $objectId = null; // fetch type definition of supplied type and check for base type "folder", if not true throw exception @@ -347,7 +344,7 @@ class CMISObjectService { if (!$typeDefinition['attributes']['controllableACL'] && (count($addACEs) || count($removeACEs))) { throw new ConstraintViolationException('This object-type does not support ACLs'); } - $default->log->info(print_r($properties, true)); + // set title and name identical if only one submitted if ($properties['title'] == '') { $properties['title'] = $properties['name']; @@ -567,7 +564,7 @@ class CMISObjectService { if (!$exists) { throw new updateConflictException('Unable to delete the object as it cannot be found.'); } - global $default; + // throw ConstraintViolationException if method is invoked on a Folder object that contains one or more objects if ($typeId == 'cmis:folder') { diff --git a/lib/api/ktcmis/services/CMISRepositoryService.inc.php b/lib/api/ktcmis/services/CMISRepositoryService.inc.php index 4c4e820..8bc2d58 100644 --- a/lib/api/ktcmis/services/CMISRepositoryService.inc.php +++ b/lib/api/ktcmis/services/CMISRepositoryService.inc.php @@ -163,9 +163,6 @@ class CMISRepositoryService { // NOTE this code may fit better in the Repository Class function getTypeDefinition($repositoryId, $typeId) { - global $default; - $default->log->debug(); - $default->log->info(str_replace('cmis:', '', $typeId)); $typeId = ucwords(str_replace('cmis:', '', $typeId)); $object = 'CMIS' . $typeId . 'Object'; @@ -183,7 +180,7 @@ class CMISRepositoryService { // NOTE The specification is ambigous here: it states that this function must return the type properties, but // the atompub example shows the type attributes, not properties; since most properties are only populated // on creation of an instance of an object-type, we choose to go with the attributes and not the properties - $typeDefinition = $cmisObject->getAttributes(); + $typeDefinition['attributes'] = $cmisObject->getAttributes(); return $typeDefinition; } diff --git a/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php b/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php index c9d39f3..bce4c4e 100644 --- a/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php +++ b/webservice/atompub/cmis/KT_cmis_atom_server.services.inc.php @@ -709,7 +709,7 @@ class KT_cmis_atom_service_type extends KT_cmis_atom_service { return null; } - $feed = KT_cmis_atom_service_helper::getTypeFeed($type, array($typeDefinition)); + $feed = KT_cmis_atom_service_helper::getTypeFeed($type, array($typeDefinition['attributes'])); // Expose the responseFeed $this->responseFeed=$feed; diff --git a/webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php b/webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php index 899038b..417121d 100644 --- a/webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php +++ b/webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php @@ -166,9 +166,6 @@ class KT_cmis_atom_server extends KT_atom_server { header('Content-type: text/xml'); } -// global $default; -// $default->log->info($this->output); - if ($this->renderBody) { echo $this->output; } -- libgit2 0.21.4