b314adec48020316540a887a2bbf0bcbcc39d4c2
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / service / EPAppService.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 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  * 
37  */
38 package org.onap.portalapp.portal.service;
39
40 import java.util.List;
41
42 import org.onap.portalapp.portal.domain.AdminUserApplications;
43 import org.onap.portalapp.portal.domain.AppIdAndNameTransportModel;
44 import org.onap.portalapp.portal.domain.AppsResponse;
45 import org.onap.portalapp.portal.domain.EPApp;
46 import org.onap.portalapp.portal.domain.EPUser;
47 import org.onap.portalapp.portal.domain.EcompApp;
48 import org.onap.portalapp.portal.domain.UserRoles;
49 import org.onap.portalapp.portal.ecomp.model.AppCatalogItem;
50 import org.onap.portalapp.portal.transport.EPAppsManualPreference;
51 import org.onap.portalapp.portal.transport.EPAppsSortPreference;
52 import org.onap.portalapp.portal.transport.EPDeleteAppsManualSortPref;
53 import org.onap.portalapp.portal.transport.EPWidgetsSortPreference;
54 import org.onap.portalapp.portal.transport.FieldsValidator;
55 import org.onap.portalapp.portal.transport.LocalRole;
56 import org.onap.portalapp.portal.transport.OnboardingApp;
57
58 public interface EPAppService {
59
60         /**
61          * Get all applications adminId is an admin
62          * 
63          * @param user
64          *            the admin user
65          * @return the admin's applications
66          */
67         List<EPApp> getUserAsAdminApps(EPUser user);
68
69         List<EPApp> getUserByOrgUserIdAsAdminApps(String orgUserId);
70
71         /**
72          * Gets all rows and all fields from the fn_app table.
73          * 
74          * @return list of EPApp objects
75          */
76         List<EPApp> getAppsFullList();
77
78         /**
79          * Gets all rows and most fields from the fn_app table.
80          * 
81          * @return list of EcompApp objects.
82          */
83         List<EcompApp> getEcompAppAppsFullList();
84
85         /**
86          * Get apps with app app admins
87          * 
88          * @return List of AdminUserApplications
89          */
90         List<AdminUserApplications> getAppsAdmins();
91
92         /**
93          * Get all apps from fn_app table (index, name, title only).
94          * 
95          * @param all
96          *            If all is true, returns active and inactive apps; otherwise,
97          *            just active apps.
98          * @return List of AppsResponse objects.
99          */
100         List<AppsResponse> getAllApps(Boolean all);
101
102         UserRoles getUserProfile(String loginId);
103
104         UserRoles getUserProfileNormalized(EPUser user);
105
106         List<LocalRole> getAppRoles(Long appId);
107
108         List<AppIdAndNameTransportModel> getAdminApps(EPUser user);
109
110         List<AppIdAndNameTransportModel> getAppsForSuperAdminAndAccountAdmin(EPUser user);
111
112         /**
113          * Gets the applications accessible to the specified user, which includes
114          * all enabled open applications, plus all enabled applications for which
115          * the user has a defined role for that app.
116          * 
117          * @param user
118          *            EPUser object with the user's Org User ID
119          * @return the user's list of applications, which may be empty.
120          */
121         List<EPApp> getUserApps(EPUser user);
122
123         /**
124          * Gets the user-personalized list of applications for the Portal (super)
125          * admin, which includes enabled open applications, enabled applications for
126          * which the user has a defined role for that app, and/or enabled
127          * applications which the user has chosen to show.
128          * 
129          * @param user
130          *            EPUser object with the user's Org User ID
131          * @return the user's personalized list of applications, which may be empty.
132          */
133         List<EPApp> getPersAdminApps(EPUser user);
134
135         /**
136          * Gets the user-personalized list of accessible applications, which
137          * includes enabled open applications and/or enabled applications for which
138          * the user has a defined role for that app. Personalization means the user
139          * can indicate an accessible application should be excluded from this
140          * result.
141          * 
142          * @param user
143          *            EPUser object with the user's Org User ID
144          * @return the user's personalized list of applications, which may be empty.
145          */
146         List<EPApp> getPersUserApps(EPUser user);
147
148         /**
149          * Gets the application catalog for the specified user who is a super admin.
150          * This includes all enabled applications. Each item indicates whether the
151          * user has access (open or via a role), and whether the application is
152          * selected for showing in the user's home (applications) page. Admin sees
153          * slightly different behavior - can force an app onto the home page using
154          * the personalization feature (user-app-selection table).
155          * 
156          * @param user
157          * @return list of all enabled applications, which may be empty
158          */
159         List<AppCatalogItem> getAdminAppCatalog(EPUser user);
160
161         /**
162          * Gets the application catalog for the specified user, who is a regular
163          * user. This includes all enabled applications. Each item indicates whether
164          * the user has access (open or via a role), and whether the application is
165          * selected for showing in the user's home (applications) page.
166          * 
167          * @param user
168          * @return list of all enabled applications, which may be empty
169          */
170         List<AppCatalogItem> getUserAppCatalog(EPUser user);
171
172         List<OnboardingApp> getOnboardingApps();
173
174         List<OnboardingApp> getEnabledNonOpenOnboardingApps();
175
176         FieldsValidator modifyOnboardingApp(OnboardingApp modifiedOnboardingApp, EPUser user);
177
178         FieldsValidator addOnboardingApp(OnboardingApp newOnboardingApp, EPUser user);
179
180         /**
181          * Deletes the specified application from all tables where the app_id is
182          * used, and ultimately from the fn_app table.
183          * 
184          * @param user
185          *            Must be Portal (super) administrator
186          * @param onboardingAppId
187          *            ID of application to be deleted
188          * @return Status code
189          */
190         FieldsValidator deleteOnboardingApp(EPUser user, Long onboardingAppId);
191
192         List<EcompApp> transformAppsToEcompApps(List<EPApp> appsList);
193
194         EPApp getApp(Long appId);
195
196         EPApp getAppDetail(String appName);
197         
198         /**
199          * 
200          * It return app information 
201          * 
202          * @param appName it contains application name
203          * @return EPApp 
204          */
205         EPApp getAppDetailByAppName(String appName);
206
207         List<EPApp> getAppsOrderByName(EPUser user);
208
209         FieldsValidator saveAppsSortPreference(EPAppsSortPreference appsSortPreference, EPUser user);
210
211         FieldsValidator saveAppsSortManual(List<EPAppsManualPreference> appsSortManual, EPUser user);
212
213         FieldsValidator saveWidgetsSortManual(List<EPWidgetsSortPreference> widgetsSortManual, EPUser user);
214
215         /**
216          * Deletes the sort order of user apps by sort manual preference
217          * 
218          * @param delAppSortManual
219          *            User Apps Data
220          * @param user
221          *            LoggedIn User Data
222          * @return FieldsValidator
223          */
224         FieldsValidator deleteUserAppSortManual(EPDeleteAppsManualSortPref delAppSortManual, EPUser user);
225
226         FieldsValidator deleteUserWidgetSortPref(List<EPWidgetsSortPreference> delWidgetSortPref, EPUser user);
227
228         String getUserAppsSortTypePreference(EPUser user);
229
230         List<EPApp> getAppsOrderByLastUsed(EPUser user);
231
232         List<EPApp> getAppsOrderByMostUsed(EPUser user);
233
234         List<EPApp> getAppsOrderByManual(EPUser user);
235
236         List<EPApp> getUserRemoteApps(String id);
237
238         void createOnboardingFromApp(EPApp app, OnboardingApp onboardingApp);
239
240         UserRoles getUserProfileNormalizedForLeftMenu(EPUser user);
241
242         UserRoles getUserProfileForLeftMenu(String loginId);
243
244         UserRoles getUserProfileForRolesLeftMenu(String loginId);
245
246         UserRoles getUserProfileNormalizedForRolesLeftMenu(EPUser user);
247
248 }