/**
  * @param tx_rnbase_parameters $parameters
  * @param tx_rnbase_configurations $configurations
  *
  * @return string
  */
 function execute(&$parameters, &$configurations)
 {
     $this->setConfigurations($configurations);
     $debugKey = $configurations->get($this->getConfId() . '_debugview');
     $debug = $debugKey && ($debugKey === '1' || $_GET['debug'] && array_key_exists($debugKey, array_flip(tx_rnbase_util_Strings::trimExplode(',', $_GET['debug']))) || $_POST['debug'] && array_key_exists($debugKey, array_flip(tx_rnbase_util_Strings::trimExplode(',', $_POST['debug']))));
     if ($debug) {
         $time = microtime(TRUE);
         $memStart = memory_get_usage();
     }
     if ($configurations->getBool($this->getConfId() . 'toUserInt')) {
         if ($debug) {
             tx_rnbase_util_Debug::debug('Converting to USER_INT!', 'View statistics for: ' . $this->getConfId() . ' Key: ' . $debugKey);
         }
         $configurations->convertToUserInt();
     }
     // Add JS or CSS files
     $this->addResources($configurations, $this->getConfId());
     $cacheHandler = $this->getCacheHandler($configurations, $this->getConfId() . '_caching.');
     $out = $cacheHandler ? $cacheHandler->getOutput() : '';
     $cached = !empty($out);
     if (!$cached) {
         $viewData =& $configurations->getViewData();
         tx_rnbase_util_Misc::pushTT(get_class($this), 'handleRequest');
         $out = $this->handleRequest($parameters, $configurations, $viewData);
         tx_rnbase_util_Misc::pullTT();
         if (!$out) {
             // View
             // It is possible to set another view via typoscript
             $viewClassName = $configurations->get($this->getConfId() . 'viewClassName');
             $viewClassName = strlen($viewClassName) > 0 ? $viewClassName : $this->getViewClassName();
             // TODO: error handling...
             $view = tx_rnbase::makeInstance($viewClassName);
             $view->setTemplatePath($configurations->getTemplatePath());
             if (method_exists($view, 'setController')) {
                 $view->setController($this);
             }
             // Das Template wird komplett angegeben
             $tmplName = $this->getTemplateName();
             if (!$tmplName || !strlen($tmplName)) {
                 tx_rnbase_util_Misc::mayday('No template name defined!');
             }
             $view->setTemplateFile($configurations->get($tmplName . 'Template', TRUE));
             tx_rnbase_util_Misc::pushTT(get_class($this), 'render');
             $out = $view->render($tmplName, $configurations);
             tx_rnbase_util_Misc::pullTT();
         }
         if ($cacheHandler) {
             $cacheHandler->setOutput($out);
         }
     }
     if ($debug) {
         $memEnd = memory_get_usage();
         tx_rnbase_util_Debug::debug(array('Action' => get_class($this), 'Conf Id' => $this->getConfId(), 'Execution Time' => microtime(TRUE) - $time, 'Memory Start' => $memStart, 'Memory End' => $memEnd, 'Memory Consumed' => $memEnd - $memStart, 'Cached?' => $cached ? 'yes' : 'no', 'CacheHandler' => is_object($cacheHandler) ? get_class($cacheHandler) : '', 'SubstCacheEnabled?' => tx_rnbase_util_Templates::isSubstCacheEnabled() ? 'yes' : 'no'), 'View statistics for: ' . $this->getConfId() . ' Key: ' . $debugKey);
     }
     // reset the substCache after each view!
     tx_rnbase_util_Templates::resetSubstCache();
     return $out;
 }