/**
  * Initiates the IcingaApiConnection
  * @return boolean
  * @throws IcingaApiException
  * @author mhein
  */
 private function initConnection()
 {
     $c = $this->configData;
     $type = AppKit::getConstant($c['api_type']);
     // if (!$type) throw new AppKitModelException('Could not get api_type \'%s\' for connection', $c['api_type']);
     $capi = array();
     foreach ($c as $ckey => $cdata) {
         if (strpos($ckey, 'config_') === 0) {
             $capi[substr($ckey, 7)] = $cdata;
         }
     }
     $this->apiData = IcingaApiConstants::getConnection($type, $capi);
     return true;
 }
 private function buildCommandArray($command, array $targets, $data)
 {
     $commands = array();
     foreach ($targets as $target) {
         $cmd = IcingaApiConstants::getCommandObject();
         $cmd->setCommand($command);
         foreach ($target as $field => $value) {
             $cmd->setTarget($field, $value);
         }
         foreach ($data as $field => $value) {
             $cmd->setTarget($field, $value);
         }
         $commands[] = $cmd;
     }
     return $commands;
 }