mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Added helpers to export the datamodel
SVN:trunk[1653]
This commit is contained in:
@@ -116,20 +116,12 @@ abstract class AttributeDefinition
|
||||
$this->m_aParams = $aParams;
|
||||
$this->ConsistencyCheck();
|
||||
}
|
||||
public function OverloadParams($aParams)
|
||||
|
||||
public function GetParams()
|
||||
{
|
||||
foreach ($aParams as $sParam => $value)
|
||||
{
|
||||
if (!array_key_exists($sParam, $this->m_aParams))
|
||||
{
|
||||
throw new CoreException("Unknown attribute definition parameter '$sParam', please select a value in {".implode(", ", array_keys($this->m_aParams))."}");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->m_aParams[$sParam] = $value;
|
||||
}
|
||||
}
|
||||
return $this->m_aParams;
|
||||
}
|
||||
|
||||
public function SetHostClass($sHostClass)
|
||||
{
|
||||
$this->m_sHostClass = $sHostClass;
|
||||
|
||||
@@ -50,21 +50,6 @@ abstract class FilterDefinition
|
||||
$this->ConsistencyCheck();
|
||||
}
|
||||
|
||||
public function OverloadParams($aParams)
|
||||
{
|
||||
foreach ($aParams as $sParam => $value)
|
||||
{
|
||||
if (!array_key_exists($sParam, $this->m_aParams))
|
||||
{
|
||||
throw new CoreException("Unknown attribute definition parameter '$sParam', please select a value in {".implode(", ", $this->m_aParams)."}");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->m_aParams[$sParam] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// to be overloaded
|
||||
static protected function ListExpectedParams()
|
||||
{
|
||||
|
||||
@@ -1542,16 +1542,6 @@ if (!array_key_exists($sAttCode, self::$m_aAttribDefs[$sClass]))
|
||||
self::$m_aChildClasses[$sAncestorClass][] = $sTargetClass;
|
||||
}
|
||||
}
|
||||
public static function Init_OverloadAttributeParams($sAttCode, $aParams)
|
||||
{
|
||||
$sTargetClass = self::GetCallersPHPClass("Init");
|
||||
|
||||
if (!self::IsValidAttCode($sTargetClass, $sAttCode))
|
||||
{
|
||||
throw new CoreException("Could not overload '$sAttCode', expecting a code from {".implode(", ", self::GetAttributesList($sTargetClass))."}");
|
||||
}
|
||||
self::$m_aAttribDefs[$sTargetClass][$sAttCode]->OverloadParams($aParams);
|
||||
}
|
||||
|
||||
protected static function Init_IsKnownClass($sClass)
|
||||
{
|
||||
|
||||
@@ -187,6 +187,11 @@ class ValueSetObjects extends ValueSetDefinition
|
||||
{
|
||||
return 'Filter: '.$this->m_sFilterExpr;
|
||||
}
|
||||
|
||||
public function GetFilterExpression()
|
||||
{
|
||||
return $this->m_sFilterExpr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -278,6 +283,13 @@ class ValueSetEnum extends ValueSetDefinition
|
||||
$this->m_values = $Values;
|
||||
}
|
||||
|
||||
// Helper to export the datat model
|
||||
public function GetValueList()
|
||||
{
|
||||
$this->LoadValues($aArgs = array());
|
||||
return $this->m_aValues;
|
||||
}
|
||||
|
||||
protected function LoadValues($aArgs)
|
||||
{
|
||||
if (is_array($this->m_values))
|
||||
|
||||
Reference in New Issue
Block a user