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.
This commit is contained in:
Herbert Saal Gutierrez
2012-07-13 11:56:46 -04:00
parent 388f94686d
commit 38930f207f
2 changed files with 46 additions and 9 deletions

View File

@@ -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

View File

@@ -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']);