Search in sources :

Example 16 with ExecutionWindowRestRep

use of com.emc.vipr.model.catalog.ExecutionWindowRestRep in project coprhd-controller by CoprHD.

the class ExecutionWindows method move.

public static void move(@Required String id, @Required Long start, @Required Integer timezoneOffsetInMinutes) {
    ExecutionWindowRestRep executionWindow = ExecutionWindowUtils.getExecutionWindow(uri(id));
    if (executionWindow == null) {
        renderJSON(new CalResponse(false, MessagesUtils.get("executionWindow.notfound", id)));
    }
    ExecutionWindowForm executionWindowForm = new ExecutionWindowForm();
    executionWindowForm.timezoneOffsetInMinutes = timezoneOffsetInMinutes == null ? 0 : timezoneOffsetInMinutes;
    executionWindowForm.readFrom(executionWindow);
    executionWindowForm.updateTimes(start, null);
    boolean isOverlapping = isOverlapping(executionWindowForm);
    if (isOverlapping) {
        renderJSON(new CalResponse(false, MessagesUtils.get("executionWindow.overlapping", executionWindow.getName())));
    }
    executionWindowForm.save();
    renderJSON(new CalResponse(true, MessagesUtils.get("executionWindow.saved.success", executionWindow.getName())));
}
Also used : ExecutionWindowRestRep(com.emc.vipr.model.catalog.ExecutionWindowRestRep)

Aggregations

ExecutionWindowRestRep (com.emc.vipr.model.catalog.ExecutionWindowRestRep)16 Calendar (java.util.Calendar)2 DateTime (org.joda.time.DateTime)2 DateTimeZone (org.joda.time.DateTimeZone)2 Util (play.mvc.Util)2 ViPRCatalogClient2 (com.emc.vipr.client.ViPRCatalogClient2)1 ExecutionWindowCreateParam (com.emc.vipr.model.catalog.ExecutionWindowCreateParam)1 ExecutionWindowUpdateParam (com.emc.vipr.model.catalog.ExecutionWindowUpdateParam)1 OrderRestRep (com.emc.vipr.model.catalog.OrderRestRep)1 ValidationError (com.emc.vipr.model.catalog.ValidationError)1 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)1 Event (util.Event)1