90c3d00dcb5dfa216c29f8d83bc102451c95deab
[portal/sdk.git] /
1 appDS2.factory('DroolsService', function ($http, $q) {
2         return {
3                 getDroolsList: function() {
4                         return $http.get('getDrools')
5                         .then(function(response) {
6                                 console.log(response);
7                                 if (typeof response.data === 'object') {
8                                         return response.data;
9                                 } else {
10                                         return $q.reject(response.data);
11                                 }
12
13                         }, function(response) {
14                                 // something went wrong
15                                 return $q.reject(response.data);
16                         });
17                 },
18                 
19                 getDroolDetails: function(selectedFile) {
20                         return $http.get('getDroolDetails'+'?selectedFile=' + selectedFile )
21                         .then(function(response) {
22                                 if (typeof response.data === 'object') {
23                                         return response.data;
24                                 } else {
25                                         return $q.reject(response.data);
26                                 }
27
28                         }, function(response) {
29                                 // something went wrong
30                                 return $q.reject(response.data);
31                         });
32                 },
33                 executeDrools:function(droolsData) {
34                         return $http({
35                                 method: "POST",
36                 url: "post_drools/execute",
37                 data:droolsData
38                         }).then(function(response) {
39                                 console.log(response);
40                                 if (response.status == 200) {
41                                         return response.data;
42                                 } else {
43                                         return $q.reject(response.data);
44                                 }
45                                 return response.data;
46
47                         }, function(response) {
48                                 // something went wrong
49                                 return $q.reject(response.data);
50                         });
51                 }
52         };
53 });