コード例 #1
0
 public function execute(TingClientRequestAdapter $adapter)
 {
     $request = new RestJsonTingClientSearchRequest($this->baseUrl);
     $request->setQuery('rec.id=' . $this->id);
     $request->setAgency($this->agency);
     $request->setAllObjects(true);
     $request->setNumResults(1);
     $searchResult = $request->execute($adapter);
     return $searchResult->collections[0];
 }
コード例 #2
0
 public function execute(TingClientRequestAdapter $adapter)
 {
     //getting an object is actually just performing a search using specific indexes
     $request = new RestJsonTingClientSearchRequest($this->baseUrl);
     //Determine which id to use and the corresponding index
     if ($objectId = $this->getObjectId()) {
         $request->setQuery('rec.id=' . $objectId);
     } elseif ($localId = $this->getLocalId()) {
         //Use contains (:) instead of equality (=) as local id is not a complete value
         //TODO: Update to support complete faust numbers (local id and owner id)
         $request->setQuery('rec.id:' . $localId);
     } elseif ($isbn = $this->getISBN()) {
         $request->setQuery('dc.identifier:' . $isbn);
     }
     //transfer agency from object to search request
     if ($agency = $this->getAgency()) {
         $request->setAgency($agency);
     }
     //we only need one object
     $request->setNumResults(1);
     $searchResult = $request->execute($adapter);
     return $searchResult->collections[0]->objects[0];
 }