protected function _processDataMessage(InventoryData $dataMessage, Paging $paging, \App_ListFilter $filterList = null, $protoResponse = false) { $result = array(); $result['count'] = $dataMessage->getRowCounter(); $description = $dataMessage->getDescription(); if (!$description && $description !== "0") { $description = self::DEFAULT_GROUP_LABEL; } $result['label'] = $description; if (isset($filterList) && $filterList->getHighlighting() === null) { $cursor = $dataMessage->getHandler(); if ($result['label'] !== null) { $filterList->setGroup($result['label']); } $filterList->setCursor($cursor, $result['count'], $paging->getMaxTimeout()); $result['cursor'] = $cursor; } $rows = $dataMessage->getPageList(); //For streaming if ($protoResponse) { return $rows; } $items = array(); $codec = new \DrSlump\Protobuf\Codec\PhpArray(); if (!empty($rows)) { foreach ($rows as $row) { $data = $codec->encode($row); $id = $data['id']; $items[] = $this->_mapEricssonModelToModel($data); } } $result['items'] = $items; return $result; }
/** * Fetch page from Ericsson * * @param \App_ListFilter $filterList * @param Paging $paging * @return array Like array('items' => arrayOfItems) */ public function _fetchPageEricsson(\App_ListFilter $filterList, Paging $paging) { $id = $this->_getFetchPageCacheId($filterList->getCursor(), $paging->getPageSize(), $paging->getNpage()); if ($data = $this->getCache()->load($id)) { return $data; } $rows = $this->_fecthPageEricssonProto($filterList, $paging); if ($rows) { \App::log()->debug("[ListFromCursor] Fetched page from cursor."); $filterList->touchCursor(); return $this->_processList($rows, $filterList->getOldCount(), $filterList, $paging); } return false; }