use of com.emc.vipr.model.catalog.ValidationError in project coprhd-controller by CoprHD.
the class ExecutionWindowsApi method update.
public static void update(String executionWindowId, ExecutionWindowInfo info) {
ExecutionWindowRestRep window = ExecutionWindowUtils.getExecutionWindow(uri(executionWindowId));
if (window != null) {
copyExecutionWindowInfoToExecutionWindow(info, window);
window.setId(URI.create(executionWindowId));
createForm(window).validate("executionWindowForm");
if (validation.hasErrors()) {
response.status = HttpStatus.SC_BAD_REQUEST;
ValidationError validationError = null;
renderApi(getValidationErrors());
} else {
ExecutionWindowUpdateParam updateParam = new ExecutionWindowUpdateParam();
map(updateParam, info);
ExecutionWindowUtils.updateExecutionWindow(uri(executionWindowId), updateParam);
info.setId(window.getId().toString());
renderApi(info);
}
} else {
notFound(Messages.get("ExecutionWindowsApi.windowWithId", executionWindowId));
}
}
use of com.emc.vipr.model.catalog.ValidationError in project coprhd-controller by CoprHD.
the class ValidationErrorFilter method handle.
@Override
public ClientResponse handle(ClientRequest request) throws ClientHandlerException {
ClientResponse response = getNext().handle(request);
int status = response.getStatus();
if (supportsPortalValidation(request) && status == 400) {
List<ValidationError> errorsList = ApiListUtils.getEntityList(config, new GenericType<List<ValidationError>>() {
}, response);
ValidationException exception = new ValidationException(response.getStatus(), errorsList);
LOG.error(exception.getMessage());
throw exception;
}
return response;
}
use of com.emc.vipr.model.catalog.ValidationError in project coprhd-controller by CoprHD.
the class SetupApi method skip.
// This API is intended to allow skipping the initial setup. It requires the system properties to be set
// manually through the proper APIs.
public static void skip() {
if (SetupUtils.isSetupComplete()) {
ok();
}
Map<String, String> properties = ConfigPropertyUtils.getProperties();
String proxyPassword = properties.get(ConfigProperty.PROXYUSER_PASSWORD);
if (StringUtils.isEmpty(proxyPassword)) {
response.status = HttpStatus.SC_BAD_REQUEST;
renderApi(new ValidationError(ConfigProperty.PROXYUSER_PASSWORD, MessagesUtils.get("setup.no.proxy.password")));
}
SetupUtils.markSetupComplete();
ok();
}
Aggregations