Exemplo n.º 1
0
 /**
  * @overrides get() from RestResource
  */
 public function get()
 {
     if (parent::get() !== false) {
         $pars = $this->_pars;
         $res = new RestAppHistoryItem($this->_pars, $this);
         $res->startLogging($this->_logfile);
         $xml = $res->get();
         if ($xml != '') {
             $xml = new SimpleXMLElement(strval($xml->finalize()));
             $xml = $xml->xpath('//history:oldvalue/application:application');
             if (count($xml) > 0) {
                 $this->_pars['routeXslt'] = 'applications';
                 $xml = RestAPIHelper::wrapResponse($xml[0]->asXML());
                 $this->_pars['data'] = $xml;
                 $res = new RestAppList($this->_pars);
                 $res->startLogging($this->_logfile);
                 $ret = $res->post("rollback");
                 if ($res->getError() !== RestErrorEnum::RE_OK) {
                     $this->setError($res->getError());
                 }
                 return $ret;
             } else {
                 $this->setError(RestErrorEnum::RE_BACKEND_ERROR);
                 return false;
             }
         } else {
             if ($res->getError() !== RestErrorEnum::RE_OK) {
                 $this->setError($res->getError());
             } else {
                 $this->setError(RestErrorEnum::RE_BACKEND_ERROR);
             }
             return false;
         }
     } else {
         return false;
     }
 }