Search in sources :

Example 1 with ExecutionWindowUpdateParam

use of com.emc.vipr.model.catalog.ExecutionWindowUpdateParam 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));
    }
}
Also used : ExecutionWindowUpdateParam(com.emc.vipr.model.catalog.ExecutionWindowUpdateParam) ExecutionWindowRestRep(com.emc.vipr.model.catalog.ExecutionWindowRestRep) ValidationError(com.emc.vipr.model.catalog.ValidationError)

Aggregations

ExecutionWindowRestRep (com.emc.vipr.model.catalog.ExecutionWindowRestRep)1 ExecutionWindowUpdateParam (com.emc.vipr.model.catalog.ExecutionWindowUpdateParam)1 ValidationError (com.emc.vipr.model.catalog.ValidationError)1