use of com.thoughtworks.go.config.exceptions.UnprocessableEntityException in project gocd by gocd.
the class TrackingToolRepresenter method fromJSON.
public static Object fromJSON(JsonReader jsonReader) {
String type = jsonReader.getString("type");
JsonReader attributes = jsonReader.readJsonObject("attributes");
if ("generic".equals(type)) {
return ExternalTrackingToolRepresenter.fromJSON(attributes);
}
throw new UnprocessableEntityException(String.format("Invalid Tracking tool type '%s'. It has to be one of '%s'.", type, String.join(", ", "generic")));
}
use of com.thoughtworks.go.config.exceptions.UnprocessableEntityException in project gocd by gocd.
the class TrackingToolRepresenter method fromJSON.
public static Object fromJSON(JsonReader jsonReader) {
String type = jsonReader.getString("type");
JsonReader attributes = jsonReader.readJsonObject("attributes");
if ("generic".equals(type)) {
return ExternalTrackingToolRepresenter.fromJSON(attributes);
}
throw new UnprocessableEntityException(String.format("Invalid Tracking tool type '%s'. It has to be one of '%s'.", type, String.join(", ", "generic")));
}
use of com.thoughtworks.go.config.exceptions.UnprocessableEntityException in project gocd by gocd.
the class UserService method updateNotificationFilter.
public void updateNotificationFilter(final long userId, final NotificationFilter notificationFilter) {
notificationFilter.validate(validationContext);
if (!notificationFilter.errors().isEmpty()) {
throw new UnprocessableEntityException("Notification filter validation failed.");
}
User user = userDao.load(userId);
user.updateNotificationFilter(notificationFilter);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
synchronized (enableUserMutex) {
userDao.saveOrUpdate(user);
}
}
});
}
Aggregations