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