/**
  * Generates raw POST data
  *
  * Each commandtype is delegated to a separate builder method.
  *
  * @param  UpdateQuery      $query
  * @throws RuntimeException
  * @return string
  */
 public function getRawData($query)
 {
     $xml = '<update>';
     foreach ($query->getCommands() as $command) {
         switch ($command->getType()) {
             case UpdateQuery::COMMAND_ADD:
                 $xml .= $this->buildAddXml($command, $query);
                 break;
             case UpdateQuery::COMMAND_DELETE:
                 $xml .= $this->buildDeleteXml($command);
                 break;
             case UpdateQuery::COMMAND_OPTIMIZE:
                 $xml .= $this->buildOptimizeXml($command);
                 break;
             case UpdateQuery::COMMAND_COMMIT:
                 $xml .= $this->buildCommitXml($command);
                 break;
             case UpdateQuery::COMMAND_ROLLBACK:
                 $xml .= $this->buildRollbackXml();
                 break;
             default:
                 throw new RuntimeException('Unsupported command type');
                 break;
         }
     }
     $xml .= '</update>';
     return $xml;
 }