Merged in bugfix/HOR-3670-RG-3 (pull request #5929)
HOR-3670 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
||||
class BpmnEngineSearchIndexAccessSolr
|
||||
{
|
||||
const SOLR_VERSION = '&version=2.2';
|
||||
|
||||
private $_solrIsEnabled = false;
|
||||
private $_solrHost = "";
|
||||
|
||||
@@ -78,7 +79,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
// verify the result of solr
|
||||
$responseSolrTotal = G::json_decode($responseTotal);
|
||||
if ($responseSolrTotal->responseHeader->status != 0) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error returning the total number of documents in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error returning the total number of documents in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
$numTotalDocs = $responseSolrTotal->response->numFound;
|
||||
return $numTotalDocs;
|
||||
@@ -99,13 +100,13 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
$workspace = $solrRequestData->workspace;
|
||||
|
||||
// format request
|
||||
$query = empty ($solrRequestData->searchText) ? '*:*' : $solrRequestData->searchText;
|
||||
$query = empty($solrRequestData->searchText) ? '*:*' : $solrRequestData->searchText;
|
||||
$query = rawurlencode($query);
|
||||
$start = '&start=' . $solrRequestData->startAfter;
|
||||
$rows = '&rows=' . $solrRequestData->pageSize;
|
||||
$fieldList = '';
|
||||
$cols = $solrRequestData->includeCols;
|
||||
if (!empty ($cols)) {
|
||||
if (!empty($cols)) {
|
||||
$fieldList = "&fl=" . implode(",", $cols);
|
||||
}
|
||||
$sort = '';
|
||||
@@ -117,7 +118,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
|
||||
$sort = substr_replace($sort, "", -1);
|
||||
}
|
||||
$resultFormat = empty ($solrRequestData->resultFormat) ? '' : '&wt=' . $solrRequestData->resultFormat;
|
||||
$resultFormat = empty($solrRequestData->resultFormat) ? '' : '&wt=' . $solrRequestData->resultFormat;
|
||||
$filters = '';
|
||||
$aFilters = explode(',', $solrRequestData->filterText);
|
||||
foreach ($aFilters as $value) {
|
||||
@@ -159,7 +160,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
// decode
|
||||
$responseSolr = G::json_decode($response);
|
||||
if ($responseSolr->responseHeader->status != 0) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error executing query to Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error executing query to Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
|
||||
return $responseSolr;
|
||||
@@ -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'] != '') {
|
||||
@@ -207,7 +207,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error updating document in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error updating document in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'] != '') {
|
||||
@@ -253,7 +252,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error commiting changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error commiting changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'] != '') {
|
||||
@@ -299,7 +297,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error rolling back changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error rolling back changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'] != '') {
|
||||
@@ -345,7 +342,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error optimizing changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error optimizing changes in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +383,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
// decode
|
||||
$responseSolr = G::json_decode($response);
|
||||
if ($responseSolr->responseHeader->status != 0) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error getting index fields in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error getting index fields in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
return $responseSolr;
|
||||
}
|
||||
@@ -413,13 +410,14 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
curl_close($handler);
|
||||
|
||||
//there's no response
|
||||
if (!$response)
|
||||
if (!$response) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// decode
|
||||
$responseSolr = G::json_decode($response);
|
||||
if ($responseSolr->responseHeader->status != "OK") {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error pinging Solr server." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error pinging Solr server." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -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'] != '') {
|
||||
@@ -467,7 +464,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error deleting all documents in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error deleting all documents in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'] != '') {
|
||||
@@ -514,14 +510,14 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
|
||||
$swOk = strpos($response, '<int name="status">0</int>');
|
||||
if (!$swOk) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error deleting document in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error deleting document in Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@@ -531,7 +527,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
$workspace = $facetRequest->workspace;
|
||||
|
||||
// format request
|
||||
$query = empty ($facetRequest->searchText) ? '*:*' : $facetRequest->searchText;
|
||||
$query = empty($facetRequest->searchText) ? '*:*' : $facetRequest->searchText;
|
||||
$query = rawurlencode($query);
|
||||
$start = '&start=0';
|
||||
$rows = '&rows=0';
|
||||
@@ -545,12 +541,12 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
foreach ($facetRequest->facetQueries as $value) {
|
||||
$facets .= '&facet.query=' . $value;
|
||||
}
|
||||
if (!empty ($facetRequest->facetDates)) {
|
||||
if (!empty($facetRequest->facetDates)) {
|
||||
foreach ($facetRequest->facetDates as $value) {
|
||||
$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 = '';
|
||||
@@ -595,7 +591,7 @@ class BpmnEngineSearchIndexAccessSolr
|
||||
// decode
|
||||
$responseSolr = G::json_decode($response);
|
||||
if ($responseSolr->responseHeader->status != 0) {
|
||||
throw new Exception (date('Y-m-d H:i:s:u') . " Error getting faceted list from Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
throw new Exception(date('Y-m-d H:i:s:u') . " Error getting faceted list from Solr." . $solrIntruct . " response error: " . $response . "\n");
|
||||
}
|
||||
|
||||
return $responseSolr;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -185,14 +185,14 @@ class BpmnEngineServicesSearchIndex
|
||||
$filterText .= $selectedFacetGroup->selectedFacetGroupName . ':' . urlencode($selectedFacetGroup->selectedFacetItemName) . ',';
|
||||
}
|
||||
$filterText = substr_replace($filterText, '', - 1);
|
||||
|
||||
|
||||
// Create result
|
||||
$dataFacetResult = array(
|
||||
'aFacetGroups' => $facetGroups,
|
||||
'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)
|
||||
{
|
||||
@@ -285,7 +285,7 @@ class BpmnEngineServicesSearchIndex
|
||||
$numFound = $solrPaginatedResult->response->numFound;
|
||||
|
||||
$docs = $solrPaginatedResult->response->docs;
|
||||
|
||||
|
||||
// insert list of names in docs result
|
||||
$data = array(
|
||||
"sEcho" => '', // must be completed in response
|
||||
@@ -310,7 +310,7 @@ class BpmnEngineServicesSearchIndex
|
||||
}
|
||||
}
|
||||
|
||||
$solrQueryResponse = Entity_SolrQueryResult::createForRequest($data);
|
||||
$solrQueryResponse = EntitySolrQueryResult::createForRequest($data);
|
||||
|
||||
return $solrQueryResponse;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ class BpmnEngineServicesSearchIndex
|
||||
foreach ($solrFieldsData->fields as $key => $fieldData) {
|
||||
if (array_key_exists('dynamicBase', $fieldData)) {
|
||||
$originalFieldName = substr($key, 0, - strlen($fieldData->dynamicBase) + 1);
|
||||
|
||||
|
||||
// Maintain case sensitive variable names
|
||||
$listFields [$originalFieldName] = $key;
|
||||
} else {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -86,31 +86,31 @@ class AppSolrQueue extends BaseAppSolrQueue
|
||||
$updatedApplications = array ();
|
||||
try {
|
||||
$c = new Criteria();
|
||||
|
||||
|
||||
$c->addSelectColumn(AppSolrQueuePeer::APP_UID);
|
||||
$c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_DATE);
|
||||
$c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_TRACE);
|
||||
$c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
|
||||
|
||||
//"WHERE
|
||||
if($updated == true && $deleted == true){
|
||||
$c->add(AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL);
|
||||
}
|
||||
if($updated == true && $deleted == false){
|
||||
$c->add(AppSolrQueuePeer::APP_UPDATED, 1, Criteria::EQUAL);
|
||||
}
|
||||
if($updated == false && $deleted == true){
|
||||
$c->add(AppSolrQueuePeer::APP_UPDATED, 2, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$rs = AppSolrQueuePeer::doSelectRS($c);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
//"WHERE
|
||||
if($updated == true && $deleted == true){
|
||||
$c->add(AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL);
|
||||
}
|
||||
if($updated == true && $deleted == false){
|
||||
$c->add(AppSolrQueuePeer::APP_UPDATED, 1, Criteria::EQUAL);
|
||||
}
|
||||
if($updated == false && $deleted == true){
|
||||
$c->add(AppSolrQueuePeer::APP_UPDATED, 2, Criteria::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 = EntityAppSolrQueue::createEmpty();
|
||||
$appSolrQueue->appUid = $row["APP_UID"];
|
||||
$appSolrQueue->appChangeDate = $row["APP_CHANGE_DATE"];
|
||||
$appSolrQueue->appChangeTrace = $row["APP_CHANGE_TRACE"];
|
||||
@@ -119,11 +119,11 @@ class AppSolrQueue extends BaseAppSolrQueue
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
|
||||
|
||||
return $updatedApplications;
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
} // AppSolrQueue
|
||||
} // AppSolrQueue
|
||||
|
||||
@@ -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