3438e787d1273580ada61faf870f00080befb52d
[portal/sdk.git] /
1 /*
2  * ============LICENSE_START==========================================
3  * ONAP Portal SDK
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.onap.portalsdk.core.onboarding.crossapi;
39
40 import java.util.Map;
41
42 import javax.servlet.http.HttpServletRequest;
43
44 import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
45 import org.onap.portalsdk.core.restful.domain.EcompUser;
46
47 public interface IPortalRestCentralService {
48         
49         /**
50          * Gets and returns the Map with username, password and appName of application .If any error
51          * occurs, the method should throw PortalApiException with an appropriate
52          * message. The FW library will catch the exception and send an appropriate
53          * response to Portal.
54          * 
55          * @return a map with keys username, password and appName
56          */
57         public Map<String, String> getAppCredentials() throws PortalAPIException;
58         
59         /**
60          * Creates a user with the specified details. If any error occurs, for example
61          * the user exists, the method should throw PortalApiException with an
62          * appropriate message. The FW library will catch the exception and send an
63          * appropriate response to Portal.
64          * 
65          * @param user
66          *            Model object with attributes of user to be created.
67          * @throws PortalAPIException
68          *             If any error occurs while processing the request; for example,
69          *             user exists.
70          */
71         public void pushUser(EcompUser user) throws PortalAPIException;
72         
73         /**
74          * Updates details about the user with the specified loginId. For example, mark
75          * user as inactive. If any error occurs, the method should throw
76          * PortalApiException with an appropriate message. The FW library will catch the
77          * exception and send an appropriate response to Portal.
78          * 
79          * @param loginId
80          *            EcompUser ID to be updated.
81          * @param user
82          *            Model object with attributes of user to be updated.
83          * @throws PortalAPIException
84          *             If any error occurs while processing the request; for example,
85          *             unknown user.
86          */
87         public void editUser(String loginId, EcompUser user) throws PortalAPIException;
88         
89         /**
90          * Gets and returns the userId for the logged-in user based on the request. If
91          * any error occurs, the method should throw PortalApiException with an
92          * appropriate message. The FW library will catch the exception and send an
93          * appropriate response to Portal.
94          * 
95          * @param request
96          *            HttpServletRequest
97          * @return true if the request contains appropriate credentials, else false.
98          * @throws PortalAPIException
99          *             If an unexpected error occurs while processing the request.
100          */
101         public String getUserId(HttpServletRequest request) throws PortalAPIException;
102
103 }