diff options
author | 2017-05-09 14:24:20 -0400 | |
---|---|---|
committer | 2017-05-09 14:44:09 -0400 | |
commit | e2aefda183de4f1c1256d97f7ce09f8bee5477db (patch) | |
tree | 4b0eaf3f153df90591711daf081e63a8b20ace74 /dcae_dmaapbc_webapp/dbca-overlay/src/main/webapp/app/dbcapp/datarouter/dr-feed-service.js | |
parent | 472635713b7471b300a988db7e907bab0119eaee (diff) |
[ONAP-rebase] Rebase as 1.1.0-SNAPSHOT
Consolidate into a single maven project; no more separate model and client jars.
Change-Id: Ibbba982250b74c0dfd09ee1c65c0fb6c158dd632
Signed-off-by: Christopher Lott <cl778h@att.com>
Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'dcae_dmaapbc_webapp/dbca-overlay/src/main/webapp/app/dbcapp/datarouter/dr-feed-service.js')
-rw-r--r-- | dcae_dmaapbc_webapp/dbca-overlay/src/main/webapp/app/dbcapp/datarouter/dr-feed-service.js | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/dcae_dmaapbc_webapp/dbca-overlay/src/main/webapp/app/dbcapp/datarouter/dr-feed-service.js b/dcae_dmaapbc_webapp/dbca-overlay/src/main/webapp/app/dbcapp/datarouter/dr-feed-service.js new file mode 100644 index 0000000..b8dd706 --- /dev/null +++ b/dcae_dmaapbc_webapp/dbca-overlay/src/main/webapp/app/dbcapp/datarouter/dr-feed-service.js @@ -0,0 +1,107 @@ +appDS2.factory('DRFeedService', function ($http, $q, $log) { + return { + /** + * Gets one page of data router feed objects. + * @param {Number} pageNum - page number; e.g., 1 + * @param {Number} viewPerPage - number of items per page; e.g., 25 + * @return {JSON} Response object from remote side + */ + getFeedsByPage: function(pageNum,viewPerPage) { + // cache control for IE + var cc = "&cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'dr_feed?pageNum=' + pageNum + '&viewPerPage=' + viewPerPage + cc, + cache: false, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRFeedService.getFeedsByPage: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRFeedService.getFeedsByPage failed: ' + JSON.stringify(error)); + return $q.reject(error.statusText); + }); + }, + + // Creates a new feed. + addFeed: function(feed) { + return $http({ + method: 'POST', + url: 'dr_feed', + data: feed, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRFeedService.addFeed: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRFeedService.addFeed failed: ' + JSON.stringify(error)); + return $q.reject(error.statusText); + }); + }, + + // Updates an existing feed. + updateFeed: function(feed) { + return $http({ + method: 'PUT', + url: 'dr_feed/' + feed.feedId, + data: feed, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRFeedService.updateFeed: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRFeedService.updateFeed failed: ' + JSON.stringify(error)); + return $q.reject(error.statusText); + }); + }, + + // Deletes the feed with the specified ID. + deleteFeed: function(feedId) { + return $http({ + method: 'DELETE', + url: 'dr_feed/' + feedId, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRFeedService.deleteFeed: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRFeedService.deleteFeed failed: ' + JSON.stringify(error)); + return $q.reject(error.statusText); + }); + }, + + /** + * Gets a list of string values that classify data sensitivity. + */ + getFeedPiiTypes: function() { + return $http({ + method: 'GET', + url: 'dr_feed_pii_types', + cache: false, + responseType: 'json' }) + .then(function(response) { + if (response.data == null || typeof response.data != 'object') + return $q.reject('DRFeedService.getFeedPiiTypes: response.data null or not object'); + else + return response.data; + }, + function(error) { + $log.error('DRFeedService.getFeedPiiTypes failed: ' + JSON.stringify(error)); + return $q.reject(error.statusText); + }); + }, + + }; +}); |