jianjun159 commented on code in PR #3630:
URL:
https://github.com/apache/incubator-streampark/pull/3630#discussion_r1540373252
##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java:
##########
@@ -116,6 +132,38 @@ public boolean update(Project projectParam) {
ApiAlertException.throwIfFalse(
!project.getBuildState().equals(BuildStateEnum.BUILDING.get()),
"The project is being built, update project failed.");
+ project.setName(projectParam.getName());
+ project.setUrl(projectParam.getUrl());
+ project.setBranches(projectParam.getBranches());
+ project.setPrvkeyPath(projectParam.getPrvkeyPath());
+ project.setUserName(projectParam.getUserName());
+ if (StringUtils.isNotBlank(projectParam.getPassword())) {
+ if (StringUtils.isBlank(project.getPassword())) {
+ String salt = ShaHashUtils.getRandomSalt();
+ try {
+ String encrypt = EncryptUtils.encrypt(projectParam.getPassword(),
salt);
+ project.setSalt(salt);
+ project.setPassword(encrypt);
+ } catch (Exception e) {
+ log.error("project password encrypt failed");
+ throw new ApiAlertException(e);
+ }
+ } else {
+ // Check whether the encrypted password is the same as the current
password
+ if (!Objects.equals(project.getPassword(),
projectParam.getPassword())) {
+ try {
+ String encrypt = EncryptUtils.encrypt(projectParam.getPassword(),
project.getSalt());
+ project.setPassword(encrypt);
+ } catch (Exception e) {
+ log.error("project password encrypt failed");
+ throw new ApiAlertException(e);
+ }
+ }
+ }
+ }
+ project.setPom(projectParam.getPom());
+ project.setDescription(projectParam.getDescription());
+ project.setBuildArgs(projectParam.getBuildArgs());
updateInternal(projectParam, project);
Review Comment:
The code has been optimized in a more concise direction
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]