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 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 74 throw new ConstraintViolationException('Object is not of base type document');
76 75 }
77 76  
... ... @@ -306,8 +305,6 @@ class CMISObjectService {
306 305 // an ACE provided which is not supported by the repository.
307 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 308 $objectId = null;
312 309  
313 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 344 if (!$typeDefinition['attributes']['controllableACL'] && (count($addACEs) || count($removeACEs))) {
348 345 throw new ConstraintViolationException('This object-type does not support ACLs');
349 346 }
350   - $default->log->info(print_r($properties, true));
  347 +
351 348 // set title and name identical if only one submitted
352 349 if ($properties['title'] == '') {
353 350 $properties['title'] = $properties['name'];
... ... @@ -567,7 +564,7 @@ class CMISObjectService {
567 564 if (!$exists) {
568 565 throw new updateConflictException('Unable to delete the object as it cannot be found.');
569 566 }
570   - global $default;
  567 +
571 568 // throw ConstraintViolationException if method is invoked on a Folder object that contains one or more objects
572 569 if ($typeId == 'cmis:folder')
573 570 {
... ...
lib/api/ktcmis/services/CMISRepositoryService.inc.php
... ... @@ -163,9 +163,6 @@ class CMISRepositoryService {
163 163 // NOTE this code may fit better in the Repository Class
164 164 function getTypeDefinition($repositoryId, $typeId)
165 165 {
166   - global $default;
167   - $default->log->debug();
168   - $default->log->info(str_replace('cmis:', '', $typeId));
169 166 $typeId = ucwords(str_replace('cmis:', '', $typeId));
170 167 $object = 'CMIS' . $typeId . 'Object';
171 168  
... ... @@ -183,7 +180,7 @@ class CMISRepositoryService {
183 180 // NOTE The specification is ambigous here: it states that this function must return the type properties, but
184 181 // the atompub example shows the type attributes, not properties; since most properties are only populated
185 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 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 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 714 // Expose the responseFeed
715 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 166 header('Content-type: text/xml');
167 167 }
168 168  
169   -// global $default;
170   -// $default->log->info($this->output);
171   -
172 169 if ($this->renderBody) {
173 170 echo $this->output;
174 171 }
... ...