summaryrefslogtreecommitdiffstats
path: root/controller/feedcontroller.php
diff options
context:
space:
mode:
Diffstat (limited to 'controller/feedcontroller.php')
-rw-r--r--controller/feedcontroller.php80
1 files changed, 40 insertions, 40 deletions
diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php
index 9b5274fb5..c31d4d1d6 100644
--- a/controller/feedcontroller.php
+++ b/controller/feedcontroller.php
@@ -18,11 +18,11 @@ use \OCP\IConfig;
use \OCP\AppFramework\Controller;
use \OCP\AppFramework\Http;
-use \OCA\News\BusinessLayer\ItemBusinessLayer;
-use \OCA\News\BusinessLayer\FeedBusinessLayer;
-use \OCA\News\BusinessLayer\FolderBusinessLayer;
-use \OCA\News\BusinessLayer\BusinessLayerException;
-use \OCA\News\BusinessLayer\BusinessLayerConflictException;
+use \OCA\News\Service\ItemService;
+use \OCA\News\Service\FeedService;
+use \OCA\News\Service\FolderService;
+use \OCA\News\Service\ServiceNotFoundException;
+use \OCA\News\Service\ServiceConflictException;
use \OCA\News\Db\FeedType;
@@ -30,23 +30,23 @@ class FeedController extends Controller {
use JSONHttpError;
- private $feedBusinessLayer;
- private $folderBusinessLayer;
- private $itemBusinessLayer;
+ private $feedService;
+ private $folderService;
+ private $itemService;
private $userId;
private $settings;
public function __construct($appName,
IRequest $request,
- FolderBusinessLayer $folderBusinessLayer,
- FeedBusinessLayer $feedBusinessLayer,
- ItemBusinessLayer $itemBusinessLayer,
+ FolderService $folderService,
+ FeedService $feedService,
+ ItemService $itemService,
IConfig $settings,
$userId){
parent::__construct($appName, $request);
- $this->feedBusinessLayer = $feedBusinessLayer;
- $this->folderBusinessLayer = $folderBusinessLayer;
- $this->itemBusinessLayer = $itemBusinessLayer;
+ $this->feedService = $feedService;
+ $this->folderService = $folderService;
+ $this->itemService = $itemService;
$this->userId = $userId;
$this->settings = $settings;
}
@@ -61,17 +61,17 @@ class FeedController extends Controller {
// because of this we also pass the starred count and the newest
// item id which will be used for marking feeds read
$params = [
- 'feeds' => $this->feedBusinessLayer->findAll($this->userId),
- 'starred' => $this->itemBusinessLayer->starredCount($this->userId)
+ 'feeds' => $this->feedService->findAll($this->userId),
+ 'starred' => $this->itemService->starredCount($this->userId)
];
try {
$params['newestItemId'] =
- $this->itemBusinessLayer->getNewestItemId($this->userId);
+ $this->itemService->getNewestItemId($this->userId);
// An exception occurs if there is a newest item. If there is none,
// simply ignore it and do not add the newestItemId
- } catch (BusinessLayerException $ex) {}
+ } catch (ServiceNotFoundException $ex) {}
return $params;
}
@@ -94,17 +94,17 @@ class FeedController extends Controller {
// check if feed or folder exists
try {
if($feedType === FeedType::FOLDER){
- $this->folderBusinessLayer->find($feedId, $this->userId);
+ $this->folderService->find($feedId, $this->userId);
} elseif ($feedType === FeedType::FEED){
- $this->feedBusinessLayer->find($feedId, $this->userId);
+ $this->feedService->find($feedId, $this->userId);
// if its the first launch, those values will be null
} elseif($feedType === null){
- throw new BusinessLayerException('');
+ throw new ServiceNotFoundException('');
}
- } catch (BusinessLayerException $ex){
+ } catch (ServiceNotFoundException $ex){
$feedId = 0;
$feedType = FeedType::SUBSCRIPTIONS;
}
@@ -128,24 +128,24 @@ class FeedController extends Controller {
try {
// we need to purge deleted feeds if a feed is created to
// prevent already exists exceptions
- $this->feedBusinessLayer->purgeDeleted($this->userId, false);
+ $this->feedService->purgeDeleted($this->userId, false);
- $feed = $this->feedBusinessLayer->create($url, $parentFolderId, $this->userId);
+ $feed = $this->feedService->create($url, $parentFolderId, $this->userId);
$params = ['feeds' => [$feed]];
try {
$params['newestItemId'] =
- $this->itemBusinessLayer->getNewestItemId($this->userId);
+ $this->itemService->getNewestItemId($this->userId);
// An exception occurs if there is a newest item. If there is none,
// simply ignore it and do not add the newestItemId
- } catch (BusinessLayerException $ex) {}
+ } catch (ServiceNotFoundException $ex) {}
return $params;
- } catch(BusinessLayerConflictException $ex) {
+ } catch(ServiceConflictException $ex) {
return $this->error($ex, Http::STATUS_CONFLICT);
- } catch(BusinessLayerException $ex) {
+ } catch(ServiceNotFoundException $ex) {
return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY);
}
}
@@ -158,8 +158,8 @@ class FeedController extends Controller {
*/
public function delete($feedId){
try {
- $this->feedBusinessLayer->markDeleted($feedId, $this->userId);
- } catch(BusinessLayerException $ex) {
+ $this->feedService->markDeleted($feedId, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
return $this->error($ex, Http::STATUS_NOT_FOUND);
}
}
@@ -172,7 +172,7 @@ class FeedController extends Controller {
*/
public function update($feedId){
try {
- $feed = $this->feedBusinessLayer->update($feedId, $this->userId);
+ $feed = $this->feedService->update($feedId, $this->userId);
return [
'feeds' => [
@@ -185,7 +185,7 @@ class FeedController extends Controller {
]
];
- } catch(BusinessLayerException $ex) {
+ } catch(ServiceNotFoundException $ex) {
return $this->error($ex, Http::STATUS_NOT_FOUND);
}
}
@@ -199,8 +199,8 @@ class FeedController extends Controller {
*/
public function move($feedId, $parentFolderId){
try {
- $this->feedBusinessLayer->move($feedId, $parentFolderId, $this->userId);
- } catch(BusinessLayerException $ex) {
+ $this->feedService->move($feedId, $parentFolderId, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
return $this->error($ex, Http::STATUS_NOT_FOUND);
}
}
@@ -213,8 +213,8 @@ class FeedController extends Controller {
*/
public function rename($feedId, $feedTitle) {
try {
- $this->feedBusinessLayer->rename($feedId, $feedTitle, $this->userId);
- } catch(BusinessLayerException $ex) {
+ $this->feedService->rename($feedId, $feedTitle, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
return $this->error($ex, Http::STATUS_NOT_FOUND);
}
}
@@ -226,7 +226,7 @@ class FeedController extends Controller {
* @param array $json
*/
public function import($json) {
- $feed = $this->feedBusinessLayer->importArticles($json, $this->userId);
+ $feed = $this->feedService->importArticles($json, $this->userId);
$params = [];
@@ -245,7 +245,7 @@ class FeedController extends Controller {
* @param int $highestItemId
*/
public function read($feedId, $highestItemId){
- $this->itemBusinessLayer->readFeed($feedId, $highestItemId, $this->userId);
+ $this->itemService->readFeed($feedId, $highestItemId, $this->userId);
return [
'feeds' => [
@@ -265,8 +265,8 @@ class FeedController extends Controller {
*/
public function restore($feedId){
try {
- $this->feedBusinessLayer->unmarkDeleted($feedId, $this->userId);
- } catch(BusinessLayerException $ex) {
+ $this->feedService->unmarkDeleted($feedId, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
return $this->error($ex, Http::STATUS_NOT_FOUND);
}
}