use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class UserResourceImpl method updateCredentials.
public void updateCredentials(UserCredentialsDto account) {
ensureNotReadOnly();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
if (currentAuthentication != null && currentAuthentication.getUserId() != null) {
if (!identityService.checkPassword(currentAuthentication.getUserId(), account.getAuthenticatedUserPassword())) {
throw new InvalidRequestException(Status.BAD_REQUEST, "The given authenticated user password is not valid.");
}
}
User dbUser = findUserObject();
if (dbUser == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "User with id " + resourceId + " does not exist");
}
dbUser.setPassword(account.getPassword());
identityService.saveUser(dbUser);
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class JobDefinitionResourceImpl method updateSuspensionState.
public void updateSuspensionState(JobDefinitionSuspensionStateDto dto) {
try {
dto.setJobDefinitionId(jobDefinitionId);
dto.updateSuspensionState(engine);
} catch (IllegalArgumentException e) {
String message = String.format("The suspension state of Job Definition with id %s could not be updated due to: %s", jobDefinitionId, e.getMessage());
throw new InvalidRequestException(Status.BAD_REQUEST, e, message);
}
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class JobDefinitionResourceImpl method setJobRetries.
public void setJobRetries(RetriesDto dto) {
try {
ManagementService managementService = engine.getManagementService();
managementService.setJobRetriesByJobDefinitionId(jobDefinitionId, dto.getRetries());
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class JobResourceImpl method getJob.
@Override
public JobDto getJob() {
ManagementService managementService = engine.getManagementService();
Job job = managementService.createJobQuery().jobId(jobId).singleResult();
if (job == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "Job with id " + jobId + " does not exist");
}
return JobDto.fromJob(job);
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class JobResourceImpl method setJobDuedate.
@Override
public void setJobDuedate(JobDuedateDto dto) {
try {
ManagementService managementService = engine.getManagementService();
managementService.setJobDuedate(jobId, dto.getDuedate());
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
Aggregations