use of com.webank.wedatasphere.qualitis.entity.ProxyUser in project Qualitis by WeBankFinTech.
the class ProxyUserServiceImpl method modifyProxyUser.
@Override
@Transactional(rollbackFor = { RuntimeException.class, UnExpectedRequestException.class })
public GeneralResponse<?> modifyProxyUser(ModifyProxyUserRequest request) throws UnExpectedRequestException {
// Check Arguments
ModifyProxyUserRequest.checkRequest(request);
// Check existence of proxy user
ProxyUser proxyUserInDb = proxyUserRepository.findById(request.getProxyUserId()).orElse(null);
if (proxyUserInDb == null) {
throw new UnExpectedRequestException("ProxyUser id: [" + request.getProxyUserId() + "] {&DOES_NOT_EXIST}");
}
String oldProxyUserName = proxyUserInDb.getProxyUserName();
// Modify proxy user name
proxyUserInDb.setProxyUserName(request.getProxyUserName());
proxyUserRepository.save(proxyUserInDb);
LOGGER.info("Succeed to modify proxy user. old proxy_user name: {}, new proxy_user name: {}", oldProxyUserName, proxyUserInDb.getProxyUserName());
return new GeneralResponse<>("200", "{&SUCCEED_TO_MODIFY_PROXY_USER_NAME}", null);
}
Aggregations