Update license; improve coverage; add docs dir
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / service / ExternalAccessRolesService.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the “License”);
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
37  */
38 package org.openecomp.portalapp.portal.service;
39
40 import java.util.List;
41
42 import org.hibernate.Session;
43 import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
44 import org.openecomp.portalapp.portal.domain.EPApp;
45 import org.openecomp.portalapp.portal.domain.EPRole;
46 import org.openecomp.portalapp.portal.domain.EPUser;
47 import org.openecomp.portalapp.portal.transport.CentralRole;
48 import org.openecomp.portalsdk.core.domain.Role;
49 import org.openecomp.portalsdk.core.domain.RoleFunction;
50 import org.openecomp.portalsdk.core.restful.domain.EcompUser;
51
52 public interface ExternalAccessRolesService {
53         
54         /**
55          * It gets list of application roles 
56          * 
57          * @param appId
58          * @return List
59          * @throws Exception 
60          */
61         public List<EPRole> getAppRoles(Long appId) throws Exception;
62         
63         /**
64          * It returns single app record
65          * 
66          * @param uebkey
67          * @return List
68          * @throws Exception 
69          */             
70         public List<EPApp> getApp(String uebkey) throws Exception;
71         
72         /**
73          * Adds role in the external access system if fails throws exception
74          * 
75          * @param addRoles
76          * @param uebkey
77          * @return boolean
78          * @throws Exception
79          */
80         public boolean addRole(Role addRoles, String uebkey) throws Exception;
81
82         /**
83          * It returns complete user information
84          * 
85          * @param loginId
86          * @return EPUser object
87          * @throws Exception
88          */
89         List<EPUser> getUser(String loginId) throws Exception;
90         
91         /**
92          * It returns complete user information including application roles permissions
93          * 
94          * @param loginId
95          * @param uebkey
96          * @return String
97          * @throws Exception
98          */
99         String getUserWithRoles(String loginId, String uebkey) throws Exception;
100
101         /**
102          * It returns list of all role functions
103          * @param string 
104          * @return List
105          * @throws Exception 
106          */
107         List<CentralRoleFunction> getRoleFuncList(String string) throws Exception;
108         
109         /**
110          * It return list of role provided by the app uebkey and roleId
111          * 
112          * @param roleId
113          * @param uebkey
114          * @return CentralRole
115          * @throws Exception
116          */
117         CentralRole getRoleInfo(Long roleId, String uebkey) throws Exception;
118         
119         /**
120          *  It returns the CentralRoleFunction object 
121          *   
122          * @param functionCode
123          * @param uebkey 
124          * @return CentralRoleFunction
125          * @throws Exception 
126          */
127         public CentralRoleFunction getRoleFunction(String functionCode, String uebkey) throws Exception;
128
129         /**
130          *  It saves role function in the DB
131          *  
132          * @param domainCentralRoleFunction
133          * @param requestedApp 
134          * @return true else false
135          * @throws Exception 
136          */
137         public boolean saveCentralRoleFunction(CentralRoleFunction domainCentralRoleFunction, EPApp requestedApp) throws Exception;
138
139         /**
140          * It deletes role function in the DB
141          * 
142          * @param code
143          * @param app 
144          */
145         public boolean deleteCentralRoleFunction(String code, EPApp app);
146
147         /**
148          * It gets all roles the applications
149          * 
150          * @param uebkey
151          * @return List
152          * @throws Exception 
153          */
154         public List<CentralRole> getRolesForApp(String uebkey) throws Exception;
155         
156         /**
157          * It saves role function in the DB
158          * 
159          * @param saveRole
160          * @param uebkey
161          * @throws Exception 
162          */
163         boolean saveRoleForApplication(Role saveRole, String uebkey) throws Exception;
164
165         /**
166          *  It deletes role in the DB
167          *  
168          * @param code
169          * @param uebkey
170          * @return true else false
171          * @throws Exception 
172          */
173         boolean deleteRoleForApplication(String code, String uebkey) throws Exception;
174
175         /**
176          * It gets all active roles for single application 
177          * 
178          * @param uebkey
179          * @return List
180          * @throws Exception
181          */
182         List<CentralRole> getActiveRoles(String uebkey) throws Exception;
183         
184         /**
185          * It deletes user related roles for an application in the table
186          * @param roleId
187          * @param uebkey
188          * @param LoginId 
189          * @return true else false
190          * @throws Exception 
191          */
192         public boolean deleteDependencyRoleRecord(Long roleId, String uebkey, String LoginId) throws Exception;
193         
194         /**
195          * It sync new functions codes and names from and updates role functions from external access system
196          * 
197          * @param app
198          * @throws Exception
199          */
200         public void syncRoleFunctionFromExternalAccessSystem(EPApp app) throws Exception;
201
202         /**
203          * It uploads portal functions into external auth system
204          * @param uebkey
205          * @return
206          * @throws Exception
207          */
208         public Integer bulkUploadFunctions(String uebkey) throws Exception;
209
210         /**
211          * It uploads portal roles into external auth system
212          * @param uebkey
213          * @return
214          * @throws Exception
215          */
216         public Integer bulkUploadRoles(String uebkey) throws Exception;
217
218         /**
219          * It uploads partner application role functions into external auth system
220          * 
221          * @param uebkey
222          * @param upload
223          * @throws Exception
224          */
225         public void bulkUploadPartnerFunctions(String uebkey, List<RoleFunction> upload) throws Exception;
226
227         /** 
228          * It uploads partner application role functions into external auth system
229          * 
230          * @param uebkey
231          * @param upload
232          * @throws Exception
233          */
234         public void bulkUploadPartnerRoles(String uebkey, List<Role> upload) throws Exception;
235
236         /**
237          * It returns total no. of portal application role functions records added in external auth system 
238          * @param uebkey
239          * @return
240          * @throws Exception
241          */
242         Integer bulkUploadRolesFunctions(String uebkey) throws Exception;
243         
244         /**
245          *  It syncs the roles and rolefunctions to the ecomp DB from AAF
246          * @param app
247          * @throws Exception
248          */
249         void syncApplicationRolesWithEcompDB(EPApp app) throws Exception;
250
251         /**
252          * It uploads list of user roles of the application into external auth system 
253          * 
254          * @param uebkey
255          * @return
256          * @throws Exception
257          */
258         public Integer bulkUploadUserRoles(String uebkey) throws Exception;
259
260         /**
261          * It Uploads partner application role functions into external auth system
262          * 
263          * @param uebkey
264          * @param roleList
265          * @throws Exception
266          */
267         void bulkUploadPartnerRoleFunctions(String uebkey, List<Role> roleList) throws Exception;
268
269         /**
270          * it deletes all dependency role records 
271          * 
272          * @param localSession
273          * @param roleId
274          * @param appId
275          * @throws Exception
276          */
277         public void deleteRoleDependencyRecords(Session localSession, Long roleId, Long appId) throws Exception;
278
279         /**
280          * It returns list of applications functions along with functions associated with global role
281          * 
282          * @param uebkey
283          * @return
284          * @throws Exception
285          */
286         List<String> getMenuFunctionsList(String uebkey) throws Exception;
287         
288         /**
289          * 
290          * @param uebkey applications UebKey
291          * @return
292          * @throws Exception
293          * Method getAllUsers returns all the active users of application
294          */
295         List<EcompUser> getAllAppUsers(String uebkey) throws Exception;
296
297 }