in ddm-rrm-gerrit-integration/src/main/java/com/epam/digital/data/platform/management/gerritintegration/service/GerritServiceImpl.java [279:308]
public String createChanges(CreateChangeInputDto createDto) {
ChangeInput changeInput = new ChangeInput();
changeInput.subject = createDto.getName();
changeInput.status = ChangeStatus.NEW;
changeInput.topic = createDto.getDescription();
changeInput.project = gerritPropertiesConfig.getRepository();
changeInput.branch = gerritPropertiesConfig.getHeadBranch();
AccountInput accountInput = new AccountInput();
accountInput.username = gerritPropertiesConfig.getUser();
accountInput.name = gerritPropertiesConfig.getUser();
accountInput.email = gerritPropertiesConfig.getUser();
accountInput.httpPassword = gerritPropertiesConfig.getPassword();
changeInput.author = accountInput;
try {
ChangeInfo changeInfo = gerritApi.changes().create(changeInput).get();
return String.valueOf(changeInfo._number);
} catch (HttpStatusException ex) {
if (ex.getStatusCode() == HttpStatus.NOT_FOUND.value()) {
throw new GerritChangeNotFoundException(
"Could not create change with name " + createDto.getName(), ex);
}
throw new GerritCommunicationException(
"Something went wrong while creating change with name " + createDto.getName(), ex);
} catch (RestApiException ex) {
throw new GerritCommunicationException(
"Something went wrong while creating change with name " + createDto.getName(), ex);
}
}