From 38930f207fa3a95d471e5d1165cd2c4281170515 Mon Sep 17 00:00:00 2001 From: Herbert Saal Gutierrez Date: Fri, 13 Jul 2012 11:56:46 -0400 Subject: [PATCH] BUG-9449 Error in reassign and review of supervisor Error ----- Error in reassign and review of supervisor. This is caused because Solr don't support those views. Solution --------- The filter to use Solr or DB was corrected to use DB in the case of Supervisor views. Also a new exception was created to inform that APP_DATA could not be unserialized, and the logic is not going to stop when an error of unserialization is run in the reindex process. --- workflow/engine/classes/class.AppSolr.php | 53 ++++++++++++++++--- .../engine/methods/cases/proxyCasesList.php | 2 +- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/workflow/engine/classes/class.AppSolr.php b/workflow/engine/classes/class.AppSolr.php index c5d193781..0f40b24a8 100644 --- a/workflow/engine/classes/class.AppSolr.php +++ b/workflow/engine/classes/class.AppSolr.php @@ -66,7 +66,7 @@ class InvalidIndexSearchTextException extends Exception * @author Herbert Saal Gutierrez * * @category Colosa - * @copyright Copyright (c) 2005-2011 Colosa Inc. (http://www.colosa.com) + * @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com) */ class ApplicationWithoutDelegationRecordsException extends Exception { @@ -85,6 +85,31 @@ class ApplicationWithoutDelegationRecordsException extends Exception } } +/** + * Application APP_DATA could not be unserialized exception + * + * @author Herbert Saal Gutierrez + * + * @category Colosa + * @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com) + */ +class ApplicationAPP_DATAUnserializeException extends Exception +{ + // Redefine the exception so message isn't optional + public function __construct($message, $code = 0) + { + // some code + // make sure everything is assigned properly + parent::__construct ($message, $code); + } + + // custom string representation of object + public function __toString() + { + return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; + } +} + /** * Implementation to display application data in the PMOS2 grids using Solr * search service @@ -1015,11 +1040,23 @@ class AppSolr $unassignedUsers = $result [11]; $unassignedGroups = $result [12]; - // create document - $xmlDoc .= $this->buildSearchIndexDocumentPMOS2 ($documentInformation, $dynaformFieldTypes, - $lastUpdateDate, $maxPriority, $assignedUsers, $assignedUsersRead, $assignedUsersUnread, - $draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser, - $unassignedUsers, $unassignedGroups); + try { + // create document + $xmlDoc .= $this->buildSearchIndexDocumentPMOS2 ($documentInformation, $dynaformFieldTypes, + $lastUpdateDate, $maxPriority, $assignedUsers, $assignedUsersRead, $assignedUsersUnread, + $draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser, + $unassignedUsers, $unassignedGroups); + } + catch ( ApplicationAPP_DATAUnserializeException $e ) { + // exception trying to get application information + + //print $e->message +" \n"; + //$fh = fopen("./UnserializeError_APP_DATA".".txt", 'a') or die("can't open file"); + //fwrite($fh, $e->message . "\n"); + //fclose($fh); + // skip and continue with the next application + continue; + } } @@ -1288,7 +1325,7 @@ class AppSolr if (! $UnSerializedCaseData) { // error unserializing - throw new Exception ("Unserialize APP_DATA error. APP_UID: " . $documentData ['APP_UID']); + throw new ApplicationAPP_DATAUnserializeException ("Could not unserialize APP_DATA of APP_UID: " . $documentData ['APP_UID']); } else { foreach ($UnSerializedCaseData as $k => $value) { @@ -1390,7 +1427,7 @@ class AppSolr } } } // foreach unserialized data - } + }// else unserialize APP_DATA } // empty APP_DATA $writer->endElement (); // end /doc diff --git a/workflow/engine/methods/cases/proxyCasesList.php b/workflow/engine/methods/cases/proxyCasesList.php index 752de4556..2fa87d258 100755 --- a/workflow/engine/methods/cases/proxyCasesList.php +++ b/workflow/engine/methods/cases/proxyCasesList.php @@ -22,7 +22,7 @@ try { $userUid = (isset ( $_SESSION ['USER_LOGGED'] ) && $_SESSION ['USER_LOGGED'] != '') ? $_SESSION ['USER_LOGGED'] : null; - if ((($solrConf = System::solrEnv()) !== false) && $action != 'paused') { + if (($action == 'todo' || $action == 'draft' || $action == 'sent' || $action == 'selfservice' || $action == 'unassigned' || $action == 'search') && (($solrConf = System::solrEnv()) !== false)) { G::LoadClass ( 'AppSolr' ); $ApplicationSolrIndex = new AppSolr ($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);