summaryrefslogtreecommitdiffstats
path: root/businesslayer
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-26 10:46:32 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-26 11:52:50 +0200
commit5cc47b4f414026ecf16d8c7025571422367f7c58 (patch)
treef555d0769e0a594f3a8f873ff8b455e0bf2a00ee /businesslayer
parent5d41833874a69d2c9322a20ebb7815b6bb1b5adf (diff)
use last_modified column for finding new items (so we also see if they were updated or starred), use offset to paginate rather than item id
Diffstat (limited to 'businesslayer')
-rw-r--r--businesslayer/itembusinesslayer.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/businesslayer/itembusinesslayer.php b/businesslayer/itembusinesslayer.php
index 4fbca4af0..794da73b7 100644
--- a/businesslayer/itembusinesslayer.php
+++ b/businesslayer/itembusinesslayer.php
@@ -26,6 +26,7 @@
namespace OCA\News\BusinessLayer;
use \OCA\AppFramework\Utility\TimeFactory;
+use \OCA\AppFramework\Db\DoesNotExistException;
use \OCA\News\Db\Item;
use \OCA\News\Db\ItemMapper;
@@ -70,22 +71,25 @@ class ItemBusinessLayer extends BusinessLayer {
}
- public function findAll($id, $type, $limit, $offset,
- $showAll, $userId){
+ public function findAll($id, $type, $limit, $offset, $newestItemId, $showAll,
+ $userId){
+
$status = $this->statusFlag->typeToStatus($type, $showAll);
switch($type){
case FeedType::FEED:
$items = $this->mapper->findAllFeed($id, $limit, $offset,
- $status, $userId);
+ $newestItemId, $status,
+ $userId);
break;
case FeedType::FOLDER:
$items = $this->mapper->findAllFolder($id, $limit, $offset,
- $status, $userId);
+ $newestItemId, $status,
+ $userId);
break;
default:
- $items = $this->mapper->findAll($limit, $offset, $status,
- $userId);
+ $items = $this->mapper->findAll($limit, $offset, $newestItemId,
+ $status, $userId);
}
return $items;
@@ -138,4 +142,13 @@ class ItemBusinessLayer extends BusinessLayer {
}
+ public function getNewestItemId($userId) {
+ try {
+ return $this->mapper->getNewestItemId($userId);
+ } catch(DoesNotExistException $ex) {
+ throw new BusinessLayerException($ex->getMessage());
+ }
+ }
+
+
}