server/src/app/Libraries/RdfModel/RdfModelResource.php
changeset 277 bd4bc1db4f40
parent 28 b0b56e0f8c7f
equal deleted inserted replaced
276:ef32bf573d9c 277:bd4bc1db4f40
    16 
    16 
    17     protected $deltaList = [];
    17     protected $deltaList = [];
    18     protected $currentDelta = null;
    18     protected $currentDelta = null;
    19     protected $uri = null;
    19     protected $uri = null;
    20 
    20 
       
    21     protected function additionalDeltaLists() {
       
    22         return [];
       
    23     }
       
    24 
    21     public function isDirty() {
    25     public function isDirty() {
    22         return !is_null($this->deltaList) && count($this->deltaList)>0;
    26         return $this->deltaCount()>0;
    23     }
    27     }
    24 
    28 
    25     public function deltaCount() {
    29     public function deltaCount() {
    26         return is_null($this->deltaList)?0:count($this->deltaList);
    30         $deltaList = $this->getDeltaList();
       
    31         return is_null($deltaList)?0:count($deltaList);
    27     }
    32     }
    28 
    33 
    29     public function getDeltaList() {
    34     public function getDeltaList() {
    30         return $this->deltaList;
    35         $deltaList = is_null($this->deltaList)?[]:$this->deltaList;
       
    36         $additionalDeltaLists = $this->additionalDeltaLists();
       
    37         if(!empty($additionalDeltaLists)) {
       
    38             array_unshift($additionalDeltaLists, $deltaList);
       
    39             $deltaList = call_user_func_array('array_merge', $additionalDeltaLists);
       
    40         }
       
    41         return $deltaList;
    31     }
    42     }
    32 
    43 
    33     public function getUri() {
    44     public function getUri() {
    34         return $this->uri;
    45         return $this->uri;
    35     }
    46     }
    36 
    47 
    37     public function getCurrentDelta() {
    48     public function getCurrentDelta() {
    38         return $this->getCurrentDelta;
    49         return $this->currentDelta;
    39     }
    50     }
    40 
    51 
    41     public function startDelta() {
    52     public function startDelta() {
    42         $this->currentDelta = new RdfModelDelta($this->getGraph()->getUri());
    53         $this->currentDelta = new RdfModelDelta($this->getGraph()->getUri());
    43         array_push($this->deltaList, $this->currentDelta);
    54         array_push($this->deltaList, $this->currentDelta);