Files
luos/workflow/engine/classes/model/AppSolrQueue.php
Erik Amaru Ortiz 1a8545df8a BUG 0000 herbert> SOLR implementation in PMOS2
Solr support in PMOS2 includes:
Functionality:
- Implementation of Home views (Inbox, Draft, Participated, Unassigned). The views return fast results.
- Include read, unread, all,  and process filter in inbox View.
- Include process filter in draft view.
- Include started by me, completed by me, all, process, and status filter in participated view.
- Include process filter in unassigned view.
- Improved search functionality (search in user defined variables): Use the following syntax to search in process (user defined) variables. {variable_name}:{search_word} ex1:"causal:20*" where causal is the variable defined by the user.
  + Use of wildcards in search: Use * as wildcard at the begin or end of word
  + Multiple conditions in search: Separate multiple conditions by space ex2:"Materiales causal:20*" means that we are searching for the word Materiales and the causal that begin with 20.
  + Search in dates (interval ): Format=> {variable_date}:[yyyy-mm-dd TO yyyy-mm-dd]
    Local date not UTC date required
    ex: FechaRegistro:[2011-04-15 TO 2011-04-30] //registros con fecha entre el 2011-04-15 y el 2011-04-30.
  + we can use the wildcard *:
    ex: FechaRegistro:[* TO 2011-04-30] //registros con fecha menor o igual a 2011-04-30.
    FechaRegistro:[2011-04-15 TO *] //registros con fecha mayor o igual a 2011-04-15.
  + Search of exact phrases. format: {variable}:"frase a buscar"
    ex: Cliente:"Jesus Marin"

- Application update function.
	+ The function is called every time a change is detected in the application's data including the related delegations.
- Use of cache to improve performance

Not included:
- Order of task, sent by, and due date columns.

Pending:
- Advanced search view using faceted lists.
2012-05-15 10:56:48 -04:00

127 lines
3.9 KiB
PHP

<?php
require_once 'classes/model/om/BaseAppSolrQueue.php';
require_once 'classes/entities/AppSolrQueue.php';
/**
* Skeleton subclass for representing a row from the 'APP_SOLR_QUEUE' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class AppSolrQueue extends BaseAppSolrQueue {
public function exists($sAppUid)
{
try {
$oRow = AppSolrQueuePeer::retrieveByPK( $sAppUid );
if (!is_null($oRow))
{
return true;
}
else {
return false;
}
}
catch (Exception $oError) {
return false;
}
}
public function createUpdate($sAppUid, $iUpdated)
{
$con = Propel::getConnection(AppSolrQueuePeer::DATABASE_NAME);
try
{
if($this->exists($sAppUid)){
$con->begin();
//update record
//$oRow = AppSolrQueuePeer::retrieveByPK( $sAppUid );
//$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
//$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
//set field
$this->setAppUid($sAppUid);
$this->setAppUpdated($iUpdated);
if($this->validate())
{
$result=$this->save();
}
else
{
$con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this)."."));
}
$con->commit();
return $result;
}else{
//create record
//set values
$this->setAppUid($sAppUid);
$this->setAppUpdated($iUpdated);
if($this->validate())
{
$result=$this->save();
}
else
{
$e=new Exception("Failed Validation in class ".get_class($this).".");
//$e->aValidationFailures=$this->getValidationFailures();
throw($e);
}
$con->commit();
return $result;
}
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
}
/**
* Returns the list of updated applications
* array of Entity_AppSolrQueue
*/
public function getListUpdatedApplications(){
$updatedApplications = array();
try
{
$c = new Criteria();
$c->addSelectColumn(AppSolrQueuePeer::APP_UID);
$c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
//"WHERE
$c->add(AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL);
$rs = AppSolrQueuePeer::doSelectRS($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
//echo $c->toString();
$rs->next();
$row = $rs->getRow();
while (is_array($row)) {
$appSolrQueue = Entity_AppSolrQueue::CreateEmpty();
$appSolrQueue->appUid = $row['APP_UID'];
$appSolrQueue->appUpdated = $row['APP_UPDATED'];
$updatedApplications[] = $appSolrQueue;
$rs->next();
$row = $rs->getRow();
}
return $updatedApplications;
}catch(Exception $e){
$con->rollback();
throw($e);
}
}
} // AppSolrQueue