OQL enhancement: allow JOIN on a objclass/objkey pair of attributes (requires benchmarking)

SVN:trunk[3506]
This commit is contained in:
Romain Quetiez
2015-03-19 12:50:15 +00:00
parent 95fc4d867d
commit 444d9e36c6
9 changed files with 171 additions and 43 deletions

View File

@@ -1,5 +1,5 @@
<?php
// Copyright (C) 2014 Combodo SARL
// Copyright (C) 2014-2015 Combodo SARL
//
// This file is part of iTop.
//
@@ -35,7 +35,7 @@
* }
*/
define('ITOP_DESIGN_LATEST_VERSION', '1.1');
define('ITOP_DESIGN_LATEST_VERSION', '1.2');
class iTopDesignFormat
{
@@ -49,6 +49,12 @@ class iTopDesignFormat
'1.1' => array(
'previous' => '1.0',
'go_to_previous' => 'From11To10',
'next' => '1.2',
'go_to_next' => 'From11To12',
),
'1.2' => array(
'previous' => '1.1',
'go_to_previous' => 'From12To11',
'next' => null,
'go_to_next' => null,
),
@@ -362,6 +368,31 @@ class iTopDesignFormat
}
}
/**
* Upgrade the format from version 1.1 to 1.2
* @return void (Errors are logged)
*/
protected function From11To12($oFactory)
{
// Do nothing
}
/**
* Downgrade the format from version 1.2 to 1.1
* @return void (Errors are logged)
*/
protected function From12To11($oFactory)
{
$oXPath = new DOMXPath($this->oDocument);
// Transform ObjectKey attributes into Integer
$oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeObjectKey']");
foreach ($oNodeList as $oNode)
{
$oNode->setAttribute('xsi:type', 'AttributeInteger');
// The property class_attcode is left there (doing no harm)
}
}
/**
* Delete a node from the DOM and make sure to also remove the immediately following line break (DOMText), if any.
* This prevents generating empty lines in the middle of the XML