/**
  * Validates that if a second request from the same event and bean record
  * is received, the second request should be invalidated and thus ignored.
  * @param PMSERequest $request
  * @return \PMSERequest
  */
 public function validateRequest(PMSERequest $request)
 {
     $this->logger->info("Validate Request " . get_class($this));
     $this->logger->debug(array("Request data:", $request));
     $args = $request->getArguments();
     $flowId = isset($args['idFlow']) ? $args['idFlow'] : (isset($args['flow_id']) ? $args['flow_id'] : '0');
     if (!isset($_SESSION['locked_flows']) || !in_array($flowId, $_SESSION['locked_flows'])) {
         $request->validate();
     } else {
         $request->invalidate();
     }
     return $request;
 }
 /**
  *
  * @param PMSERequest $request
  * @return type
  */
 public function getFlowDataList(PMSERequest $request)
 {
     $args = $request->getArguments();
     $flows = array();
     switch ($request->getType()) {
         case 'direct':
             switch (true) {
                 case isset($args['idFlow']):
                     $flows = $this->getFlowById($args['idFlow']);
                     break;
                 case isset($args['flow_id']):
                     $flows = $this->getFlowById($args['flow_id']);
                     break;
                 case isset($args['cas_id']) && isset($args['cas_index']):
                     $flows = $this->getFlowByCasIdCasIndex($args);
                     $args['idFlow'] = $flows[0]['id'];
                     $request->setArguments($args);
                     break;
             }
             break;
         case 'hook':
             $flows = $this->getAllEvents($request->getBean());
             break;
         case 'queue':
             $flows = $this->getFlowById($args['id']);
             break;
         case 'engine':
             $flows = $this->getFlowsByCasId($args['cas_id']);
             break;
     }
     return $flows;
 }