use of org.eclipse.che.api.devfile.shared.event.DevfileUpdatedEvent in project devspaces-images by redhat-developer.
the class UserDevfileManager method updateUserDevfile.
/**
* Updates an existing user devfile in accordance to the new configuration.
*
* <p>Note: Replace strategy is used for user devfile update, it means that existing devfile data
* will be replaced with given {@code update}.
*
* @param update user devfile update
* @return updated user devfile
* @throws NullPointerException when {@code update} is null
* @throws ConflictException when any conflict occurs.
* @throws NotFoundException when user devfile with given id not found
* @throws ServerException when any server error occurs
*/
public UserDevfile updateUserDevfile(UserDevfile update) throws ConflictException, NotFoundException, ServerException {
requireNonNull(update);
Optional<UserDevfile> result = userDevfileDao.update(update);
UserDevfile devfile = result.orElseThrow(() -> new NotFoundException(format("Devfile with id '%s' doesn't exist", update.getId())));
LOG.debug("UserDevfile '{}' with id '{}' update by user '{}'", devfile.getName(), devfile.getId(), EnvironmentContext.getCurrent().getSubject().getUserName());
eventService.publish(new DevfileUpdatedEvent(devfile));
return devfile;
}
use of org.eclipse.che.api.devfile.shared.event.DevfileUpdatedEvent in project che-server by eclipse-che.
the class UserDevfileManager method updateUserDevfile.
/**
* Updates an existing user devfile in accordance to the new configuration.
*
* <p>Note: Replace strategy is used for user devfile update, it means that existing devfile data
* will be replaced with given {@code update}.
*
* @param update user devfile update
* @return updated user devfile
* @throws NullPointerException when {@code update} is null
* @throws ConflictException when any conflict occurs.
* @throws NotFoundException when user devfile with given id not found
* @throws ServerException when any server error occurs
*/
public UserDevfile updateUserDevfile(UserDevfile update) throws ConflictException, NotFoundException, ServerException {
requireNonNull(update);
Optional<UserDevfile> result = userDevfileDao.update(update);
UserDevfile devfile = result.orElseThrow(() -> new NotFoundException(format("Devfile with id '%s' doesn't exist", update.getId())));
LOG.debug("UserDevfile '{}' with id '{}' update by user '{}'", devfile.getName(), devfile.getId(), EnvironmentContext.getCurrent().getSubject().getUserName());
eventService.publish(new DevfileUpdatedEvent(devfile));
return devfile;
}
Aggregations