New XML format, updated the transformation tool (UpgradeDocument)

SVN:trunk[3361]
This commit is contained in:
Romain Quetiez
2014-10-10 08:22:51 +00:00
parent 472802e11b
commit 570e4f8589

View File

@@ -532,7 +532,7 @@ class ModelFactory
$oNode->parentNode->removeChild($oNode);
}
}
// Adjust the XML to transparently add an id (=percent) on all thresholds of stopwatches
// which don't already have one
$oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeStopWatch']/thresholds/threshold/percent");
@@ -541,18 +541,24 @@ class ModelFactory
$oNode->parentNode->SetAttribute('id', $oNode->textContent);
$oNode->parentNode->removeChild($oNode);
}
// Adjust the XML to transparently add an id (=type:<type>) on all allowed actions (profiles)
// Adjust the XML to transparently add an id (=action:<type>) on all allowed actions (profiles)
// which don't already have one
$oNodeList = $oXPath->query('/itop_design/user_rights/profiles/profile/groups/group/actions/action');
foreach ($oNodeList as $oNode)
{
if ($oNode->getAttribute('id') == '')
{
$oNode->SetAttribute('id', 'type:' . $oNode->getAttribute('xsi:type'));
$oNode->SetAttribute('id', 'action:' . $oNode->getAttribute('xsi:type'));
$oNode->removeAttribute('xsi:type');
}
elseif ($oNode->getAttribute('xsi:type') == 'stimulus')
{
$oNode->SetAttribute('id', 'stimulus:' . $oNode->getAttribute('id'));
$oNode->removeAttribute('xsi:type');
}
}
// Adjust the XML to transparently add an id (=value) on all values of an enum which don't already have one.
// This enables altering an enum for just adding/removing one value, intead of redefining the whole list of values.
$oNodeList = $oXPath->query("/itop_design/classes//class/fields/field[@xsi:type='AttributeEnum']/values/value");