import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
+import java.util.Objects;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.stream.Collectors;
import org.onap.portal.domain.db.fn.FnRoleFunction;
import org.onap.portal.domain.dto.transport.CentralV2Role;
import org.onap.portal.domain.dto.transport.GlobalRoleWithApplicationRoleFunction;
-import org.onap.portal.domain.dto.transport.Role;
import org.onap.portal.exception.RoleFunctionException;
import org.onap.portal.logging.logic.EPLogUtil;
import org.onap.portal.service.ep.EpAppFunctionService;
+ " and c.appId.appId = :appId"
+ " and e.appId.appId = c.appId.appId";
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAccessRolesService.class);
- private RestTemplate template = new RestTemplate();
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAccessRolesService.class);
+ private final RestTemplate template = new RestTemplate();
private final FnRoleService fnRoleService;
private final FnAppService fnAppService;
CentralV2Role cenRole;
if (role.getAppRoleId() == null) {
cenRole = CentralV2Role.builder().id(role.getId()).created(role.getCreated())
- .modified(role.getModified()).createdId(role.getCreatedId().getUserId())
- .modifiedId(role.getModifiedId().getUserId()).rowNum(role.getRowNum()).name(role.getRoleName())
+ .modified(role.getModified())
+.rowNum(role.getRowNum()).name(role.getRoleName())
.active(role.getActiveYn()).priority(role.getPriority()).roleFunctions(roleFunctionSet)
.childRoles(childRoles).parentRoles(parentRoles).build();
} else {
cenRole = CentralV2Role.builder().id(role.getAppRoleId())
- .created(role.getCreated()).modified(role.getModified()).createdId(role.getCreatedId().getUserId())
- .modifiedId(role.getModifiedId().getUserId()).rowNum(role.getRowNum()).name(role.getRoleName())
+ .created(role.getCreated()).modified(role.getModified())
+.rowNum(role.getRowNum()).name(role.getRoleName())
.active(role.getActiveYn()).priority(role.getPriority()).roleFunctions(roleFunctionSet)
.childRoles(childRoles).parentRoles(parentRoles).build();
}
List<FnApp> app = fnAppService.getByUebKey(uebkey);
List<FnRole> appRolesList = fnRoleService.getAppRoles(app.get(0).getId());
roleList = createCentralRoleObject(app, appRolesList, roleList);
- if (app.get(0).getId() != PortalConstants.PORTAL_APP_ID) {
+ if (!Objects.equals(app.get(0).getId(), PortalConstants.PORTAL_APP_ID)) {
List<CentralV2Role> globalRoleList = getGlobalRolesOfApplication(app.get(0).getId());
List<FnRole> globalRolesList = fnRoleService.getGlobalRolesOfPortal();
List<CentralV2Role> portalsGlobalRolesFinlaList = new ArrayList<>();
private CentralV2Role convertRoleToCentralV2Role(FnRole role) {
return CentralV2Role.builder().id(role.getId()).created(role.getCreated())
- .modified(role.getModified()).createdId(role.getCreatedId().getUserId())
- .modifiedId(role.getModifiedId().getUserId())
+ .modified(role.getModified())
.rowNum(role.getRowNum()).name(role.getRoleName()).active(role.getActiveYn())
.priority(role.getPriority()).roleFunctions(new TreeSet<>()).childRoles(new TreeSet<>())
.parentRoles(new TreeSet<>()).build();
type = EcompPortalUtils.getFunctionType(role.getFunctionCd());
action = EcompPortalUtils.getFunctionAction(role.getFunctionCd());
cenRoleFun = FnRoleFunction.builder().build();
- FnRole fnRole = FnRole.builder().build();
+ FnRole fnRole = new FnRole();
FnFunction fnFunction = FnFunction.builder().functionCd(instance).name(role.getFunctionName()).type(type).action(action).build();
- cenRoleFun.setRoleId(fnRole);
+ cenRoleFun.setRole(fnRole);
cenRoleFun.setFunctionCd(fnFunction);
} else {
type = getFunctionCodeType(role.getFunctionCd());
action = getFunctionCodeAction(role.getFunctionCd());
FnFunction fnFunction = FnFunction.builder().functionCd(role.getFunctionCd()).name(role.getFunctionName()).type(type).action(action).build();
- cenRoleFun.setRoleId(new FnRole());
+ cenRoleFun.setRole(new FnRole());
cenRoleFun.setFunctionCd(fnFunction);
}
return cenRoleFun;