/**
  * Short description of method setItemContent
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Resource item
  * @param  string content
  * @param  string lang
  * @param  string commitMessage
  * @return boolean
  */
 public function setItemContent(core_kernel_classes_Resource $item, $content, $lang = '', $commitMessage = '')
 {
     $returnValue = (bool) false;
     if (is_null($item) && !$this->isItemModelDefined($item)) {
         throw new common_exception_Error('No item or itemmodel in ' . __FUNCTION__);
     }
     $lang = empty($lang) ? $lang = $this->getSessionLg() : $lang;
     $itemModel = $item->getUniquePropertyValue($this->itemModelProperty);
     $dataFile = (string) $itemModel->getOnePropertyValue(new core_kernel_classes_Property(TAO_ITEM_MODEL_DATAFILE_PROPERTY));
     if ($this->hasItemContent($item, $lang)) {
         $itemContents = $item->getPropertyValuesByLg($this->itemContentProperty, $lang);
         $itemContent = $itemContents->get(0);
         if (!core_kernel_file_File::isFile($itemContent)) {
             throw new common_Exception('Item ' . $item->getUri() . ' has none file itemContent');
         }
         $file = new core_kernel_versioning_File($itemContent);
         $returnValue = $file->setContent($content);
     } else {
         $repository = $this->getDefaultFileSource();
         $file = $repository->createFile($dataFile, tao_helpers_Uri::getUniqueId($item->getUri()) . DIRECTORY_SEPARATOR . 'itemContent' . DIRECTORY_SEPARATOR . $lang);
         $item->setPropertyValueByLg($this->itemContentProperty, $file->getUri(), $lang);
         $file->setContent($content);
         $returnValue = $file->add(true, true);
     }
     if ($commitMessage != 'HOLD_COMMIT') {
         //hack to control commit or not
         $returnValue = $file->commit($commitMessage);
     }
     return (bool) $returnValue;
 }