Code cleanup: deprecated the unused (and empty) class CMDBSearchFilter, replaced by DBSearch or DBObjectSearch depending on the usage.

SVN:trunk[3632]
This commit is contained in:
Romain Quetiez
2015-07-09 07:36:39 +00:00
parent baf54a7c02
commit 7a139dddc0
11 changed files with 41 additions and 54 deletions

View File

@@ -180,11 +180,11 @@ class DisplayBlock
switch($sEncoding)
{
case 'text/serialize':
$oFilter = CMDBSearchFilter::unserialize($sITopData);
$oFilter = DBSearch::unserialize($sITopData);
break;
case 'text/oql':
$oFilter = CMDBSearchFilter::FromOQL($sITopData);
$oFilter = DBSearch::FromOQL($sITopData);
break;
}
return new $sBlockClass($oFilter, $sBlockType, $bAsynchronous, $aParams);

View File

@@ -20,7 +20,7 @@
/**
* Typology for the attributes
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @copyright Copyright (C) 2010-2015 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -930,7 +930,7 @@ class AttributeLinkedSet extends AttributeDefinition
{
$oKeyAttDef = MetaModel::GetAttributeDef($sTargetClass, $sKeyAttCode);
$sKeyClass = $oKeyAttDef->GetTargetClass();
$oExtKeyFilter = new CMDBSearchFilter($sKeyClass);
$oExtKeyFilter = new DBObjectSearch($sKeyClass);
$aReconciliationDesc = array();
foreach($aReconciliation as $sRemoteAttCode => $sValue)
{

View File

@@ -1,5 +1,5 @@
<?php
// Copyright (C) 2010-2013 Combodo SARL
// Copyright (C) 2010-2015 Combodo SARL
//
// This file is part of iTop.
//
@@ -20,7 +20,7 @@
/**
* Bulk change facility (common to interactive and batch usages)
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @copyright Copyright (C) 2010-2015 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -295,7 +295,7 @@ class BulkChange
protected function ResolveExternalKey($aRowData, $sAttCode, &$aResults)
{
$oExtKey = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
$oReconFilter = new CMDBSearchFilter($oExtKey->GetTargetClass());
$oReconFilter = new DBObjectSearch($oExtKey->GetTargetClass());
foreach ($this->m_aExtKeys[$sAttCode] as $sForeignAttCode => $iCol)
{
if ($sForeignAttCode == 'id')
@@ -366,7 +366,7 @@ class BulkChange
}
else
{
$oReconFilter = new CMDBSearchFilter($oExtKey->GetTargetClass());
$oReconFilter = new DBObjectSearch($oExtKey->GetTargetClass());
$aCacheKeys = array();
foreach ($aKeyConfig as $sForeignAttCode => $iCol)
{
@@ -839,7 +839,7 @@ class BulkChange
}
try
{
$oReconciliationFilter = new CMDBSearchFilter($this->m_sClass);
$oReconciliationFilter = new DBObjectSearch($this->m_sClass);
$bSkipQuery = false;
foreach($this->m_aReconcilKeys as $sAttCode)
{

View File

@@ -582,7 +582,7 @@ class CMDBObjectSet extends DBObjectSet
static public function FromScratch($sClass)
{
$oFilter = new CMDBSearchFilter($sClass);
$oFilter = new DBObjectSearch($sClass);
$oFilter->AddConditionExpression(new FalseExpression());
$oRetSet = new self($oFilter);
// NOTE: THIS DOES NOT WORK IF m_bLoaded is private in the base class (and you will not get any error message)
@@ -606,7 +606,7 @@ class CMDBObjectSet extends DBObjectSet
// let's create one search definition
$sClass = reset($aClasses);
$sAlias = key($aClasses);
$oFilter = new CMDBSearchFilter($sClass, $sAlias);
$oFilter = new DBObjectSearch($sClass, $sAlias);
$oRetSet = new CMDBObjectSet($oFilter);
$oRetSet->m_bLoaded = true; // no DB load
@@ -618,16 +618,3 @@ class CMDBObjectSet extends DBObjectSet
return $oRetSet;
}
}
/**
* TODO: investigate how to get rid of this class that was made to workaround some language limitation... or a poor design!
*
* @package iTopORM
*/
class CMDBSearchFilter extends DBObjectSearch
{
// this is the public interface (?)
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// Copyright (C) 2010-2012 Combodo SARL
// Copyright (C) 2010-2015 Combodo SARL
//
// This file is part of iTop.
//
@@ -21,7 +21,7 @@
* data generator
* helps the consultants in creating dummy data sets, for various test purposes (validation, usability, scalability)
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @copyright Copyright (C) 2010-2015 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -267,7 +267,7 @@ class cmdbDataGenerator
function GenerateKey($sClass, $aFilterCriteria)
{
$retKey = null;
$oFilter = new CMDBSearchFilter($sClass);
$oFilter = new DBObjectSearch($sClass);
foreach($aFilterCriteria as $sFilterCode => $filterValue)
{
$oFilter->AddCondition($sFilterCode, $filterValue, '=');
@@ -346,7 +346,7 @@ class cmdbDataGenerator
*/
protected function OrganizationExists($sCode)
{
$oFilter = new CMDBSearchFilter('bizOrganization');
$oFilter = new DBObjectSearch('Organization');
$oFilter->AddCondition('code', $sCode, '=');
$oSet = new CMDBObjectSet($oFilter);
return ($oSet->Count() > 0);
@@ -361,7 +361,7 @@ class cmdbDataGenerator
protected function GetOrganization($sId)
{
$oOrg = null;
$oFilter = new CMDBSearchFilter('bizOrganization');
$oFilter = new DBObjectSearch('Organization');
$oFilter->AddCondition('id', $sId, '=');
$oSet = new CMDBObjectSet($oFilter);
if ($oSet->Count() > 0)

View File

@@ -237,7 +237,7 @@ class DBObjectSet
// let's create one search definition corresponding only to the first column
$sClass = reset($aClasses);
$sAlias = key($aClasses);
$oFilter = new CMDBSearchFilter($sClass, $sAlias);
$oFilter = new DBObjectSearch($sClass, $sAlias);
$oRetSet = new self($oFilter);
$oRetSet->m_bLoaded = true; // no DB load

View File

@@ -421,7 +421,7 @@ try
///////////////////////////////////////////////////////////////////////////////////////////
case 'search': // Serialized CMDBSearchFilter
case 'search': // Serialized DBSearch
$sFilter = utils::ReadParam('filter', '', false, 'raw_data');
$sFormat = utils::ReadParam('format', '');
$bSearchForm = utils::ReadParam('search_form', true);
@@ -431,7 +431,7 @@ try
}
$oP->set_title(Dict::S('UI:SearchResultsPageTitle'));
// TO DO: limit the search filter by the user context
$oFilter = CMDBSearchFilter::unserialize($sFilter); // TO DO : check that the filter is valid
$oFilter = DBSearch::unserialize($sFilter); // TO DO : check that the filter is valid
DisplaySearchSet($oP, $oFilter, $bSearchForm, '' /* sBaseClass */, $sFormat);
break;
@@ -836,7 +836,7 @@ EOF
$oP->set_title(Dict::S('UI:BulkDeletePageTitle'));
$oP->add("<h1>".Dict::S('UI:BulkDeleteTitle')."</h1>\n");
// TO DO: limit the search filter by the user context
$oFilter = CMDBSearchFilter::unserialize($sFilter); // TO DO : check that the filter is valid
$oFilter = DBSearch::unserialize($sFilter); // TO DO : check that the filter is valid
$oChecker = new ActionChecker($oFilter, UR_ACTION_BULK_DELETE);
DisplayMultipleSelectionForm($oP, $oFilter, 'bulk_delete', $oChecker);
break;

View File

@@ -1,5 +1,5 @@
<?php
// Copyright (C) 2010-2012 Combodo SARL
// Copyright (C) 2010-2015 Combodo SARL
//
// This file is part of iTop.
//
@@ -20,7 +20,7 @@
/**
* Analytical search
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @copyright Copyright (C) 2010-2015 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -85,17 +85,17 @@ try
// Second part: advanced search form:
if (!empty($sFilter))
{
$oFilter = CMDBSearchFilter::unserialize($sFilter);
$oFilter = DBSearch::unserialize($sFilter);
}
else if (!empty($sClass))
{
$oFilter = new CMDBSearchFilter($sClass);
$oFilter = new DBObjectSearch($sClass);
}
}
}
catch (CoreException $e)
{
$oFilter = new CMDBSearchFilter($sClass);
$oFilter = new DBObjectSearch($sClass);
$oP->P("<b>".Dict::Format('UI:UniversalSearch:Error', $e->getHtmlDesc())."</b>");
}

View File

@@ -20,7 +20,7 @@
/**
* Handles various ajax requests
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @copyright Copyright (C) 2010-2015 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -78,11 +78,11 @@ try
}
if ($sEncoding == 'oql')
{
$oFilter = CMDBSearchFilter::FromOQL($sFilter);
$oFilter = DBSearch::FromOQL($sFilter);
}
else
{
$oFilter = CMDBSearchFilter::unserialize($sFilter);
$oFilter = DBSearch::unserialize($sFilter);
}
$iStart = utils::ReadParam('start',0);
$iEnd = utils::ReadParam('end',1);
@@ -651,11 +651,11 @@ try
$_REQUEST['c'] = $aContext;
if ($sEncoding == 'oql')
{
$oFilter = CMDBSearchFilter::FromOQL($sFilter);
$oFilter = DBSearch::FromOQL($sFilter);
}
else
{
$oFilter = CMDBSearchFilter::unserialize($sFilter);
$oFilter = DBSearch::unserialize($sFilter);
}
$oDisplayBlock = new DisplayBlock($oFilter, $sStyle, false);
$aExtraParams['display_limit'] = true;
@@ -690,11 +690,11 @@ try
{
if ($sEncoding == 'oql')
{
$oFilter = CMDBSearchFilter::FromOQL($sFilter);
$oFilter = DBSearch::FromOQL($sFilter);
}
else
{
$oFilter = CMDBSearchFilter::unserialize($sFilter);
$oFilter = DBSearch::unserialize($sFilter);
}
$oDisplayBlock = new DisplayBlock($oFilter, 'pie_chart_ajax', false);
$oDisplayBlock->RenderContent($oPage, array('group_by' => $sGroupBy));
@@ -717,7 +717,7 @@ try
$aParams = utils::ReadParam('params', array(), false, 'raw_data');
if ($sFilter != '')
{
$oFilter = CMDBSearchFilter::unserialize($sFilter);
$oFilter = DBSearch::unserialize($sFilter);
$oDisplayBlock = new DisplayBlock($oFilter, 'open_flash_chart_ajax', false);
$oDisplayBlock->RenderContent($oPage, $aParams);
}
@@ -760,7 +760,7 @@ try
case 'combo_options':
$oPage->SetContentType('text/html');
$oFilter = CMDBSearchFilter::FromOQL($sFilter);
$oFilter = DBSearch::FromOQL($sFilter);
$oSet = new CMDBObjectSet($oFilter);
while( $oObj = $oSet->fetch())
{
@@ -1310,7 +1310,7 @@ EOF
case 'history_from_filter':
$oPage->SetContentType('text/html');
$oHistoryFilter = CMDBSearchFilter::unserialize($sFilter);
$oHistoryFilter = DBSearch::unserialize($sFilter);
$iStart = (int)utils::ReadParam('start', 0);
$iCount = (int)utils::ReadParam('count', MetaModel::GetConfig()->Get('max_history_length', '50'));
$oBlock = new HistoryBlock($oHistoryFilter, 'table', false);

View File

@@ -245,7 +245,7 @@ try
case 'audit':
default:
$oP->add('<div class="page_header"><h1>'.Dict::S('UI:Audit:InteractiveAudit').'</h1><img style="margin-top: -20px; margin-right: 10px; float: right;" src="../images/clean.png"/></div>');
$oAuditFilter = new CMDBSearchFilter('AuditCategory');
$oAuditFilter = new DBObjectSearch('AuditCategory');
$oCategoriesSet = new DBObjectSet($oAuditFilter);
$oP->add("<table style=\"margin-top: 1em; padding: 0px; border-top: 3px solid #f6f6f1; border-left: 3px solid #f6f6f1; border-bottom: 3px solid #e6e6e1; border-right: 3px solid #e6e6e1;\">\n");
$oP->add("<tr><td>\n");
@@ -271,7 +271,7 @@ try
$aResults = array();
$oDefinitionSet = new CMDBObjectSet($oDefinitionFilter);
$iCount = $oDefinitionSet->Count();
$oRulesFilter = new CMDBSearchFilter('AuditRule');
$oRulesFilter = new DBObjectSearch('AuditRule');
$oRulesFilter->AddCondition('category_id', $oAuditCategory->GetKey(), '=');
$oRulesSet = new DBObjectSet($oRulesFilter);
while($oAuditRule = $oRulesSet->fetch() )

View File

@@ -1,5 +1,5 @@
<?php
// Copyright (C) 2010-2012 Combodo SARL
// Copyright (C) 2010-2015 Combodo SARL
//
// This file is part of iTop.
//
@@ -20,7 +20,7 @@
/**
* Implementation of iTop SOAP services
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @copyright Copyright (C) 2010-2015 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -364,7 +364,7 @@ abstract class WebServicesBase
}
$sKeyClass = $oExtKey->GetTargetClass();
$oReconFilter = new CMDBSearchFilter($sKeyClass);
$oReconFilter = new DBObjectSearch($sKeyClass);
foreach ($aExtKeyDesc as $sForeignAttCode => $value)
{
if (!MetaModel::IsValidFilterCode($sKeyClass, $sForeignAttCode))
@@ -443,7 +443,7 @@ abstract class WebServicesBase
$oRes->LogError("Parameter $sParamName: '$sTargetClass' is not a child class of '$sLinkedClass'");
continue; // skip
}
$oReconFilter = new CMDBSearchFilter($sTargetClass);
$oReconFilter = new DBObjectSearch($sTargetClass);
$aCIStringDesc = array();
foreach ($aItemData['search'] as $sAttCode => $value)
{