public function testGetters()
 {
     $this->assertEquals(123, $this->revision->getResourceId());
     $this->assertEquals(456, $this->revision->getVersion());
     $this->assertEquals($this->time, $this->revision->getDateCreated());
     $this->assertEquals("Great author", $this->revision->getAuthorId());
     $this->assertEquals("My message is really cool", $this->revision->getMessage());
 }
 /**
  * (non-PHPdoc)
  * @see \oat\taoRevision\model\Repository::restore()
  */
 public function restore(Revision $revision)
 {
     $lockManager = LockManager::getImplementation();
     $resource = new \core_kernel_classes_Resource($revision->getResourceId());
     if ($lockManager->isLocked($resource)) {
         $userId = \common_session_SessionManager::getSession()->getUser()->getIdentifier();
         $lockManager->releaseLock($resource, $userId);
     }
     return $this->getInner()->restore($revision);
 }
예제 #3
0
 /**
  * (non-PHPdoc)
  * @see \oat\taoRevision\model\Repository::restore()
  */
 public function restore(Revision $revision)
 {
     $resourceId = $revision->getResourceId();
     $data = $this->getStorage()->getData($revision);
     $resource = new \core_kernel_classes_Resource($revision->getResourceId());
     DeleteHelper::deepDelete($resource);
     foreach (CloneHelper::deepCloneTriples($data) as $triple) {
         ModelManager::getModel()->getRdfInterface()->add($triple);
     }
     return true;
 }
예제 #4
0
 /**
  * 
  * @param Revision $revision
  * @param array $data
  * @return boolean
  */
 protected function saveData(Revision $revision, $data)
 {
     $columns = array(self::DATA_RESOURCE, self::DATA_VERSION, self::DATA_SUBJECT, self::DATA_PREDICATE, self::DATA_OBJECT, self::DATA_LANGUAGE);
     $multipleInsertQueryHelper = $this->getPersistence()->getPlatForm()->getMultipleInsertsSqlQueryHelper();
     $query = $multipleInsertQueryHelper->getFirstStaticPart(self::DATA_TABLE_NAME, $columns);
     foreach ($data as $triple) {
         $query .= $multipleInsertQueryHelper->getValuePart(self::DATA_TABLE_NAME, $columns, array(self::DATA_RESOURCE => $this->getPersistence()->quote($revision->getResourceId()), self::DATA_VERSION => $this->getPersistence()->quote($revision->getVersion()), self::DATA_SUBJECT => $this->getPersistence()->quote($triple->subject), self::DATA_PREDICATE => $this->getPersistence()->quote($triple->predicate), self::DATA_OBJECT => $this->getPersistence()->quote($triple->object), self::DATA_LANGUAGE => $this->getPersistence()->quote($triple->lg)));
     }
     $query = substr($query, 0, strlen($query) - 1);
     $query .= $multipleInsertQueryHelper->getEndStaticPart();
     $success = $this->getPersistence()->exec($query);
     return $success;
 }