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