Source for file QueryManager.php

Documentation is available at QueryManager.php

  1. <?php
  2. /**
  3.  * 
  4.  * This interface encapsulates methods for the management of search queries.
  5.  * Provides methods for the creation and retrieval of search queries.
  6.  * @author
  7.  * @version 1.0
  8.  * 
  9.  */
  10. class QueryManager {
  11.     private $pm;
  12.     private $workspace;
  13.     
  14.     /**
  15.      * 
  16.      * Creates a new QueryManager object, given an active PersistenceManager.
  17.      * @param generic $pm the active PersistenceManager.
  18.      * 
  19.      */
  20.     public function __construct(&$pm{
  21.         $this->pm =$pm;
  22.         
  23.         $this->workspace $pm->getWorkspace();
  24.     }
  25.     
  26.     /**
  27.      * 
  28.      * Creates a new query by specifying the query statement itself.
  29.      * It is generic enough where people can come up with their own query implemenation.
  30.      * If the query statement is syntactically invalid, an InvalidQueryException is thrown.
  31.      * @param string $statement the parameter containing the query statement.
  32.      * @return Query a Query object.
  33.      * 
  34.      */
  35.     public function createQuery($statement{
  36.         return new Query($this->pm$statement);
  37.     }
  38.     
  39.     /**
  40.      * 
  41.      * Retrieves an existing persistent query.
  42.      * If node is not a valid persisted query, an InvalidQueryException is thrown.
  43.      * Persistent queries are created by first using QueryManager->createQuery to create a Query object and then calling Query->storeAsNode to persist the query to a location in the workspace.
  44.      * @param Node $node a persisted query.
  45.      * @return Query a Query object.
  46.      * 
  47.      */
  48.     public function getQuery(Node $node{
  49.         Log4PCR::info("Requested query: $this->workspace=>$node->getPath());
  50.         
  51.         return new Query($this->pmunserialize(base64_decode($node->getProperty('pcr:statement')->getValue())));
  52.     }
  53. }
  54.  
  55. ?>

Documentation generated on Sun, 04 Oct 2009 07:13:12 +0800 by phpDocumentor 1.4.3