aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-06-24 14:10:34 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-07-05 09:57:01 +0000
commitde0df941356d809c16f8851c2f3f72f61c4ea928 (patch)
tree31fc11aa69e460f1d7975e378b402ed79a5753c9
parent00875f083ffd56b2b861c147c5ef0fe928b77202 (diff)
Fix sonar issues
Fix sonar/checkstyle issues in sdc code Issue-ID: SDC-3158 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: I33638b39d39b7e918437cb9f3e0f15d52fa92218
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/auditing/api/AuditEventFactory.java9
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/EcompIntImpl.java178
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java13
3 files changed, 95 insertions, 105 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/api/AuditEventFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/api/AuditEventFactory.java
index 99c1ac3528..541fea815a 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/api/AuditEventFactory.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/api/AuditEventFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,14 +20,15 @@
package org.openecomp.sdc.be.auditing.api;
+import java.util.List;
import org.javatuples.Pair;
import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent;
-import java.util.List;
-
public interface AuditEventFactory {
String getLogMessage();
+
AuditingGenericEvent getDbEvent();
+
List<Pair<String, String>> getQueryParams();
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/EcompIntImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/EcompIntImpl.java
index 1b22889309..783d1fc754 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/EcompIntImpl.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/EcompIntImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,6 +21,10 @@
package org.openecomp.sdc.be.ecomp;
import fj.data.Either;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestAPIService;
import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
@@ -44,35 +48,27 @@ import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoader;
-import javax.servlet.http.HttpServletRequest;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-
public class EcompIntImpl implements IPortalRestAPIService {
- private static final String FAILED_TO_CONVERT_ROLES = "Failed to convert Roles";
- public static final String FAILED_TO_GET_ROLES = "Failed to get Roles";
- private static final String GET_USER_ROLES = "GetUserRoles";
- public static final String ERROR_FAILED_TO_GET_ROLES = "Error: Failed to get Roles";
- private static final String PUSH_USER_ROLE = "PushUserRole";
- private static final String FAILED_TO_FETCH_ROLES = "Failed to fetch roles";
- private static final String FAILED_TO_CONVERT_USER2 = "Failed to convert User {}";
- private static final String GET_USERS = "GetUsers";
- private static final String FAILED_TO_GET_USERS = "Failed to get Users";
- private static final String GET_USER = "GetUser";
- private static final String FAILED_TO_GET_USER = "Failed to get User";
- private static final String FAILED_TO_UPDATE_USER_CREDENTIALS = "Failed to updateUserCredentials";
- private static final String FAILED_TO_EDIT_USER = "Failed to edit user";
- private static final String EDIT_USER = "EditUser";
- private static final String RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID = "Received null for argument loginId";
- private static final String NULL_POINTER_RETURNED_FROM_USER_CONVERTER = "NULL pointer returned from user converter";
- private static final String FAILED_TO_CREATE_USER = "Failed to create user {}";
- private static final String FAILED_TO_CONVERT_USER = "Failed to convert user";
- private static final String JH0003 = "jh0003";
- private static final String PUSH_USER = "PushUser";
- private static final String RECEIVED_NULL_FOR_ARGUMENT_USER = "Received null for argument user";
- private static final Logger log = Logger.getLogger(EcompIntImpl.class.getName());
+ private static final String FAILED_TO_CONVERT_ROLES = "Failed to convert Roles";
+ public static final String FAILED_TO_GET_ROLES = "Failed to get Roles";
+ private static final String GET_USER_ROLES = "GetUserRoles";
+ public static final String ERROR_FAILED_TO_GET_ROLES = "Error: Failed to get Roles";
+ private static final String PUSH_USER_ROLE = "PushUserRole";
+ private static final String FAILED_TO_FETCH_ROLES = "Failed to fetch roles";
+ private static final String FAILED_TO_CONVERT_USER2 = "Failed to convert User {}";
+ private static final String GET_USERS = "GetUsers";
+ private static final String FAILED_TO_GET_USERS = "Failed to get Users";
+ private static final String GET_USER = "GetUser";
+ private static final String FAILED_TO_GET_USER = "Failed to get User";
+ private static final String FAILED_TO_UPDATE_USER_CREDENTIALS = "Failed to updateUserCredentials";
+ private static final String FAILED_TO_EDIT_USER = "Failed to edit user";
+ private static final String EDIT_USER = "EditUser";
+ private static final String RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID = "Received null for argument loginId";
+ private static final String FAILED_TO_CREATE_USER = "Failed to create user {}";
+ private static final String JH0003 = "jh0003";
+ private static final String PUSH_USER = "PushUser";
+ private static final String RECEIVED_NULL_FOR_ARGUMENT_USER = "Received null for argument user";
+ private static final Logger log = Logger.getLogger(EcompIntImpl.class.getName());
public EcompIntImpl() {
log.debug("EcompIntImpl Class Instantiated");
@@ -83,7 +79,8 @@ public class EcompIntImpl implements IPortalRestAPIService {
log.debug("Start handle request of ECOMP pushUser");
try {
if (user == null) {
- BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, RECEIVED_NULL_FOR_ARGUMENT_USER, ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(PUSH_USER, RECEIVED_NULL_FOR_ARGUMENT_USER, ErrorSeverity.INFO);
log.debug(RECEIVED_NULL_FOR_ARGUMENT_USER);
throw new PortalAPIException(RECEIVED_NULL_FOR_ARGUMENT_USER);
}
@@ -94,11 +91,6 @@ public class EcompIntImpl implements IPortalRestAPIService {
log.debug("modifier id is {}", modifierAttId);
User convertedAsdcUser = EcompUserConverter.convertEcompUserToUser(user);
- if (convertedAsdcUser == null) {
- BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, NULL_POINTER_RETURNED_FROM_USER_CONVERTER, ErrorSeverity.INFO);
- log.debug(FAILED_TO_CREATE_USER, user);
- throw new PortalAPIException("Failed to create user " + convertedAsdcUser);
- }
userBusinessLogic.createUser(modifierAttId, convertedAsdcUser);
log.debug("User created {}", user);
} catch (ComponentException ce) {
@@ -106,13 +98,14 @@ public class EcompIntImpl implements IPortalRestAPIService {
log.debug("User already exist {}", user);
} else {
log.debug(FAILED_TO_CREATE_USER, user);
- BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, FAILED_TO_CREATE_USER, ErrorSeverity.ERROR);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(PUSH_USER, FAILED_TO_CREATE_USER, ErrorSeverity.ERROR);
throw new PortalAPIException(FAILED_TO_CREATE_USER + ce.getActionStatus());
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
log.debug(FAILED_TO_CREATE_USER, user, e);
- BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, FAILED_TO_CREATE_USER, ErrorSeverity.ERROR);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(PUSH_USER, FAILED_TO_CREATE_USER, ErrorSeverity.ERROR);
throw new PortalAPIException(FAILED_TO_CREATE_USER, e);
}
}
@@ -131,11 +124,13 @@ public class EcompIntImpl implements IPortalRestAPIService {
try {
if (user == null) {
log.debug(RECEIVED_NULL_FOR_ARGUMENT_USER);
- BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, RECEIVED_NULL_FOR_ARGUMENT_USER, ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(EDIT_USER, RECEIVED_NULL_FOR_ARGUMENT_USER, ErrorSeverity.INFO);
throw new PortalAPIException(RECEIVED_NULL_FOR_ARGUMENT_USER);
} else if (loginId == null) {
log.debug(RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID);
- BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID, ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(EDIT_USER, RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID, ErrorSeverity.INFO);
throw new PortalAPIException(RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID);
}
@@ -143,24 +138,21 @@ public class EcompIntImpl implements IPortalRestAPIService {
if (user.getLoginId() != null && !user.getLoginId().equals(loginId)) {
log.debug("loginId and user loginId not equal");
- BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, "loginId and user loginId not equal", ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(EDIT_USER, "loginId and user loginId not equal", ErrorSeverity.INFO);
throw new PortalAPIException("loginId not equals to the user loginId field");
} else if (user.getLoginId() == null) {
user.setLoginId(loginId);
}
User asdcUser = EcompUserConverter.convertEcompUserToUser(user);
- if (asdcUser == null) {
- log.debug(NULL_POINTER_RETURNED_FROM_USER_CONVERTER);
- BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, NULL_POINTER_RETURNED_FROM_USER_CONVERTER, ErrorSeverity.INFO);
- throw new PortalAPIException(FAILED_TO_EDIT_USER);
- }
-
- Either<User, ResponseFormat> updateUserCredentialsResponse = userBusinessLogic.updateUserCredentials(asdcUser);
+ Either<User, ResponseFormat> updateUserCredentialsResponse =
+ userBusinessLogic.updateUserCredentials(asdcUser);
if (updateUserCredentialsResponse.isRight()) {
log.debug(FAILED_TO_UPDATE_USER_CREDENTIALS);
- BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, FAILED_TO_UPDATE_USER_CREDENTIALS, ErrorSeverity.ERROR);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(EDIT_USER, FAILED_TO_UPDATE_USER_CREDENTIALS, ErrorSeverity.ERROR);
throw new PortalAPIException(FAILED_TO_EDIT_USER + updateUserCredentialsResponse.right().value());
}
} catch (Exception e) {
@@ -176,7 +168,8 @@ public class EcompIntImpl implements IPortalRestAPIService {
try {
if (loginId == null) {
log.debug(RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID);
- BeEcompErrorManager.getInstance().logInvalidInputError(GET_USER, RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID, ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(GET_USER, RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID, ErrorSeverity.INFO);
throw new PortalAPIException(RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID);
}
UserBusinessLogic userBusinessLogic = getUserBusinessLogic();
@@ -186,7 +179,8 @@ public class EcompIntImpl implements IPortalRestAPIService {
return ecompUser.left().value();
} else {
log.debug(FAILED_TO_GET_USER);
- BeEcompErrorManager.getInstance().logInvalidInputError(GET_USER, FAILED_TO_GET_USER, ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(GET_USER, FAILED_TO_GET_USER, ErrorSeverity.INFO);
throw new PortalAPIException(ecompUser.right().value());
}
} catch (ComponentException ce) {
@@ -194,8 +188,7 @@ public class EcompIntImpl implements IPortalRestAPIService {
BeEcompErrorManager.getInstance().logInvalidInputError(GET_USER, FAILED_TO_GET_USER, ErrorSeverity.INFO);
throw new PortalAPIException(FAILED_TO_GET_USER + ce.getActionStatus());
- }
- catch (Exception e) {
+ } catch (Exception e) {
log.debug(FAILED_TO_GET_USER);
throw new PortalAPIException(FAILED_TO_GET_USER, e);
}
@@ -211,13 +204,11 @@ public class EcompIntImpl implements IPortalRestAPIService {
List<EcompUser> ecompUserList = new LinkedList<>();
for (User user : users) {
Either<EcompUser, String> ecompUser = EcompUserConverter.convertUserToEcompUser(user);
- if (ecompUser.isRight()) {
- log.debug(FAILED_TO_CONVERT_USER2, user);
- BeEcompErrorManager.getInstance().logInvalidInputError(GET_USERS, "Failed to convert User" + user.toString(), ErrorSeverity.WARNING);
- continue;
- } else if (ecompUser.left().value() == null) {
+ if (ecompUser.isRight() || ecompUser.left().value() == null) {
log.debug(FAILED_TO_CONVERT_USER2, user);
- BeEcompErrorManager.getInstance().logInvalidInputError(GET_USERS, "Failed to convert User" + user.toString(), ErrorSeverity.WARNING);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(GET_USERS, "Failed to convert User" + user.toString(),
+ ErrorSeverity.WARNING);
continue;
}
ecompUserList.add(ecompUser.left().value());
@@ -249,14 +240,15 @@ public class EcompIntImpl implements IPortalRestAPIService {
return ecompRolesList;
} catch (Exception e) {
log.debug(FAILED_TO_FETCH_ROLES);
- BeEcompErrorManager.getInstance().logInvalidInputError("GetAvailableRoles", FAILED_TO_FETCH_ROLES, ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError("GetAvailableRoles", FAILED_TO_FETCH_ROLES, ErrorSeverity.INFO);
throw new PortalAPIException("Roles fetching failed", e);
}
}
/**
- * The user role updated through this method only
+ * The user role updated through this method only.
*/
@Override
public void pushUserRole(String loginId, List<EcompRole> roles) throws PortalAPIException {
@@ -277,22 +269,23 @@ public class EcompIntImpl implements IPortalRestAPIService {
log.debug("pushing role: {} to user: {}", updatedRole, loginId);
try {
userBusinessLogic.updateUserRole(modifierAttId, loginId, updatedRole);
- }
- catch (Exception e) {
+ } catch (Exception e) {
log.debug("Error: Failed to update role");
- BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER_ROLE, "Failed to update role", ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(PUSH_USER_ROLE, "Failed to update role", ErrorSeverity.INFO);
throw new PortalAPIException("Failed to update role" + e);
}
} else {
log.debug("Error: No roles in List");
- BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER_ROLE, FAILED_TO_FETCH_ROLES, ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(PUSH_USER_ROLE, FAILED_TO_FETCH_ROLES, ErrorSeverity.INFO);
//in this cases we want to deactivate the user
try {
getUserBusinessLogicExt().deActivateUser(modifierAttId, loginId);
- }
- catch (Exception e) {
- log.debug("Error: Failed to deactivate user {}",loginId);
- BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER_ROLE, "Failed to deactivate user", ErrorSeverity.INFO);
+ } catch (Exception e) {
+ log.debug("Error: Failed to deactivate user {}", loginId);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(PUSH_USER_ROLE, "Failed to deactivate user", ErrorSeverity.INFO);
throw new PortalAPIException("Error: Failed to deactivate user" + e);
}
}
@@ -307,38 +300,42 @@ public class EcompIntImpl implements IPortalRestAPIService {
Either<EcompUser, String> ecompUser = EcompUserConverter.convertUserToEcompUser(user);
if (ecompUser.isRight()) {
log.debug("Error: Failed to convert Roles");
- BeEcompErrorManager.getInstance().logInvalidInputError(GET_USER_ROLES, FAILED_TO_CONVERT_ROLES, ErrorSeverity.ERROR);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(GET_USER_ROLES, FAILED_TO_CONVERT_ROLES, ErrorSeverity.ERROR);
throw new PortalAPIException(ecompUser.right().value());
} else if (ecompUser.left().value() == null) {
log.debug("Error: Failed to convert Roles");
- BeEcompErrorManager.getInstance().logInvalidInputError(GET_USER_ROLES, FAILED_TO_CONVERT_ROLES, ErrorSeverity.ERROR);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(GET_USER_ROLES, FAILED_TO_CONVERT_ROLES, ErrorSeverity.ERROR);
throw new PortalAPIException();
}
return new LinkedList<>(ecompUser.left().value().getRoles());
} catch (ComponentException ce) {
log.debug(ERROR_FAILED_TO_GET_ROLES);
- BeEcompErrorManager.getInstance().logInvalidInputError(GET_USER_ROLES, FAILED_TO_GET_ROLES, ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(GET_USER_ROLES, FAILED_TO_GET_ROLES, ErrorSeverity.INFO);
throw new PortalAPIException(FAILED_TO_GET_ROLES + ce.getActionStatus());
- }
- catch (Exception e) {
+ } catch (Exception e) {
log.debug(ERROR_FAILED_TO_GET_ROLES);
- BeEcompErrorManager.getInstance().logInvalidInputError(GET_USER_ROLES, FAILED_TO_GET_ROLES, ErrorSeverity.INFO);
+ BeEcompErrorManager.getInstance()
+ .logInvalidInputError(GET_USER_ROLES, FAILED_TO_GET_ROLES, ErrorSeverity.INFO);
throw new PortalAPIException(FAILED_TO_GET_ROLES, e);
}
}
@Override
- public boolean isAppAuthenticated(HttpServletRequest request, Map<String,String> appCredentials) throws PortalAPIException {
+ public boolean isAppAuthenticated(HttpServletRequest request, Map<String, String> appCredentials)
+ throws PortalAPIException {
final String portal_key = PortalApiProperties.getProperty("portal_pass");
final String portal_user = PortalApiProperties.getProperty("portal_user");
- final String USERNAME = request.getHeader("username");
- final String PASSWORD = request.getHeader("password");
+ final String username = request.getHeader("username");
+ final String password = request.getHeader("password");
- if (USERNAME != null && PASSWORD != null) {
+ if (username != null && password != null) {
try {
- if (USERNAME.equals(CipherUtil.decryptPKC(portal_user)) &&
- PASSWORD.equals(CipherUtil.decryptPKC(portal_key))) {
- log.debug("User authenticated - Username: {}", USERNAME);
+ if (username.equals(CipherUtil.decryptPKC(portal_user))
+ && password.equals(CipherUtil.decryptPKC(portal_key))) {
+ log.debug("User authenticated - Username: {}", username);
return true;
}
} catch (CipherUtilException e) {
@@ -365,26 +362,19 @@ public class EcompIntImpl implements IPortalRestAPIService {
* If any error occurs, the method should throw PortalApiException with an
* appropriate message. The FW library will catch the exception and send an
* appropriate response to Portal.
- *
- * As a guideline for AT&T specific implementation, see the sample apps
- * repository
- * https://codecloud.web.att.com/projects/EP_SDK/repos/ecomp_portal_sdk_third_party/
- * for a sample implementation for on-boarded applications using EPSDK-FW.
* However, the app can always choose to have a custom implementation of
* this method. For Open-source implementation, for example, the app will
* have a totally different implementation for this method.
- *
- * @param request
+ *
+ * @param request The HttpServletRequest
* @return true if the request contains appropriate credentials, else false.
- * @throws PortalAPIException
- * If an unexpected error occurs while processing the request.
+ * @throws PortalAPIException If an unexpected error occurs while processing the request.
*/
@Override
public String getUserId(HttpServletRequest request) throws PortalAPIException {
return request.getHeader(Constants.USER_ID_HEADER);
}
- //TODO for what the following method stands for
@Override
public Map<String, String> getCredentials() throws PortalAPIException {
return null;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java
index 9a5f5a5b61..ce23c6e368 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,6 +21,9 @@
package org.openecomp.sdc.be.ecomp.converters;
import fj.data.Either;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
import org.onap.portalsdk.core.restful.domain.EcompRole;
import org.onap.portalsdk.core.restful.domain.EcompUser;
@@ -28,10 +31,6 @@ import org.openecomp.sdc.be.dao.utils.UserStatusEnum;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.user.Role;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
public final class EcompUserConverter {
private EcompUserConverter() {
@@ -60,7 +59,7 @@ public final class EcompUserConverter {
for (Role role : Role.values()) {
if (role.name().equals(asdcUser.getRole()) || role.toString().equals(asdcUser.getRole())) {
convertedRole.setName(role.name());
- convertedRole.setId(new Long(role.ordinal()));
+ convertedRole.setId((long) role.ordinal());
break;
}
}