Search in sources :

Example 6 with OrderCreateParam

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

the class CatalogApi method runCatalogService.

private static void runCatalogService(String serviceId) {
    params.checkAndParse();
    OrderCreateParam order = createAndValidateOrder(serviceId);
    OrderRestRep submittedOrder = getCatalogClient().orders().submit(order);
    renderApi(newOrderInfo(submittedOrder));
}
Also used : OrderCreateParam(com.emc.vipr.model.catalog.OrderCreateParam) OrderRestRep(com.emc.vipr.model.catalog.OrderRestRep)

Example 7 with OrderCreateParam

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

the class Orders method submitOrder.

public static void submitOrder(String serviceId) {
    checkAuthenticity();
    OrderCreateParam order = createAndValidateOrder(serviceId);
    String status = null;
    String orderId = null;
    try {
        if (isSchedulerEnabled()) {
            ScheduledEventCreateParam event = createScheduledOrder(order);
            if (Validation.hasErrors()) {
                Validation.keep();
                Common.flashParamsExcept("json", "body");
                Services.showForm(serviceId);
            }
            ScheduledEventRestRep submittedEvent = getCatalogClient().orders().submitScheduledEvent(event);
            status = submittedEvent.getEventStatus();
            orderId = submittedEvent.getLatestOrderId().toString();
        } else {
            OrderRestRep submittedOrder = getCatalogClient().orders().submit(order);
            status = submittedOrder.getOrderStatus();
            orderId = submittedOrder.getId().toString();
        }
    } catch (Exception e) {
        Logger.error(e, MessagesUtils.get("order.submitFailedWithDetail", e.getMessage()));
        flash.error(MessagesUtils.get("order.submitFailedWithDetail", e.getMessage()));
        Common.handleError();
    }
    if (OrderRestRep.ERROR.equalsIgnoreCase(status)) {
        flash.error(MessagesUtils.get("order.submitFailed"));
    } else {
        flash.success(MessagesUtils.get("order.submitSuccess"));
    }
    Http.Cookie cookie = request.cookies.get(RECENT_ACTIVITIES);
    response.setCookie(RECENT_ACTIVITIES, updateRecentActivitiesCookie(cookie, serviceId));
    receipt(orderId);
}
Also used : OrderCreateParam(com.emc.vipr.model.catalog.OrderCreateParam) OrderRestRep(com.emc.vipr.model.catalog.OrderRestRep) Http(play.mvc.Http) ScheduledEventCreateParam(com.emc.vipr.model.catalog.ScheduledEventCreateParam) ScheduledEventRestRep(com.emc.vipr.model.catalog.ScheduledEventRestRep) FlashException(controllers.util.FlashException)

Aggregations

OrderCreateParam (com.emc.vipr.model.catalog.OrderCreateParam)7 ScheduledEvent (com.emc.storageos.db.client.model.uimodels.ScheduledEvent)3 OrderRestRep (com.emc.vipr.model.catalog.OrderRestRep)2 IOException (java.io.IOException)2 NamedElement (com.emc.storageos.db.client.constraint.NamedElementQueryResultList.NamedElement)1 TimeSeriesConstraint (com.emc.storageos.db.client.constraint.TimeSeriesConstraint)1 ExecutionWindow (com.emc.storageos.db.client.model.uimodels.ExecutionWindow)1 Order (com.emc.storageos.db.client.model.uimodels.Order)1 RetainedReplica (com.emc.storageos.db.client.model.uimodels.RetainedReplica)1 ExecutionWindowHelper (com.emc.storageos.db.client.util.ExecutionWindowHelper)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 CatalogServiceFieldRestRep (com.emc.vipr.model.catalog.CatalogServiceFieldRestRep)1 CatalogServiceRestRep (com.emc.vipr.model.catalog.CatalogServiceRestRep)1 Parameter (com.emc.vipr.model.catalog.Parameter)1 ScheduleInfo (com.emc.vipr.model.catalog.ScheduleInfo)1 ScheduledEventCreateParam (com.emc.vipr.model.catalog.ScheduledEventCreateParam)1 ScheduledEventRestRep (com.emc.vipr.model.catalog.ScheduledEventRestRep)1 ServiceDescriptorRestRep (com.emc.vipr.model.catalog.ServiceDescriptorRestRep)1