&& (globalRole.toLowerCase().startsWith("global_")))) {
CentralV2UserApp cua = new CentralV2UserApp();
cua.setUserId(null);
- CentralApp cenApp = new CentralApp(1L, epApp.getCreated(), epApp.getModified(),
- epApp.getCreatedId(), epApp.getModifiedId(), epApp.getRowNum(), epApp.getName(),
- epApp.getImageUrl(), epApp.getDescription(), epApp.getNotes(), epApp.getUrl(),
- epApp.getAlternateUrl(), epApp.getAppRestEndpoint(), epApp.getMlAppName(),
- epApp.getMlAppAdminId(), String.valueOf(epApp.getMotsId()), epApp.getAppPassword(),
- String.valueOf(epApp.getOpen()), String.valueOf(epApp.getEnabled()),
- epApp.getThumbnail(), epApp.getUsername(), epApp.getUebKey(), epApp.getUebSecret(),
- epApp.getUebTopicName());
+ CentralApp cenApp = new CentralApp.CentralAppBuilder().setId(1L).setCreated(epApp.getCreated())
+ .setModified(epApp.getModified()).setCreatedId(epApp.getCreatedId())
+ .setModifiedId(epApp.getModifiedId()).setRowNum(epApp.getRowNum())
+ .setName(epApp.getName()).setImageUrl(epApp.getImageUrl())
+ .setDescription(epApp.getDescription()).setNotes(epApp.getNotes())
+ .setUrl(epApp.getUrl()).setAlternateUrl(epApp.getAlternateUrl())
+ .setRestEndpoint(epApp.getAppRestEndpoint()).setMlAppName(epApp.getMlAppName())
+ .setMlAppAdminId(epApp.getMlAppAdminId()).setMotsId(String.valueOf(epApp.getMotsId()))
+ .setAppPassword(epApp.getAppPassword()).setOpen(String.valueOf(epApp.getOpen()))
+ .setEnabled(String.valueOf(epApp.getEnabled())).setThumbnail(epApp.getThumbnail())
+ .setUsername(epApp.getUsername()).setUebKey(epApp.getUebKey())
+ .setUebSecret(epApp.getUebSecret()).setUebTopicName(epApp.getUebTopicName())
+ .createCentralApp();
cenApp.setAppPassword(EPCommonSystemProperties.APP_DISPLAY_PASSWORD);
cua.setApp(cenApp);
Long appId = null;
} else {
userRoleId = userApp.getRole().getAppRoleId();
}
- CentralV2Role cenRole = new CentralV2Role(userRoleId, userApp.getRole().getCreated(),
- userApp.getRole().getModified(), userApp.getRole().getCreatedId(),
- userApp.getRole().getModifiedId(), userApp.getRole().getRowNum(),
- userApp.getRole().getName(), userApp.getRole().getActive(),
- userApp.getRole().getPriority(), roleFunctionSet, null, null);
+ CentralV2Role cenRole = new CentralV2Role.CentralV2RoleBuilder().setId(userRoleId)
+ .setCreated(userApp.getRole().getCreated()).setModified(userApp.getRole().getModified())
+ .setCreatedId(userApp.getRole().getCreatedId())
+ .setModifiedId(userApp.getRole().getModifiedId())
+ .setRowNum(userApp.getRole().getRowNum()).setName(userApp.getRole().getName())
+ .setActive(userApp.getRole().getActive()).setPriority(userApp.getRole().getPriority())
+ .setRoleFunctions(roleFunctionSet).setChildRoles(null).setParentRoles(null)
+ .createCentralV2Role();
cua.setRole(cenRole);
userAppList.getUserApps().add(cua);
}
public CentralV2Role getRoleInfo(Long roleId, String uebkey) throws Exception {
final Map<String, Long> params = new HashMap<>();
List<CentralV2Role> roleList = new ArrayList<>();
- CentralV2Role cenRole = new CentralV2Role();
+ CentralV2Role cenRole = new CentralV2Role.CentralV2RoleBuilder().createCentralV2Role();
List<EPRole> roleInfo = null;
List<EPApp> app = null;
try {
SortedSet<CentralV2Role> childRoles = new TreeSet<>();
SortedSet<CentralV2Role> parentRoles = new TreeSet<>();
CentralV2Role cenRole = null;
- if (role.getAppRoleId() == null) {
- cenRole = new CentralV2Role(role.getId(), role.getCreated(), role.getModified(), role.getCreatedId(),
- role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(), role.getPriority(),
- roleFunctionSet, childRoles, parentRoles);
- } else {
- cenRole = new CentralV2Role(role.getAppRoleId(), role.getCreated(), role.getModified(),
- role.getCreatedId(), role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(),
- role.getPriority(), roleFunctionSet, childRoles, parentRoles);
- }
+ if (role.getAppRoleId() == null) {
+ cenRole = new CentralV2Role.CentralV2RoleBuilder().setId(role.getId()).setCreated(role.getCreated())
+ .setModified(role.getModified()).setCreatedId(role.getCreatedId())
+ .setModifiedId(role.getModifiedId()).setRowNum(role.getRowNum()).setName(role.getName())
+ .setActive(role.getActive()).setPriority(role.getPriority()).setRoleFunctions(roleFunctionSet)
+ .setChildRoles(childRoles).setParentRoles(parentRoles).createCentralV2Role();
+ } else {
+ cenRole = new CentralV2Role.CentralV2RoleBuilder().setId(role.getAppRoleId())
+ .setCreated(role.getCreated()).setModified(role.getModified()).setCreatedId(role.getCreatedId())
+ .setModifiedId(role.getModifiedId()).setRowNum(role.getRowNum()).setName(role.getName())
+ .setActive(role.getActive()).setPriority(role.getPriority()).setRoleFunctions(roleFunctionSet)
+ .setChildRoles(childRoles).setParentRoles(parentRoles).createCentralV2Role();
+ }
roleList.add(cenRole);
}
return roleList;
roleFunction = dataAccessService.executeNamedQuery("getAppFunctionOnCodeAndAppId",
appFuncsParams, null);
}
- if (!roleFunction.isEmpty()) {
+ if (!roleFunction.isEmpty() && roleId != null) {
EPAppRoleFunction apRoleFunction = new EPAppRoleFunction();
apRoleFunction.setAppId(app.getId());
apRoleFunction.setRoleId(roleId);
}
}
if (!found) {
- CentralV2Role cenrole = new CentralV2Role();
+ CentralV2Role cenrole = new CentralV2Role.CentralV2RoleBuilder().createCentralV2Role();
cenrole.setName(role.getRoleName());
cenrole.setId(role.getRoleId());
cenrole.setActive(role.isActive());
}
private CentralV2Role convertRoleToCentralV2Role(EPRole role) {
- return new CentralV2Role(role.getId(), role.getCreated(), role.getModified(), role.getCreatedId(),
- role.getModifiedId(), role.getRowNum(), role.getName(), role.getActive(), role.getPriority(),
- new TreeSet<>(), new TreeSet<>(), new TreeSet<>());
+ return new CentralV2Role.CentralV2RoleBuilder().setId(role.getId()).setCreated(role.getCreated())
+ .setModified(role.getModified()).setCreatedId(role.getCreatedId()).setModifiedId(role.getModifiedId())
+ .setRowNum(role.getRowNum()).setName(role.getName()).setActive(role.getActive())
+ .setPriority(role.getPriority()).setRoleFunctions(new TreeSet<>()).setChildRoles(new TreeSet<>())
+ .setParentRoles(new TreeSet<>()).createCentralV2Role();
}
@Override