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