Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / app / policyApp / service / Dictionary / PolicyScopeService.js
1 /*-
2  * ============LICENSE_START=======================================================
3  * ECOMP Policy Engine
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 /**
22  */
23 app.factory('PolicyScopeService', function ($http, $q) {
24     return {
25
26         getPSClosedLoopDictionaryData : function(url){
27                         console.log("url on the service js: " + url);
28                         var url = url+'/ecomp/get_PSClosedLoopData';
29             return $http.get(url)
30                 .then(function(response) {
31                     if (typeof response.data === 'object') {
32                         return response.data;
33                     } else {
34                         return $q.reject(response.data);
35                     }
36
37                 }, function(response) {
38                     // something went wrong
39                     return $q.reject(response.data);
40                 });
41         },
42         
43         getPSClosedLoopDictionaryDataByName : function(url){
44                         console.log("url on the service js: " + url);
45                         var url = url+'/ecomp/get_PSClosedLoopDataByName';
46             return $http.get(url)
47                 .then(function(response) {
48                     if (typeof response.data === 'object') {
49                         return response.data;
50                     } else {
51                         return $q.reject(response.data);
52                     }
53
54                 }, function(response) {
55                     // something went wrong
56                     return $q.reject(response.data);
57                 });
58         },
59
60         getPSServiceDictionaryData: function(url) {
61                         console.log("url on the service js: " + url);
62                         var url = url+'/ecomp/get_PSServiceData';
63             return $http.get(url)
64                 .then(function(response) {
65                     if (typeof response.data === 'object') {
66                         return response.data;
67                     } else {
68                         return $q.reject(response.data);
69                     }
70
71                 }, function(response) {
72                     // something went wrong
73                     return $q.reject(response.data);
74                 });
75         },
76
77         getPSServiceDictionaryDataByName: function(url) {
78                         console.log("url on the service js: " + url);
79                         var url = url+'/ecomp/get_PSServiceDataByName';
80             return $http.get(url)
81                 .then(function(response) {
82                     if (typeof response.data === 'object') {
83                         return response.data;
84                     } else {
85                         return $q.reject(response.data);
86                     }
87
88                 }, function(response) {
89                     // something went wrong
90                     return $q.reject(response.data);
91                 });
92         },
93
94
95         getPSTypeDictionaryData : function(url){
96                         console.log("url on the service js: " + url);
97                         var url = url+'/ecomp/get_PSTypeData';
98             return $http.get(url)
99                 .then(function(response) {
100                     if (typeof response.data === 'object') {
101                         return response.data;
102                     } else {
103                         return $q.reject(response.data);
104                     }
105
106                 }, function(response) {
107                     // something went wrong
108                     return $q.reject(response.data);
109                 });
110         },
111
112         getPSTypeDictionaryDataByName : function(url){
113                         console.log("url on the service js: " + url);
114                         var url = url+'/ecomp/get_PSTypeDataByName';
115             return $http.get(url)
116                 .then(function(response) {
117                     if (typeof response.data === 'object') {
118                         return response.data;
119                     } else {
120                         return $q.reject(response.data);
121                     }
122
123                 }, function(response) {
124                     // something went wrong
125                     return $q.reject(response.data);
126                 });
127         },
128
129
130         getPSResourceDictionaryData : function(url){
131                         console.log("url on the service js: " + url);
132                         var url = url+'/ecomp/get_PSResourceData';
133             return $http.get(url)
134                 .then(function(response) {
135                     if (typeof response.data === 'object') {
136                         return response.data;
137                     } else {
138                         return $q.reject(response.data);
139                     }
140
141                 }, function(response) {
142                     // something went wrong
143                     return $q.reject(response.data);
144                 });
145         },
146         
147         getPSResourceDictionaryDataByName : function(url){
148                         console.log("url on the service js: " + url);
149                         var url = url+'/ecomp/get_PSResourceDataByName';
150             return $http.get(url)
151                 .then(function(response) {
152                     if (typeof response.data === 'object') {
153                         return response.data;
154                     } else {
155                         return $q.reject(response.data);
156                     }
157
158                 }, function(response) {
159                     // something went wrong
160                     return $q.reject(response.data);
161                 });
162         },
163
164
165         getPSGroupPolicyScopeDictionaryData : function(url){
166                         console.log("url on the service js: " + url);
167                         var url = url+'/ecomp/get_GroupPolicyScopeData';
168             return $http.get(url)
169                 .then(function(response) {
170                     if (typeof response.data === 'object') {
171                         return response.data;
172                     } else {
173                         return $q.reject(response.data);
174                     }
175
176                 }, function(response) {
177                     // something went wrong
178                     return $q.reject(response.data);
179                 });
180         }
181     };
182 });