Commit 007187de5030af1113a8bec66d3282734e25c85f

Authored by Paul Barrett
1 parent bb935276

Fix issue with document creation caused by changes in getTypeDefinition

Story ID:2295472. Update KT CMIS implementation to 1.0 lib/api/compliance

Committed by: Paul Barrett
lib/api/ktcmis/services/CMISObjectService.inc.php
@@ -70,8 +70,7 @@ class CMISObjectService { @@ -70,8 +70,7 @@ class CMISObjectService {
70 throw new ConstraintViolationException('Object base type could not be determined. ' . $e->getMessage()); 70 throw new ConstraintViolationException('Object base type could not be determined. ' . $e->getMessage());
71 } 71 }
72 72
73 - if ($typeDefinition['attributes']['baseId'] != 'cmis:document')  
74 - { 73 + if ($typeDefinition['attributes']['baseId'] != 'cmis:document') {
75 throw new ConstraintViolationException('Object is not of base type document'); 74 throw new ConstraintViolationException('Object is not of base type document');
76 } 75 }
77 76
@@ -306,8 +305,6 @@ class CMISObjectService { @@ -306,8 +305,6 @@ class CMISObjectService {
306 // an ACE provided which is not supported by the repository. 305 // an ACE provided which is not supported by the repository.
307 public function createFolder($repositoryId, $properties, $folderId, $policies = array(), $addACEs = array(), $removeACEs = array()) 306 public function createFolder($repositoryId, $properties, $folderId, $policies = array(), $addACEs = array(), $removeACEs = array())
308 { 307 {
309 - global $default;  
310 - $default->log->info('try create folder');  
311 $objectId = null; 308 $objectId = null;
312 309
313 // fetch type definition of supplied type and check for base type "folder", if not true throw exception 310 // fetch type definition of supplied type and check for base type "folder", if not true throw exception
@@ -347,7 +344,7 @@ class CMISObjectService { @@ -347,7 +344,7 @@ class CMISObjectService {
347 if (!$typeDefinition['attributes']['controllableACL'] && (count($addACEs) || count($removeACEs))) { 344 if (!$typeDefinition['attributes']['controllableACL'] && (count($addACEs) || count($removeACEs))) {
348 throw new ConstraintViolationException('This object-type does not support ACLs'); 345 throw new ConstraintViolationException('This object-type does not support ACLs');
349 } 346 }
350 - $default->log->info(print_r($properties, true)); 347 +
351 // set title and name identical if only one submitted 348 // set title and name identical if only one submitted
352 if ($properties['title'] == '') { 349 if ($properties['title'] == '') {
353 $properties['title'] = $properties['name']; 350 $properties['title'] = $properties['name'];
@@ -567,7 +564,7 @@ class CMISObjectService { @@ -567,7 +564,7 @@ class CMISObjectService {
567 if (!$exists) { 564 if (!$exists) {
568 throw new updateConflictException('Unable to delete the object as it cannot be found.'); 565 throw new updateConflictException('Unable to delete the object as it cannot be found.');
569 } 566 }
570 - global $default; 567 +
571 // throw ConstraintViolationException if method is invoked on a Folder object that contains one or more objects 568 // throw ConstraintViolationException if method is invoked on a Folder object that contains one or more objects
572 if ($typeId == 'cmis:folder') 569 if ($typeId == 'cmis:folder')
573 { 570 {
lib/api/ktcmis/services/CMISRepositoryService.inc.php
@@ -163,9 +163,6 @@ class CMISRepositoryService { @@ -163,9 +163,6 @@ class CMISRepositoryService {
163 // NOTE this code may fit better in the Repository Class 163 // NOTE this code may fit better in the Repository Class
164 function getTypeDefinition($repositoryId, $typeId) 164 function getTypeDefinition($repositoryId, $typeId)
165 { 165 {
166 - global $default;  
167 - $default->log->debug();  
168 - $default->log->info(str_replace('cmis:', '', $typeId));  
169 $typeId = ucwords(str_replace('cmis:', '', $typeId)); 166 $typeId = ucwords(str_replace('cmis:', '', $typeId));
170 $object = 'CMIS' . $typeId . 'Object'; 167 $object = 'CMIS' . $typeId . 'Object';
171 168
@@ -183,7 +180,7 @@ class CMISRepositoryService { @@ -183,7 +180,7 @@ class CMISRepositoryService {
183 // NOTE The specification is ambigous here: it states that this function must return the type properties, but 180 // NOTE The specification is ambigous here: it states that this function must return the type properties, but
184 // the atompub example shows the type attributes, not properties; since most properties are only populated 181 // the atompub example shows the type attributes, not properties; since most properties are only populated
185 // on creation of an instance of an object-type, we choose to go with the attributes and not the properties 182 // on creation of an instance of an object-type, we choose to go with the attributes and not the properties
186 - $typeDefinition = $cmisObject->getAttributes(); 183 + $typeDefinition['attributes'] = $cmisObject->getAttributes();
187 184
188 return $typeDefinition; 185 return $typeDefinition;
189 } 186 }
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 { @@ -709,7 +709,7 @@ class KT_cmis_atom_service_type extends KT_cmis_atom_service {
709 return null; 709 return null;
710 } 710 }
711 711
712 - $feed = KT_cmis_atom_service_helper::getTypeFeed($type, array($typeDefinition)); 712 + $feed = KT_cmis_atom_service_helper::getTypeFeed($type, array($typeDefinition['attributes']));
713 713
714 // Expose the responseFeed 714 // Expose the responseFeed
715 $this->responseFeed=$feed; 715 $this->responseFeed=$feed;
webservice/classes/atompub/cmis/KT_cmis_atom_server.inc.php
@@ -166,9 +166,6 @@ class KT_cmis_atom_server extends KT_atom_server { @@ -166,9 +166,6 @@ class KT_cmis_atom_server extends KT_atom_server {
166 header('Content-type: text/xml'); 166 header('Content-type: text/xml');
167 } 167 }
168 168
169 -// global $default;  
170 -// $default->log->info($this->output);  
171 -  
172 if ($this->renderBody) { 169 if ($this->renderBody) {
173 echo $this->output; 170 echo $this->output;
174 } 171 }