HOR-3670-RG-3 Files review:
workflow/engine/classes/entities/Entity_AppSolrQueue.php workflow/engine/classes/entities/Entity_Base.php workflow/engine/classes/entities/Entity_FacetGroup.php workflow/engine/classes/entities/Entity_FacetInterfaceRequest.php workflow/engine/classes/entities/Entity_FacetInterfaceResult.php workflow/engine/classes/entities/Entity_FacetItem.php workflow/engine/classes/entities/Entity_FacetRequest.php workflow/engine/classes/entities/Entity_FacetResult.php workflow/engine/classes/entities/Entity_SelectedFacetGroupItem.php workflow/engine/classes/entities/Entity_SolrQueryResult.php
This commit is contained in:
@@ -1,12 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invalid search text for Solr exception
|
||||
*
|
||||
* @author Herbert Saal Gutierrez
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation to display application data in the PMOS2 grids using Solr
|
||||
* search service
|
||||
@@ -84,24 +77,8 @@ class AppSolr
|
||||
* @return array return the list of cases
|
||||
*/
|
||||
public function getAppGridData(
|
||||
$userUid,
|
||||
$start = null,
|
||||
$limit = null,
|
||||
$action = null,
|
||||
$filter = null,
|
||||
$search = null,
|
||||
$process = null,
|
||||
$status = null,
|
||||
$type = null,
|
||||
$dateFrom = null,
|
||||
$dateTo = null,
|
||||
$callback = null,
|
||||
$dir = null,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$category = null,
|
||||
$doCount = false
|
||||
$userUid, $start = null, $limit = null, $action = null, $filter = null, $search = null, $process = null, $status = null, $type = null, $dateFrom = null, $dateTo = null, $callback = null, $dir = null, $sort = 'APP_CACHE_VIEW.APP_NUMBER', $category = null, $doCount = false
|
||||
) {
|
||||
|
||||
$callback = isset($callback) ? $callback : 'stcCallback1001';
|
||||
$dir = isset($dir) ? $dir : 'DESC'; // direction of sort column
|
||||
// (ASC, DESC)
|
||||
@@ -143,8 +120,7 @@ class AppSolr
|
||||
$result ['message'] = "Error description.";
|
||||
|
||||
try {
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->initTimeAll = microtime(true);
|
||||
}
|
||||
|
||||
@@ -237,12 +213,10 @@ class AppSolr
|
||||
if ($filter == 'read') {
|
||||
$solrSearchText .= "APP_ASSIGNED_USERS_READ:" . $userUid . " AND ";
|
||||
$delegationIndexes[] = "APP_ASSIGNED_USER_READ_DEL_INDEX_" . trim($userUid) . '_txt';
|
||||
}
|
||||
elseif ($filter == 'unread') {
|
||||
} elseif ($filter == 'unread') {
|
||||
$solrSearchText .= "APP_ASSIGNED_USERS_UNREAD:" . $userUid . " AND ";
|
||||
$delegationIndexes[] = "APP_ASSIGNED_USER_UNREAD_DEL_INDEX_" . trim($userUid) . '_txt';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$solrSearchText .= "APP_ASSIGNED_USERS:" . $userUid . " AND ";
|
||||
$delegationIndexes[] = "APP_ASSIGNED_USER_DEL_INDEX_" . trim($userUid) . '_txt';
|
||||
}
|
||||
@@ -252,12 +226,10 @@ class AppSolr
|
||||
if ($filter == 'started') {
|
||||
$solrSearchText .= "APP_PARTICIPATED_USERS_STARTED:" . $userUid . " AND ";
|
||||
$delegationIndexes[] = "APP_PARTICIPATED_USER_STARTED_DEL_INDEX_" . trim($userUid) . '_txt';
|
||||
}
|
||||
elseif ($filter == 'completed') {
|
||||
} elseif ($filter == 'completed') {
|
||||
$solrSearchText .= "APP_PARTICIPATED_USERS_COMPLETED:" . $userUid . " AND ";
|
||||
$delegationIndexes[] = "APP_PARTICIPATED_USER_COMPLETED_DEL_INDEX_" . trim($userUid) . '_txt';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$solrSearchText .= "APP_PARTICIPATED_USERS:" . $userUid . " AND ";
|
||||
//$delegationIndexes[] = "APP_PARTICIPATED_USER_DEL_INDEX_" . trim ($userUid) . '_txt';
|
||||
//show the last index of the case
|
||||
@@ -283,9 +255,10 @@ class AppSolr
|
||||
}
|
||||
|
||||
// remove last OR in condition
|
||||
if ($solrSearchText != '')
|
||||
if ($solrSearchText != '') {
|
||||
$solrSearchText = substr_replace($solrSearchText, "", - 4);
|
||||
}
|
||||
}
|
||||
$solrSearchText .= ") AND ";
|
||||
|
||||
$delegationIndexes[] = "APP_UNASSIGNED_USER_GROUP_DEL_INDEX_" . trim($userUid) . '_txt';
|
||||
@@ -321,12 +294,14 @@ class AppSolr
|
||||
}
|
||||
|
||||
// remove last AND in condition
|
||||
if ($solrSearchText != '')
|
||||
if ($solrSearchText != '') {
|
||||
$solrSearchText = substr_replace($solrSearchText, "", - 5);
|
||||
}
|
||||
|
||||
// add parenthesis to Solr search text
|
||||
if ($solrSearchText != "")
|
||||
if ($solrSearchText != "") {
|
||||
$solrSearchText = "(" . $solrSearchText . ")";
|
||||
}
|
||||
|
||||
// create query string, add query conditions
|
||||
if ($search != '') {
|
||||
@@ -334,11 +309,13 @@ class AppSolr
|
||||
// return exception in case of invalid text
|
||||
$search = $this->getSearchText($search);
|
||||
|
||||
if ($solrSearchText != "" && $search != "")
|
||||
if ($solrSearchText != "" && $search != "") {
|
||||
$solrSearchText .= " AND ";
|
||||
if ($search != "")
|
||||
}
|
||||
if ($search != "") {
|
||||
$solrSearchText .= "(" . $search . ")";
|
||||
}
|
||||
}
|
||||
// add del_index dynamic fields to list of resulting columns
|
||||
$columsToIncludeFinal = array();
|
||||
$columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
|
||||
@@ -365,13 +342,12 @@ class AppSolr
|
||||
'includeCols' => $columsToIncludeFinal,
|
||||
'resultFormat' => 'json'
|
||||
);
|
||||
$solrRequestData = Entity_SolrRequestData::createForRequestPagination ($data);
|
||||
$solrRequestData = EntitySolrRequestData::createForRequestPagination($data);
|
||||
// use search index to return list of cases
|
||||
$searchIndex = new BpmnEngineServicesSearchIndex($this->_solrIsEnabled, $this->_solrHost);
|
||||
// execute query
|
||||
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->afterSolrQueryTime = microtime(true);
|
||||
}
|
||||
//return inmediatelly
|
||||
@@ -423,7 +399,6 @@ class AppSolr
|
||||
$result ['totalCount'] = $solrQueryResult->iTotalDisplayRecords;
|
||||
|
||||
//var_dump($solrQueryResult->aaData); die;
|
||||
|
||||
//get the missing data from database
|
||||
$appUids = array();
|
||||
foreach ($solrQueryResult->aaData as $i => $data) {
|
||||
@@ -432,8 +407,7 @@ class AppSolr
|
||||
|
||||
$aaappsDBData = $this->getListApplicationDelegationData($appUids);
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->afterDbQueryTime = microtime(true);
|
||||
}
|
||||
//****************************************************************
|
||||
@@ -476,8 +450,7 @@ class AppSolr
|
||||
$delIndexes[] = $aaappsDBData [$index]['DEL_INDEX'];
|
||||
}
|
||||
|
||||
}*/
|
||||
else {
|
||||
} */ else {
|
||||
//error an index must always be defined
|
||||
print date('Y-m-d H:i:s:u') . " Delegation not defined\n";
|
||||
}
|
||||
@@ -533,8 +506,7 @@ class AppSolr
|
||||
$row = $aaappsDBData [$index];
|
||||
}
|
||||
|
||||
if (empty($row))
|
||||
{
|
||||
if (empty($row)) {
|
||||
$fh = fopen("SolrAppWithoutDelIndex.txt", 'a') or die("can't open file to store Solr search time.");
|
||||
fwrite($fh, sprintf("Solr AppUid: %s DelIndex: %s not found.\r\n", $appUID, $delIndex));
|
||||
fclose($fh);
|
||||
@@ -572,7 +544,6 @@ class AppSolr
|
||||
|
||||
$rows [] = $aRow;
|
||||
}
|
||||
|
||||
}
|
||||
$result ['data'] = $rows;
|
||||
$result ['success'] = true;
|
||||
@@ -582,8 +553,7 @@ class AppSolr
|
||||
//var_dump($result);
|
||||
|
||||
/* * ****************************************** */
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->afterPrepareResultTime = microtime(true);
|
||||
|
||||
$fh = fopen("SolrSearchTime.txt", 'a') or die("can't open file to store Solr search time.");
|
||||
@@ -594,7 +564,6 @@ class AppSolr
|
||||
/* * ************************************ */
|
||||
|
||||
return $result;
|
||||
|
||||
} // end try
|
||||
catch (InvalidIndexSearchTextException $ex) {
|
||||
// return empty result with description of error
|
||||
@@ -619,23 +588,18 @@ class AppSolr
|
||||
$casesCount = array();
|
||||
|
||||
// get number of records in todo list
|
||||
$data = $this->getAppGridData ($userUid, 0, 0, 'todo', null, null, null, null, null,
|
||||
null, null, null, null, null, null, true);
|
||||
$data = $this->getAppGridData($userUid, 0, 0, 'todo', null, null, null, null, null, null, null, null, null, null, null, true);
|
||||
$casesCount ['to_do'] = $data ['totalCount'];
|
||||
// get number of records in participated list
|
||||
$data = $this->getAppGridData ($userUid, 0, 0, 'sent', null, null, null, null, null,
|
||||
null, null, null, null, null, null, true);
|
||||
$data = $this->getAppGridData($userUid, 0, 0, 'sent', null, null, null, null, null, null, null, null, null, null, null, true);
|
||||
$casesCount ['sent'] = $data ['totalCount'];
|
||||
// get number of records in draft list
|
||||
$data = $this->getAppGridData ($userUid, 0, 0, 'draft', null, null, null, null, null,
|
||||
null, null, null, null, null, null, true);
|
||||
$data = $this->getAppGridData($userUid, 0, 0, 'draft', null, null, null, null, null, null, null, null, null, null, null, true);
|
||||
$casesCount ['draft'] = $data ['totalCount'];
|
||||
// get number of records in unassigned list
|
||||
$data = $this->getAppGridData ($userUid, 0, 0, 'unassigned', null, null, null, null,
|
||||
null, null, null, null, null, null, null, true);
|
||||
$data = $this->getAppGridData($userUid, 0, 0, 'unassigned', null, null, null, null, null, null, null, null, null, null, null, true);
|
||||
$casesCount ['selfservice'] = $data ['totalCount'];
|
||||
$data = $this->getAppGridData ($userUid, 0, 0, 'paused', null, null, null, null,
|
||||
null, null, null, null, null, null, null, true);
|
||||
$data = $this->getAppGridData($userUid, 0, 0, 'paused', null, null, null, null, null, null, null, null, null, null, null, true);
|
||||
$casesCount ['paused'] = $data ['totalCount'];
|
||||
|
||||
return $casesCount;
|
||||
@@ -662,7 +626,6 @@ class AppSolr
|
||||
*/
|
||||
public function getListApplicationDelegationData($aappUIDs)
|
||||
{
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addSelectColumn(ApplicationPeer::APP_CREATE_DATE);
|
||||
@@ -779,7 +742,6 @@ class AppSolr
|
||||
*/
|
||||
public function getAppDelegationData($appUID, $delIndex)
|
||||
{
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addSelectColumn(AppDelegationPeer::APP_UID);
|
||||
@@ -901,7 +863,6 @@ class AppSolr
|
||||
// ex: date search => APP_CREATE_DATE:[2012-03-12T00:00:00Z TO
|
||||
// 2012-04-12T00:00:00Z]
|
||||
// ex: phrase => TEXT:"This is a lazy dog"
|
||||
|
||||
// search the first
|
||||
|
||||
$searchIndex = new BpmnEngineServicesSearchIndex($this->_solrIsEnabled, $this->_solrHost);
|
||||
@@ -925,8 +886,7 @@ class AppSolr
|
||||
// no field found
|
||||
$formattedSearchText .= $tok; // used to search in the general default
|
||||
// text field
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// it's a field
|
||||
// verify if is complete
|
||||
if ($fieldName == "" || $searchText == ":") {
|
||||
@@ -939,8 +899,7 @@ class AppSolr
|
||||
$indexFieldName = "";
|
||||
if (array_key_exists($fieldName, $ListFieldsInfo)) {
|
||||
$indexFieldName = $ListFieldsInfo [$fieldName];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// no field name found
|
||||
// don't include field search
|
||||
// return message about it
|
||||
@@ -958,18 +917,15 @@ class AppSolr
|
||||
// the end of
|
||||
// the
|
||||
// phrase
|
||||
|
||||
// the phrase is complete?
|
||||
if ($searchText [1] == "[" && $searchText [strlen($searchText) - 1] == "]") {
|
||||
// complete phrase ok, the date must be validated
|
||||
// throw new InvalidIndexSearchTextException("Invalid search text.
|
||||
// Expected date interval format =>
|
||||
// {variable_name}:[YYYY-MM-DDThh:mm:ssZ TO YYYY-MM-DDThh:mm:ssZ]");
|
||||
}
|
||||
elseif ($searchText [1] == "\"" && $searchText [strlen ($searchText) - 1] == "\"") {
|
||||
} elseif ($searchText [1] == "\"" && $searchText [strlen($searchText) - 1] == "\"") {
|
||||
// the phrase is complete and is ok.
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// search end of phrase
|
||||
$tok = strtok(" ");
|
||||
$found = false;
|
||||
@@ -979,8 +935,7 @@ class AppSolr
|
||||
$found = true;
|
||||
$searchText .= " " . $tok;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// continue adding text
|
||||
$searchText .= " " . $tok;
|
||||
}
|
||||
@@ -1072,8 +1027,9 @@ class AppSolr
|
||||
$includeToken = true;
|
||||
}
|
||||
|
||||
if ($includeToken)
|
||||
if ($includeToken) {
|
||||
$formattedSearchText .= " AND ";
|
||||
}
|
||||
|
||||
// next token
|
||||
$tok = strtok(" ");
|
||||
@@ -1115,10 +1071,8 @@ class AppSolr
|
||||
//Propel::close();
|
||||
|
||||
return $delIndexes;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the information of the specified applications in Solr
|
||||
*
|
||||
@@ -1128,11 +1082,11 @@ class AppSolr
|
||||
*/
|
||||
public function updateApplicationSearchIndex($aaAPPUIDs, $saveDBRecord = false)
|
||||
{
|
||||
if (empty ($aaAPPUIDs))
|
||||
if (empty($aaAPPUIDs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
//show app to reindex
|
||||
var_dump($aaAPPUIDs);
|
||||
}
|
||||
@@ -1146,8 +1100,7 @@ class AppSolr
|
||||
);
|
||||
}
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
//show app to reindex
|
||||
var_dump($aaAPPUIDs);
|
||||
}
|
||||
@@ -1174,21 +1127,18 @@ class AppSolr
|
||||
} */
|
||||
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->getApplicationDataDBTime = 0;
|
||||
$this->getPreparedApplicationDataDBTime = 0;
|
||||
$this->getBuilXMLDocTime = 0;
|
||||
$this->afterUpdateSolrXMLDocTime = 0;
|
||||
|
||||
$this->beforeCreateSolrXMLDocTime = microtime(true);
|
||||
|
||||
}
|
||||
// create XML document
|
||||
$xmlDoc = $this->createSolrXMLDocument($aaAPPUIDs);
|
||||
|
||||
if($this->debug )
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->afterCreateSolrXMLDocTime = microtime(true);
|
||||
}
|
||||
// update document
|
||||
@@ -1196,14 +1146,13 @@ class AppSolr
|
||||
'workspace' => $this->_solrInstance,
|
||||
'document' => $xmlDoc
|
||||
);
|
||||
$oSolrUpdateDocument = Entity_SolrUpdateDocument::createForRequest ($data);
|
||||
$oSolrUpdateDocument = EntitySolrUpdateDocument::createForRequest($data);
|
||||
|
||||
$oSearchIndex = new BpmnEngineServicesSearchIndex($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
$oSearchIndex->updateIndexDocument($oSolrUpdateDocument);
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->afterUpdateSolrXMLDocTime = microtime(true);
|
||||
}
|
||||
// commit changes no required because of the commitwithin option
|
||||
@@ -1214,9 +1163,7 @@ class AppSolr
|
||||
$this->applicationChangedUpdateSolrQueue($aAPPUID ['APP_UID'], 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch(Exception $ex) {
|
||||
} catch (Exception $ex) {
|
||||
//echo $ex->getMessage();
|
||||
//echo $ex->getTraceAsString();
|
||||
$appuidsString = " ";
|
||||
@@ -1230,8 +1177,7 @@ class AppSolr
|
||||
fwrite($fh, date('Y-m-d H:i:s:u') . ":" . $appuidsString . $ex->getMessage() . "\r\n");
|
||||
fclose($fh);
|
||||
}
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
|
||||
//$this->afterCommitSolrDocTime = microtime (true);
|
||||
|
||||
@@ -1242,15 +1188,7 @@ class AppSolr
|
||||
$this->totalTimeAcumulated += ($this->afterUpdateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime);
|
||||
|
||||
//Solr App trunk size| Get Data from DB (s)| Prepare DB data (s) | Create XML file (s)| Create XML Document total (s)| Update Solr Document (s)
|
||||
fwrite($fh, sprintf("%s|%s|%s|%s|%s|%s|%s|%s\r\n",
|
||||
$this->trunkSizeAcumulated,
|
||||
$this->totalTimeAcumulated,
|
||||
$this->getApplicationDataDBTime,
|
||||
$this->getPreparedApplicationDataDBTime,
|
||||
$this->getBuilXMLDocTime,
|
||||
($this->afterCreateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime),
|
||||
($this->afterUpdateSolrXMLDocTime - $this->afterCreateSolrXMLDocTime),
|
||||
($this->afterUpdateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime)
|
||||
fwrite($fh, sprintf("%s|%s|%s|%s|%s|%s|%s|%s\r\n", $this->trunkSizeAcumulated, $this->totalTimeAcumulated, $this->getApplicationDataDBTime, $this->getPreparedApplicationDataDBTime, $this->getBuilXMLDocTime, ($this->afterCreateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime), ($this->afterUpdateSolrXMLDocTime - $this->afterCreateSolrXMLDocTime), ($this->afterUpdateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime)
|
||||
));
|
||||
|
||||
fclose($fh);
|
||||
@@ -1264,7 +1202,6 @@ class AppSolr
|
||||
fwrite($fh, sprintf("APP range => Get Data from DB (s): %s, Prepare DB data (s): %s, Create XML file(s): %s \r\n",
|
||||
$this->getApplicationDataDBTime, $this->getPreparedApplicationDataDBTime, $this->getBuilXMLDocTime ));
|
||||
fclose($fh); */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1276,8 +1213,9 @@ class AppSolr
|
||||
*/
|
||||
public function deleteApplicationSearchIndex($aaAPPUIDs, $saveDBRecord = false)
|
||||
{
|
||||
if (empty ($aaAPPUIDs))
|
||||
if (empty($aaAPPUIDs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!is_array($aaAPPUIDs)) {
|
||||
@@ -1307,14 +1245,12 @@ class AppSolr
|
||||
} */
|
||||
|
||||
try {
|
||||
|
||||
$oSearchIndex = new BpmnEngineServicesSearchIndex($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
foreach ($aaAPPUIDs as $aAPPUID) {
|
||||
$idQuery = "APP_UID:" . $aAPPUID ['APP_UID'];
|
||||
|
||||
$oSearchIndex->deleteDocumentFromIndex($this->_solrInstance, $idQuery);
|
||||
|
||||
}
|
||||
|
||||
if ($saveDBRecord) {
|
||||
@@ -1322,8 +1258,7 @@ class AppSolr
|
||||
$this->applicationChangedUpdateSolrQueue($aAPPUID ['APP_UID'], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception $ex) {
|
||||
} catch (Exception $ex) {
|
||||
//register all the appuids that can't be indexed
|
||||
$appuidsString = " ";
|
||||
foreach ($aaAPPUIDs as $aAPPUID) {
|
||||
@@ -1351,8 +1286,7 @@ class AppSolr
|
||||
*/
|
||||
public function createSolrXMLDocument($aaAPPUIDs)
|
||||
{
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->getApplicationDataDBTime = 0;
|
||||
$this->getPreparedApplicationDataDBTime = 0;
|
||||
$this->getBuilXMLDocTime = 0;
|
||||
@@ -1366,22 +1300,18 @@ class AppSolr
|
||||
foreach ($aaAPPUIDs as $aAPPUID) {
|
||||
$aAPPUIDs[] = $aAPPUID ['APP_UID'];
|
||||
}
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->beforeGetApplicationDataDBTime = microtime(true);
|
||||
}
|
||||
$aaAllAppDelData = $this->getListApplicationUpdateDelegationData($aAPPUIDs);
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->afterGetApplicationDataDBTime = microtime(true);
|
||||
|
||||
$this->getApplicationDataDBTime = $this->afterGetApplicationDataDBTime - $this->beforeGetApplicationDataDBTime;
|
||||
}
|
||||
foreach ($aaAPPUIDs as $aAPPUID) {
|
||||
try {
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->beforePrepareApplicationDataDBTime = microtime(true);
|
||||
}
|
||||
//filter data, include all the rows of the application
|
||||
@@ -1398,29 +1328,24 @@ class AppSolr
|
||||
|
||||
$result = $this->getApplicationIndexData($aAPPUID ['APP_UID'], $aaAppData);
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->afterPrepareApplicationDataDBTime = microtime(true);
|
||||
|
||||
$this->getPreparedApplicationDataDBTime += $this->afterPrepareApplicationDataDBTime - $this->beforePrepareApplicationDataDBTime;
|
||||
}
|
||||
|
||||
}
|
||||
catch ( ApplicationWithoutDelegationRecordsException $ex ) {
|
||||
} catch (ApplicationWithoutDelegationRecordsException $ex) {
|
||||
// exception trying to get application information
|
||||
// skip and continue with the next application
|
||||
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
|
||||
fwrite($fh, date('Y-m-d H:i:s:u') . " " . $ex->getMessage());
|
||||
fclose($fh);
|
||||
continue;
|
||||
}
|
||||
catch( ApplicationWithCorruptDynaformException $ex) {
|
||||
} catch (ApplicationWithCorruptDynaformException $ex) {
|
||||
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
|
||||
fwrite($fh, date('Y-m-d H:i:s:u') . " " . $ex->getMessage());
|
||||
fclose($fh);
|
||||
continue;
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
} catch (Exception $ex) {
|
||||
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
|
||||
fwrite($fh, date('Y-m-d H:i:s:u') . " " . "getApplicationIndexData " . $aAPPUID['APP_UID'] . ":" . $ex->getMessage() . "\n");
|
||||
fclose($fh);
|
||||
@@ -1459,47 +1384,37 @@ class AppSolr
|
||||
try {
|
||||
|
||||
// create document
|
||||
$xmlCurrentDoc = $this->buildSearchIndexDocumentPMOS2 ($documentInformation, $dynaformFieldTypes,
|
||||
$lastUpdateDate, $maxPriority, $delLastIndex, $assignedUsers, $assignedUsersRead, $assignedUsersUnread,
|
||||
$draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser,
|
||||
$unassignedUsers, $unassignedGroups,$pausedtUser);
|
||||
$xmlCurrentDoc = $this->buildSearchIndexDocumentPMOS2($documentInformation, $dynaformFieldTypes, $lastUpdateDate, $maxPriority, $delLastIndex, $assignedUsers, $assignedUsersRead, $assignedUsersUnread, $draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser, $unassignedUsers, $unassignedGroups, $pausedtUser);
|
||||
|
||||
//concat doc to the list of docs
|
||||
$xmlDoc .= $xmlCurrentDoc;
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
if ($this->debug) {
|
||||
$this->afterBuilXMLDocTime = microtime(true);
|
||||
|
||||
$this->getBuilXMLDocTime += $this->afterBuilXMLDocTime - $this->afterPrepareApplicationDataDBTime;
|
||||
}
|
||||
}
|
||||
catch ( ApplicationAppDataUnserializeException $ex ) {
|
||||
} catch (ApplicationAppDataUnserializeException $ex) {
|
||||
// exception trying to get application information
|
||||
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
|
||||
fwrite($fh, date('Y-m-d H:i:s:u') . " " . $ex->getMessage());
|
||||
fclose($fh);
|
||||
// skip and continue with the next application
|
||||
continue;
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
} catch (Exception $ex) {
|
||||
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
|
||||
fwrite($fh, date('Y-m-d H:i:s:u') . " " . "buildSearchIndexDocumentPMOS2 " . $aAPPUID['APP_UID'] . ":" . $ex->getMessage() . "\n");
|
||||
fclose($fh);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($this->debugAppInfo)
|
||||
{
|
||||
if ($this->debugAppInfo) {
|
||||
$fh = fopen("SolrAPPUIDIndexSize.txt", 'a') or die("can't open file to store Solr index time.");
|
||||
//fwrite($fh, sprintf("APP UID %s => doc size: %s\r\n",
|
||||
// $aAPPUID['APP_UID'], strlen($xmlCurrentDoc)));
|
||||
fwrite($fh, sprintf("%s|%s|%s\r\n",
|
||||
$documentInformation ['APP_NUMBER'], $aAPPUID['APP_UID'], strlen($xmlCurrentDoc)));
|
||||
fwrite($fh, sprintf("%s|%s|%s\r\n", $documentInformation ['APP_NUMBER'], $aAPPUID['APP_UID'], strlen($xmlCurrentDoc)));
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
|
||||
}//End foreach APPUID
|
||||
|
||||
$xmlDoc .= "</add>\n";
|
||||
@@ -1559,10 +1474,7 @@ class AppSolr
|
||||
* $participatedUsersCompletedByUser,
|
||||
* $unassignedUsers, $unassignedGroups);*
|
||||
*/
|
||||
public function buildSearchIndexDocumentPMOS2($documentData, $dynaformFieldTypes, $lastUpdateDate,
|
||||
$maxPriority, $delLastIndex, $assignedUsers, $assignedUsersRead, $assignedUsersUnread, $draftUser,
|
||||
$participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser,
|
||||
$unassignedUsers, $unassignedGroups,$pausedtUser)
|
||||
public function buildSearchIndexDocumentPMOS2($documentData, $dynaformFieldTypes, $lastUpdateDate, $maxPriority, $delLastIndex, $assignedUsers, $assignedUsersRead, $assignedUsersUnread, $draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser, $unassignedUsers, $unassignedGroups, $pausedtUser)
|
||||
{
|
||||
// build xml document
|
||||
|
||||
@@ -1597,8 +1509,7 @@ class AppSolr
|
||||
$writer->writeAttribute('name', 'APP_TITLE');
|
||||
$writer->text($documentData ['APP_TITLE']);
|
||||
$writer->endElement();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$writer->startElement("field");
|
||||
$writer->writeAttribute('name', 'APP_TITLE');
|
||||
$writer->text("");
|
||||
@@ -1610,9 +1521,7 @@ class AppSolr
|
||||
$writer->writeAttribute('name', 'APP_PRO_TITLE');
|
||||
$writer->text($documentData ['PRO_TITLE']);
|
||||
$writer->endElement();
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$writer->startElement("field");
|
||||
$writer->writeAttribute('name', 'APP_PRO_TITLE');
|
||||
$writer->text("");
|
||||
@@ -1662,7 +1571,6 @@ class AppSolr
|
||||
$writer->writeAttribute('name', 'APP_ASSIGNED_USER_DEL_INDEX_' . trim($userUID ['USR_UID']) . '_txt');
|
||||
$writer->text($userUID ['DEL_INDEX']);
|
||||
$writer->endElement();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1793,7 +1701,6 @@ class AppSolr
|
||||
|
||||
// get the serialized fields
|
||||
if (!empty($documentData ['APP_DATA']) && $documentData ['APP_DATA'] != "N;") {
|
||||
|
||||
$UnSerializedCaseData = unserialize($documentData ['APP_DATA']);
|
||||
|
||||
if ($UnSerializedCaseData === false) {
|
||||
@@ -1804,8 +1711,7 @@ class AppSolr
|
||||
if (!$UnSerializedCaseData) {
|
||||
// error unserializing
|
||||
throw new ApplicationAppDataUnserializeException(date('Y-m-d H:i:s:u') . " Could not unserialize APP_DATA of APP_UID: " . $documentData ['APP_UID'] . "\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
foreach ($UnSerializedCaseData as $k => $value) {
|
||||
//This validation is only for the 'checkbox' control for the BPMN forms,
|
||||
//the request is not made to the database to obtain the control
|
||||
@@ -1826,8 +1732,7 @@ class AppSolr
|
||||
if (intval($value) > 2147483647) {
|
||||
$typeSufix = '_tl'; //for long values
|
||||
$value = intval($value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$typeSufix = '_ti';
|
||||
$value = str_replace(',', '', $value);
|
||||
$value = intval($value);
|
||||
@@ -1855,8 +1760,7 @@ class AppSolr
|
||||
$newdate = strtotime($value);
|
||||
if (!$newdate) {
|
||||
$typeSufix = '*'; // not store field
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$typeSufix = '_tdt';
|
||||
/*
|
||||
* if ($withHour) //$value = gmdate ( "Y-m-d\TH:i:s\Z",
|
||||
@@ -1932,8 +1836,7 @@ class AppSolr
|
||||
$writer->endCData();
|
||||
$writer->endElement();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$value = trim($value);
|
||||
$pairs = array(
|
||||
"\x03" => "",
|
||||
@@ -2019,8 +1922,7 @@ class AppSolr
|
||||
if ($index2 == null) {
|
||||
// get the last priority
|
||||
$maxPriority = $allAppDbData [$index] ['DEL_PRIORITY'];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$maxPriority = $allAppDbData [$index2] ['DEL_PRIORITY'];
|
||||
}
|
||||
|
||||
@@ -2176,7 +2078,6 @@ class AppSolr
|
||||
// store in cache
|
||||
//$oMemcache->set ("SOLR_UNASSIGNED_USERS_GROUPS_" . $allAppDbData [$index] ['PRO_UID'] . "_" . $allAppDbData [$index] ['TAS_UID'], $unassignedUsersGroups);
|
||||
//}
|
||||
|
||||
// copy list of unassigned users and groups
|
||||
foreach ($unassignedUsersGroups as $unassignedUserGroup) {
|
||||
//unassigned users
|
||||
@@ -2194,7 +2095,6 @@ class AppSolr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Get DataTypes of dynaforms
|
||||
@@ -2227,11 +2127,9 @@ class AppSolr
|
||||
// create array of fields and types
|
||||
if ($field->getAttribute('validate') == 'Int') {
|
||||
$dynaformFieldTypes [$field->nodeName] = 'Int';
|
||||
}
|
||||
elseif ($field->getAttribute ('validate') == 'Real') {
|
||||
} elseif ($field->getAttribute('validate') == 'Real') {
|
||||
$dynaformFieldTypes [$field->nodeName] = 'Real';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$dynaformFieldTypes [$field->nodeName] = $field->getAttribute('type');
|
||||
}
|
||||
}
|
||||
@@ -2301,8 +2199,7 @@ class AppSolr
|
||||
* the condition
|
||||
* @return integer The index of the maximun record in array
|
||||
*/
|
||||
public function aaGetMaximun($arr, $column, $columnType = 'STRING',
|
||||
$columnCondition = "", $condition = "")
|
||||
public function aaGetMaximun($arr, $column, $columnType = 'STRING', $columnCondition = "", $condition = "")
|
||||
{
|
||||
// get first value
|
||||
$auxValue = $arr [0] [$column];
|
||||
@@ -2347,8 +2244,7 @@ class AppSolr
|
||||
* the condition
|
||||
* @return Ambigous <NULL, unknown> Index of the minimun value found
|
||||
*/
|
||||
public function aaGetMinimun($arr, $column, $columnType = 'STRING',
|
||||
$columnCondition = "", $condition = "")
|
||||
public function aaGetMinimun($arr, $column, $columnType = 'STRING', $columnCondition = "", $condition = "")
|
||||
{
|
||||
// get first value
|
||||
$auxValue = $arr [0] [$column];
|
||||
@@ -2371,7 +2267,6 @@ class AppSolr
|
||||
if ((strtotime($row [$column]) <= strtotime($auxValue)) && (($columnCondition == "") || ($row [$columnCondition] == $condition))) {
|
||||
$auxValue = $row [$column];
|
||||
$index = $i;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2409,19 +2304,16 @@ class AppSolr
|
||||
if ($isEqual) {
|
||||
if ($row [$column] == $condition) {
|
||||
$evaluateRow = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$evaluateRow = false;
|
||||
breaK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($row [$column] != $condition) {
|
||||
$evaluateRow = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$evaluateRow = false;
|
||||
breaK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2442,7 +2334,6 @@ class AppSolr
|
||||
*/
|
||||
public function getApplicationDelegationData($AppUID)
|
||||
{
|
||||
|
||||
$allAppDbData = array();
|
||||
|
||||
$c = new Criteria();
|
||||
@@ -2761,8 +2652,9 @@ class AppSolr
|
||||
*/
|
||||
public function synchronizePendingApplications()
|
||||
{
|
||||
if(!$this->isSolrEnabled())
|
||||
if (!$this->isSolrEnabled()) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error connecting to solr server.");
|
||||
}
|
||||
|
||||
// check table of pending updates
|
||||
$oAppSolrQueue = new AppSolrQueue();
|
||||
@@ -2877,7 +2769,6 @@ class AppSolr
|
||||
*/
|
||||
public function getPagedApplicationUids($skip, $pagesize)
|
||||
{
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->addSelectColumn(ApplicationPeer::APP_UID);
|
||||
@@ -2909,8 +2800,9 @@ class AppSolr
|
||||
{
|
||||
$trunk = $indexTrunkSize;
|
||||
|
||||
if(!$this->isSolrEnabled())
|
||||
if (!$this->isSolrEnabled()) {
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error connecting to solr server.");
|
||||
}
|
||||
|
||||
// delete all documents to begin reindex
|
||||
// deleteAllDocuments();
|
||||
@@ -2935,5 +2827,4 @@ class AppSolr
|
||||
printf("Total reindex time: %s \n", $curTimeDoc);
|
||||
printf("Reindex completed successfully!!.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
class BpmnEngineSearchIndexAccessSolr
|
||||
{
|
||||
const SOLR_VERSION = '&version=2.2';
|
||||
|
||||
private $_solrIsEnabled = false;
|
||||
private $_solrHost = "";
|
||||
|
||||
@@ -186,9 +187,8 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, $solrUpdateDocument->document); // data
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
@@ -232,9 +232,8 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<commit/>"); // data
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
@@ -278,9 +277,8 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<rollback/>"); // data
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
@@ -324,9 +322,8 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<optimize/>"); // data
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
@@ -413,8 +410,9 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
curl_close($handler);
|
||||
|
||||
//there's no response
|
||||
if (!$response)
|
||||
if (!$response) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// decode
|
||||
$responseSolr = G::json_decode($response);
|
||||
@@ -445,9 +443,8 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<delete><query>*:*</query></delete>"); // data
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
@@ -492,9 +489,8 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
curl_setopt($handler, CURLOPT_HTTPHEADER, array(
|
||||
'Content-type:application/xml'
|
||||
));
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_BINARYTRANSFER, true); // --data-binary
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, "<delete><query>" . $idQuery . "</query></delete>"); // data
|
||||
|
||||
//Apply proxy settings
|
||||
$sysConf = PmSystem::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
@@ -521,7 +517,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
/**
|
||||
* Execute a query in base to Request data
|
||||
*
|
||||
* @param Entity_FacetRequest $facetRequestEntity
|
||||
* @param EntityFacetRequest $facetRequestEntity
|
||||
* @return solr response: list of facets array
|
||||
*/
|
||||
public function getFacetsList($facetRequest)
|
||||
@@ -550,7 +546,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
$facets .= '&facet.date=' . $value;
|
||||
}
|
||||
$facets .= '&facet.date.start=' . $facetRequest->facetDatesStart;
|
||||
$facets .= '&facet.date.end=' . $facetRequest->facet | DatesEnd;
|
||||
$facets .= '&facet.date.end=' . $facetRequest->facetDatesEnd;
|
||||
$facets .= '&facet.date.gap=' . $facetRequest->facetDateGap;
|
||||
}
|
||||
$filters = '';
|
||||
|
||||
@@ -74,7 +74,7 @@ class BpmnEngineServicesSearchIndex
|
||||
'selectedFacetRemoveCondition' => $removeCondition
|
||||
);
|
||||
|
||||
$aSelectedFacetGroups [] = Entity_SelectedFacetGroupItem::createForRequest($selectedFacetGroupData);
|
||||
$aSelectedFacetGroups [] = EntitySelectedFacetGroupItem::createForRequest($selectedFacetGroupData);
|
||||
}
|
||||
|
||||
// convert request to index request
|
||||
@@ -127,11 +127,11 @@ class BpmnEngineServicesSearchIndex
|
||||
$dataItem ['facetPrintName'] = $facetvalues [$i];
|
||||
$dataItem ['facetCount'] = $facetvalues [$i + 1];
|
||||
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
|
||||
$newFacetItem = Entity_FacetItem::createForInsert($dataItem);
|
||||
$newFacetItem = EntityFacetItem::createForInsert($dataItem);
|
||||
$facetItems [] = $newFacetItem;
|
||||
}
|
||||
$data ['facetItems'] = $facetItems;
|
||||
$newFacetGroup = Entity_FacetGroup::createForInsert($data);
|
||||
$newFacetGroup = EntityFacetGroup::createForInsert($data);
|
||||
|
||||
$facetGroups [] = $newFacetGroup;
|
||||
}
|
||||
@@ -165,13 +165,13 @@ class BpmnEngineServicesSearchIndex
|
||||
|
||||
$dataItem ['facetCount'] = $facetvalues->$k;
|
||||
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
|
||||
$newFacetItem = Entity_FacetItem::createForInsert($dataItem);
|
||||
$newFacetItem = EntityFacetItem::createForInsert($dataItem);
|
||||
$facetItems [] = $newFacetItem;
|
||||
}
|
||||
}
|
||||
|
||||
$data ['facetItems'] = $facetItems;
|
||||
$newFacetGroup = Entity_FacetGroup::createForInsert($data);
|
||||
$newFacetGroup = EntityFacetGroup::createForInsert($data);
|
||||
|
||||
$facetGroups [] = $newFacetGroup;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ class BpmnEngineServicesSearchIndex
|
||||
'aSelectedFacetGroups' => $aSelectedFacetGroups,
|
||||
'sFilterText' => $filterText
|
||||
);
|
||||
$facetResult = Entity_FacetResult::createForRequest($dataFacetResult);
|
||||
$facetResult = EntityFacetResult::createForRequest($dataFacetResult);
|
||||
|
||||
return $facetResult;
|
||||
}
|
||||
@@ -266,7 +266,7 @@ class BpmnEngineServicesSearchIndex
|
||||
/**
|
||||
* Call Solr server to return the list of paginated pages.
|
||||
* @param FacetRequest $solrRequestData
|
||||
* @return Entity_SolrQueryResult
|
||||
* @return EntitySolrQueryResult
|
||||
*/
|
||||
public function getDataTablePaginatedList($solrRequestData)
|
||||
{
|
||||
@@ -310,7 +310,7 @@ class BpmnEngineServicesSearchIndex
|
||||
}
|
||||
}
|
||||
|
||||
$solrQueryResponse = Entity_SolrQueryResult::createForRequest($data);
|
||||
$solrQueryResponse = EntitySolrQueryResult::createForRequest($data);
|
||||
|
||||
return $solrQueryResponse;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ class WsBase
|
||||
//Add del_index dynamic fields to list of resulting columns
|
||||
$columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
|
||||
|
||||
$solrRequestData = Entity_SolrRequestData::createForRequestPagination(
|
||||
$solrRequestData = EntitySolrRequestData::createForRequestPagination(
|
||||
array(
|
||||
"workspace" => $solrEnv["solr_instance"],
|
||||
"startAfter" => 0,
|
||||
|
||||
37
workflow/engine/classes/entities/EntityAppSolrQueue.php
Normal file
37
workflow/engine/classes/entities/EntityAppSolrQueue.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
class EntityAppSolrQueue extends EntityBase
|
||||
{
|
||||
public $appUid = '';
|
||||
public $appChangeDate = '';
|
||||
public $appChangeTrace = '';
|
||||
public $appUpdated = 0;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntityAppSolrQueue();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequest($data)
|
||||
{
|
||||
$obj = new EntityAppSolrQueue();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"appUid",
|
||||
"appChangeDate",
|
||||
"appChangeTrace",
|
||||
"appUpdated"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
148
workflow/engine/classes/entities/EntityBase.php
Normal file
148
workflow/engine/classes/entities/EntityBase.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
class EntityBase
|
||||
{
|
||||
|
||||
/**
|
||||
* this function check if a field is in the data sent in the constructor
|
||||
* you can specify an array, and this function will use like alias
|
||||
*/
|
||||
protected function validateField($field, $default = false)
|
||||
{
|
||||
$fieldIsEmpty = true;
|
||||
|
||||
// this is a trick, if $fields is a string, $fields will be an array with
|
||||
// one element
|
||||
if (is_array($field)) {
|
||||
$fields = $field;
|
||||
} else {
|
||||
$fields = array();
|
||||
$fields [] = $field;
|
||||
}
|
||||
|
||||
// if there are aliases for this field, evaluate all aliases and take the
|
||||
// first occurence
|
||||
foreach ($fields as $k => $f) {
|
||||
if (isset($this->temp [$f])) {
|
||||
$fieldIsEmpty = false;
|
||||
return $this->temp [$f];
|
||||
}
|
||||
}
|
||||
|
||||
// field empty means the user has not sent a value for this Field, so we are
|
||||
// using the default value
|
||||
if ($fieldIsEmpty) {
|
||||
if ($default !== false) {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function validateRequiredFields($requiredFields = array())
|
||||
{
|
||||
foreach ($requiredFields as $k => $field) {
|
||||
if ($this->{$field} === null) {
|
||||
throw (new Exception("Field $field is required in " . get_class($this)));
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the values of the Entity to the array of aliases
|
||||
* The array of aliases must be defined.
|
||||
*
|
||||
* @return Array of alias with the Entity values
|
||||
*/
|
||||
public function getAliasDataArray()
|
||||
{
|
||||
$aAlias = array();
|
||||
// get aliases from class
|
||||
$className = get_class($this);
|
||||
if (method_exists($className, 'GetAliases')) {
|
||||
$aliases = call_user_func(array(
|
||||
$className,
|
||||
'GetAliases'
|
||||
));
|
||||
|
||||
foreach ($this as $field => $value) {
|
||||
if (isset($aliases [$field])) {
|
||||
// echo "Field exists in Aliases: " . $field . "\n";
|
||||
// echo "Alias Name:" . $aliases[$field] . "\n";
|
||||
// echo "Alias value:" . $value . "\n";
|
||||
$aAlias [$aliases [$field]] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data from array of alias to Entity
|
||||
*
|
||||
* @param $aAliasData array of data of aliases
|
||||
*/
|
||||
public function setAliasDataArray($aAliasData)
|
||||
{
|
||||
// get aliases from class
|
||||
$className = get_class($this);
|
||||
if (method_exists($className, 'GetAliases')) {
|
||||
$aliases = call_user_func(array(
|
||||
$className,
|
||||
'GetAliases'
|
||||
));
|
||||
// $aliases = $className::GetAliases ();
|
||||
foreach ($this as $field => $value) {
|
||||
if (isset($aliases [$field])) {
|
||||
$this->{$field} = $aAliasData [$aliases [$field]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object with values from $data.
|
||||
* The values from data use properties or alias array.
|
||||
*
|
||||
* @param $data
|
||||
*/
|
||||
protected function initializeObject($data)
|
||||
{
|
||||
// get aliases from class
|
||||
$className = get_class($this);
|
||||
$aliases = array();
|
||||
$swAliases = false;
|
||||
if (method_exists($className, 'GetAliases')) {
|
||||
$aliases = call_user_func(array(
|
||||
$className,
|
||||
'GetAliases'
|
||||
));
|
||||
// $aliases = $className::GetAliases ();
|
||||
$swAliases = true;
|
||||
}
|
||||
// use object properties or aliases to initialize
|
||||
foreach ($this as $field => $value) {
|
||||
if (isset($data [$field])) {
|
||||
$this->$field = $data [$field];
|
||||
} elseif ($swAliases && isset($aliases [$field]) && isset($data [$aliases [$field]])) {
|
||||
$this->$field = $data [$aliases [$field]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
if (isset($this->temp)) {
|
||||
unset($this->temp);
|
||||
}
|
||||
return serialize($this);
|
||||
}
|
||||
|
||||
public function unserialize($str)
|
||||
{
|
||||
$className = get_class($this);
|
||||
$data = unserialize($str);
|
||||
return new $className($data);
|
||||
}
|
||||
}
|
||||
36
workflow/engine/classes/entities/EntityFacetGroup.php
Normal file
36
workflow/engine/classes/entities/EntityFacetGroup.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class EntityFacetGroup extends EntityBase
|
||||
{
|
||||
public $facetGroupName = '';
|
||||
public $facetGroupPrintName = '';
|
||||
public $facetGroupType = ''; // field, daterange, query
|
||||
public $facetGroupId = '';
|
||||
public $facetItems = array();
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntityFacetGroup();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForInsert($data)
|
||||
{
|
||||
$obj = new EntityFacetGroup();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"facetGroupName",
|
||||
"facetItems"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
class EntityFacetInterfaceRequest extends EntityBase
|
||||
{
|
||||
public $searchText = '';
|
||||
public $selectedFacetsString = ''; // string of selected facet groups and
|
||||
|
||||
// items in format:
|
||||
// groupkey1::groupdesc1:::itemkey1::itemdesc1,groupkey2::groupdesc2:::itemkey2::itemdesc2,
|
||||
// groupkey3::groupdesc3:::itemkey3::itemdesc3
|
||||
// var $selectedFacetFields = array();
|
||||
// var $selectedFacetTypes = array();
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new EntityFacetInterfaceRequest ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new EntityFacetInterfaceRequest ();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"searchText",
|
||||
"selectedFacetsString"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class EntityFacetInterfaceResult extends EntityBase
|
||||
{
|
||||
// array of facetsgroups, array of Entity_SelectedFacetGroupItem, filter text
|
||||
public $aFacetGroup = array();
|
||||
public $aSelectedFacetGroupItem = array();
|
||||
public $sFilterText = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntityFacetInterfaceResult();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequest($data)
|
||||
{
|
||||
$obj = new EntityFacetInterfaceResult();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"aFacetGroup",
|
||||
"aSelectedFacetGroupItem",
|
||||
"sFilterText"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
36
workflow/engine/classes/entities/EntityFacetItem.php
Normal file
36
workflow/engine/classes/entities/EntityFacetItem.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class EntityFacetItem extends EntityBase
|
||||
{
|
||||
public $facetName = '';
|
||||
public $facetPrintName = '';
|
||||
public $facetCount = '';
|
||||
public $facetSelectCondition = ''; // selected condition used to select
|
||||
|
||||
// this facet
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntityFacetItem();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForInsert($data)
|
||||
{
|
||||
$obj = new EntityFacetItem();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"facetName",
|
||||
"facetCount"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
41
workflow/engine/classes/entities/EntityFacetRequest.php
Normal file
41
workflow/engine/classes/entities/EntityFacetRequest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class EntityFacetRequest extends EntityBase
|
||||
{
|
||||
public $workspace = '';
|
||||
public $searchText = '';
|
||||
public $facetFields = array();
|
||||
public $facetQueries = array();
|
||||
public $facetDates = array();
|
||||
public $facetDatesStart = '';
|
||||
public $facetDatesEnd = '';
|
||||
public $facetDateGap = '';
|
||||
public $facetRanges = array();
|
||||
public $filters = array();
|
||||
public $selectedFacetsString = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntityFacetRequest();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequest($data)
|
||||
{
|
||||
$obj = new EntityFacetRequest();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"workspace"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
35
workflow/engine/classes/entities/EntityFacetResult.php
Normal file
35
workflow/engine/classes/entities/EntityFacetResult.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class EntityFacetResult extends EntityBase
|
||||
{
|
||||
public $aFacetGroups = array();
|
||||
public $aSelectedFacetGroups = array();
|
||||
public $sFilterText = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntityFacetResult();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequest($data)
|
||||
{
|
||||
$obj = new EntityFacetResult();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"aFacetGroups",
|
||||
"aSelectedFacetGroups",
|
||||
"sFilterText"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
class EntitySelectedFacetGroupItem extends EntityBase
|
||||
{
|
||||
public $selectedFacetGroupName = '';
|
||||
public $selectedFacetGroupPrintName = '';
|
||||
public $selectedFacetItemName = '';
|
||||
public $selectedFacetItemPrintName = '';
|
||||
public $selectedFacetRemoveCondition = ''; // remove condition, string of
|
||||
// selected facets without this
|
||||
// facet
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntitySelectedFacetGroupItem();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequest($data)
|
||||
{
|
||||
$obj = new EntitySelectedFacetGroupItem();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"selectedFacetGroupName",
|
||||
"selectedFacetItemName"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
38
workflow/engine/classes/entities/EntitySolrQueryResult.php
Normal file
38
workflow/engine/classes/entities/EntitySolrQueryResult.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
class EntitySolrQueryResult extends EntityBase
|
||||
{
|
||||
public $sEcho = '';
|
||||
public $iTotalRecords = 0;
|
||||
public $iTotalDisplayRecords = 10;
|
||||
public $aaData = array(); // array of arrays of records to
|
||||
// display
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntitySolrQueryResult();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequest($data)
|
||||
{
|
||||
$obj = new EntitySolrQueryResult();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
'sEcho',
|
||||
'iTotalRecords',
|
||||
'iTotalDisplayRecords',
|
||||
'aaData'
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
44
workflow/engine/classes/entities/EntitySolrRequestData.php
Normal file
44
workflow/engine/classes/entities/EntitySolrRequestData.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
class EntitySolrRequestData extends EntityBase
|
||||
{
|
||||
public $workspace = '';
|
||||
public $startAfter = 0;
|
||||
public $pageSize = 10;
|
||||
public $searchText = '*:*';
|
||||
public $filterText = ''; // comma separated list of filters field:value
|
||||
public $numSortingCols = 0; // number of columns that are sorted
|
||||
public $sortableCols = array(); // array of booleans indicating if column is
|
||||
// sortable (true, false)
|
||||
public $sortCols = array(); // array of indices of sorted columns index
|
||||
// based in the total number of sorting cols
|
||||
public $sortDir = array(); // array of direction of sorting for each
|
||||
// column (desc, asc)
|
||||
public $includeCols = array();
|
||||
public $resultFormat = 'xml'; // json, xml, php
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntitySolrRequestData();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequestPagination($data)
|
||||
{
|
||||
$obj = new EntitySolrRequestData();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
'workspace'
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class EntitySolrUpdateDocument extends EntityBase
|
||||
{
|
||||
public $workspace = '';
|
||||
public $document = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new EntitySolrUpdateDocument();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequest($data)
|
||||
{
|
||||
$obj = new EntitySolrUpdateDocument();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"workspace",
|
||||
"document"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
/**
|
||||
* Application Solr Queue
|
||||
*/
|
||||
|
||||
/**
|
||||
* Application Solr Queue
|
||||
*/class Entity_AppSolrQueue extends Entity_Base
|
||||
{
|
||||
public $appUid = '';
|
||||
public $appChangeDate = '';
|
||||
public $appChangeTrace = '';
|
||||
public $appUpdated = 0;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_AppSolrQueue ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_AppSolrQueue ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"appUid",
|
||||
"appChangeDate",
|
||||
"appChangeTrace",
|
||||
"appUpdated"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Entity_Base
|
||||
{
|
||||
|
||||
/**
|
||||
* this function check if a field is in the data sent in the constructor
|
||||
* you can specify an array, and this function will use like alias
|
||||
*/
|
||||
protected function validateField($field, $default = false)
|
||||
{
|
||||
$fieldIsEmpty = true;
|
||||
|
||||
// this is a trick, if $fields is a string, $fields will be an array with
|
||||
// one element
|
||||
if (is_array ($field)) {
|
||||
$fields = $field;
|
||||
}
|
||||
else {
|
||||
$fields = array ();
|
||||
$fields [] = $field;
|
||||
}
|
||||
|
||||
// if there are aliases for this field, evaluate all aliases and take the
|
||||
// first occurence
|
||||
foreach ($fields as $k => $f) {
|
||||
if (isset ($this->temp [$f])) {
|
||||
$fieldIsEmpty = false;
|
||||
return $this->temp [$f];
|
||||
}
|
||||
}
|
||||
|
||||
// field empty means the user has not sent a value for this Field, so we are
|
||||
// using the default value
|
||||
if ($fieldIsEmpty) {
|
||||
if ($default !== false) {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function validateRequiredFields($requiredFields = array())
|
||||
{
|
||||
foreach ($requiredFields as $k => $field) {
|
||||
if ($this->{$field} === NULL) {
|
||||
throw (new Exception ("Field $field is required in " . get_class ($this)));
|
||||
die ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* Copy the values of the Entity to the array of aliases
|
||||
* The array of aliases must be defined.
|
||||
*
|
||||
* @return Array of alias with the Entity values
|
||||
*/
|
||||
public function getAliasDataArray()
|
||||
{
|
||||
$aAlias = array ();
|
||||
// get aliases from class
|
||||
$className = get_class ($this);
|
||||
if (method_exists ($className, 'GetAliases')) {
|
||||
$aliases = call_user_func (array (
|
||||
$className,
|
||||
'GetAliases'
|
||||
));
|
||||
// $aliases = $className::GetAliases ();
|
||||
foreach ($this as $field => $value)
|
||||
if (isset ($aliases [$field])) {
|
||||
// echo "Field exists in Aliases: " . $field . "\n";
|
||||
// echo "Alias Name:" . $aliases[$field] . "\n";
|
||||
// echo "Alias value:" . $value . "\n";
|
||||
$aAlias [$aliases [$field]] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $aAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* Set the data from array of alias to Entity
|
||||
*
|
||||
* @param $aAliasData array
|
||||
* of data of aliases
|
||||
*/
|
||||
public function setAliasDataArray($aAliasData)
|
||||
{
|
||||
// get aliases from class
|
||||
$className = get_class ($this);
|
||||
if (method_exists ($className, 'GetAliases')) {
|
||||
$aliases = call_user_func (array (
|
||||
$className,
|
||||
'GetAliases'
|
||||
));
|
||||
// $aliases = $className::GetAliases ();
|
||||
foreach ($this as $field => $value)
|
||||
if (isset ($aliases [$field]))
|
||||
$this->{$field} = $aAliasData [$aliases [$field]];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* Initialize object with values from $data.
|
||||
* The values from data use properties or alias array.
|
||||
*
|
||||
* @param
|
||||
* $data
|
||||
*/
|
||||
protected function initializeObject($data)
|
||||
{
|
||||
// get aliases from class
|
||||
$className = get_class ($this);
|
||||
$aliases = array ();
|
||||
$swAliases = false;
|
||||
if (method_exists ($className, 'GetAliases')) {
|
||||
$aliases = call_user_func (array (
|
||||
$className,
|
||||
'GetAliases'
|
||||
));
|
||||
// $aliases = $className::GetAliases ();
|
||||
$swAliases = true;
|
||||
}
|
||||
// use object properties or aliases to initialize
|
||||
foreach ($this as $field => $value)
|
||||
if (isset ($data [$field])) {
|
||||
$this->$field = $data [$field];
|
||||
}
|
||||
elseif ($swAliases && isset ($aliases [$field]) && isset ($data [$aliases [$field]])) {
|
||||
$this->$field = $data [$aliases [$field]];
|
||||
}
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
if (isset ($this->temp))
|
||||
unset ($this->temp);
|
||||
return serialize ($this);
|
||||
}
|
||||
|
||||
public function unserialize($str)
|
||||
{
|
||||
$className = get_class ($this);
|
||||
$data = unserialize ($str);
|
||||
return new $className ($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
/**
|
||||
* Facet group entity that represent a facet group
|
||||
*
|
||||
* @property $facetGroupName: The name of the facet (field name in solr index)
|
||||
* @property $facetGroupPrintName: The print name of the facet (Human readable
|
||||
* description)
|
||||
* @property $facetGroupType: The type of facet group, field, daterange, filter,
|
||||
* range
|
||||
* @property $facetGroupId: An identifier to find group information
|
||||
* @property $facetItems: array of facet items
|
||||
* @author dev-HebertSaak
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Facet group entity that represent a facet group
|
||||
*
|
||||
* @property $facetGroupName: The name of the facet (field name in solr index)
|
||||
* @property $facetGroupPrintName: The print name of the facet (Human readable
|
||||
* description)
|
||||
* @property $facetGroupType: The type of facet group, field, daterange, filter,
|
||||
* range
|
||||
* @property $facetGroupId: An identifier to find group information
|
||||
* @property $facetItems: array of facet items
|
||||
* @author dev-HebertSaak
|
||||
*
|
||||
*/class Entity_FacetGroup extends Entity_Base
|
||||
{
|
||||
public $facetGroupName = '';
|
||||
public $facetGroupPrintName = '';
|
||||
public $facetGroupType = ''; // field, daterange, query
|
||||
public $facetGroupId = '';
|
||||
public $facetItems = array ();
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetGroup ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForInsert($data)
|
||||
{
|
||||
$obj = new Entity_FacetGroup ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"facetGroupName",
|
||||
"facetItems"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
|
||||
class Entity_FacetInterfaceRequest extends Entity_Base
|
||||
{
|
||||
public $searchText = '';
|
||||
public $selectedFacetsString = ''; // string of selected facet groups and
|
||||
// items in format:
|
||||
// groupkey1::groupdesc1:::itemkey1::itemdesc1,groupkey2::groupdesc2:::itemkey2::itemdesc2,
|
||||
// groupkey3::groupdesc3:::itemkey3::itemdesc3
|
||||
// var $selectedFacetFields = array();
|
||||
// var $selectedFacetTypes = array();
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceRequest ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceRequest ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"searchText",
|
||||
"selectedFacetsString"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
|
||||
class Entity_FacetInterfaceResult extends Entity_Base
|
||||
{
|
||||
// array of facetsgroups, array of Entity_SelectedFacetGroupItem, filter text
|
||||
|
||||
public $aFacetGroup = array ();
|
||||
public $aSelectedFacetGroupItem = array ();
|
||||
public $sFilterText = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceResult ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceResult ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"aFacetGroup",
|
||||
"aSelectedFacetGroupItem",
|
||||
"sFilterText"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* Entity Face item, represent an option in a facet group
|
||||
*
|
||||
* @author dev-HebertSaak
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* Entity Face item, represent an option in a facet group
|
||||
*
|
||||
* @author dev-HebertSaak
|
||||
*
|
||||
*/class Entity_FacetItem extends Entity_Base
|
||||
{
|
||||
public $facetName = '';
|
||||
public $facetPrintName = '';
|
||||
public $facetCount = '';
|
||||
public $facetSelectCondition = ''; // selected condition used to select
|
||||
// this facet
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetItem ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForInsert($data)
|
||||
{
|
||||
$obj = new Entity_FacetItem ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"facetName",
|
||||
"facetCount"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
|
||||
class Entity_FacetRequest extends Entity_Base
|
||||
{
|
||||
public $workspace = '';
|
||||
public $searchText = '';
|
||||
public $facetFields = array ();
|
||||
public $facetQueries = array ();
|
||||
public $facetDates = array ();
|
||||
public $facetDatesStart = '';
|
||||
public $facetDatesEnd = '';
|
||||
public $facetDateGap = '';
|
||||
public $facetRanges = array ();
|
||||
public $filters = array ();
|
||||
public $selectedFacetsString = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetRequest ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_FacetRequest ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"workspace"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
|
||||
class Entity_FacetResult extends Entity_Base
|
||||
{
|
||||
public $aFacetGroups = array ();
|
||||
public $aSelectedFacetGroups = array ();
|
||||
public $sFilterText = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetResult ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_FacetResult ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"aFacetGroups",
|
||||
"aSelectedFacetGroups",
|
||||
"sFilterText"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
|
||||
class Entity_SelectedFacetGroupItem extends Entity_Base
|
||||
{
|
||||
public $selectedFacetGroupName = '';
|
||||
public $selectedFacetGroupPrintName = '';
|
||||
public $selectedFacetItemName = '';
|
||||
public $selectedFacetItemPrintName = '';
|
||||
public $selectedFacetRemoveCondition = ''; // remove condition, string of
|
||||
// selected facets without this
|
||||
// facet
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_SelectedFacetGroupItem ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_SelectedFacetGroupItem ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"selectedFacetGroupName",
|
||||
"selectedFacetItemName"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
|
||||
class Entity_SolrQueryResult extends Entity_Base
|
||||
{
|
||||
public $sEcho = '';
|
||||
public $iTotalRecords = 0;
|
||||
public $iTotalDisplayRecords = 10;
|
||||
public $aaData = array (); // array of arrays of records to
|
||||
// display
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_SolrQueryResult ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_SolrQueryResult ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
'sEcho',
|
||||
'iTotalRecords',
|
||||
'iTotalDisplayRecords',
|
||||
'aaData'
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
|
||||
class Entity_SolrRequestData extends Entity_Base
|
||||
{
|
||||
public $workspace = '';
|
||||
public $startAfter = 0;
|
||||
public $pageSize = 10;
|
||||
public $searchText = '*:*';
|
||||
public $filterText = ''; // comma separated list of filters field:value
|
||||
public $numSortingCols = 0; // number of columns that are sorted
|
||||
public $sortableCols = array (); // array of booleans indicating if column is
|
||||
// sortable (true, false)
|
||||
public $sortCols = array (); // array of indices of sorted columns index
|
||||
// based in the total number of sorting cols
|
||||
public $sortDir = array (); // array of direction of sorting for each
|
||||
// column (desc, asc)
|
||||
public $includeCols = array ();
|
||||
public $resultFormat = 'xml'; // json, xml, php
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_SolrRequestData ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequestPagination($data)
|
||||
{
|
||||
$obj = new Entity_SolrRequestData ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
'workspace'
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
require_once ('Base.php');
|
||||
|
||||
|
||||
class Entity_SolrUpdateDocument extends Entity_Base
|
||||
{
|
||||
var $workspace = '';
|
||||
var $document = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_SolrUpdateDocument ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_SolrUpdateDocument ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"workspace",
|
||||
"document"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class AppSolrQueue extends BaseAppSolrQueue
|
||||
$row = $rs->getRow();
|
||||
|
||||
while (is_array( $row )) {
|
||||
$appSolrQueue = Entity_AppSolrQueue::createEmpty();
|
||||
$appSolrQueue = EntityAppSolrQueue::createEmpty();
|
||||
$appSolrQueue->appUid = $row["APP_UID"];
|
||||
$appSolrQueue->appChangeDate = $row["APP_CHANGE_DATE"];
|
||||
$appSolrQueue->appChangeTrace = $row["APP_CHANGE_TRACE"];
|
||||
|
||||
@@ -402,7 +402,7 @@ class Cases
|
||||
$solrSearchText = "($solrSearchText)";
|
||||
//Add del_index dynamic fields to list of resulting columns
|
||||
$columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
|
||||
$solrRequestData = \Entity_SolrRequestData::createForRequestPagination(
|
||||
$solrRequestData = \EntitySolrRequestData::createForRequestPagination(
|
||||
array(
|
||||
"workspace" => $solrEnv["solr_instance"],
|
||||
"startAfter" => 0,
|
||||
|
||||
Reference in New Issue
Block a user