Search in sources :

Example 41 with RestartResponseException

use of org.apache.wicket.RestartResponseException in project the-app by devops-dojo.

the class CheckoutPage method validateCheckoutPage.

protected void validateCheckoutPage() {
    try {
        if (checkout.getOrderItemInfos().isEmpty()) {
            getSession().error(getString("checkout.validation.failed"));
            LOGGER.debug("Basket is empty and CheckoutPage could not be created");
            throw new RestartResponseException(Application.get().getHomePage());
        }
    } catch (Exception e) {
        getSession().error("Cart is not available yet, please try again later.");
        LOGGER.error("A backend error seems to be occurred: ", e);
        throw new RestartResponseException(Application.get().getHomePage());
    }
}
Also used : RestartResponseException(org.apache.wicket.RestartResponseException) RestartResponseException(org.apache.wicket.RestartResponseException)

Example 42 with RestartResponseException

use of org.apache.wicket.RestartResponseException in project midpoint by Evolveum.

the class SelectableBeanObjectDataProvider method internalSize.

@Override
protected int internalSize() {
    LOGGER.trace("begin::internalSize()");
    if (!isUseObjectCounting()) {
        return Integer.MAX_VALUE;
    }
    int count = 0;
    OperationResult result = new OperationResult(OPERATION_COUNT_OBJECTS);
    try {
        Task task = getPage().createSimpleTask(OPERATION_COUNT_OBJECTS);
        Integer counted = getModel().countObjects(type, getQuery(), options, task, result);
        count = counted == null ? 0 : counted.intValue();
    } catch (Exception ex) {
        result.recordFatalError("Couldn't count objects.", ex);
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't count objects", ex);
    } finally {
        result.computeStatusIfUnknown();
    }
    if (!WebComponentUtil.isSuccessOrHandledError(result)) {
        getPage().showResult(result);
        throw new RestartResponseException(PageError.class);
    }
    LOGGER.trace("end::internalSize(): {}", count);
    return count;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) RestartResponseException(org.apache.wicket.RestartResponseException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RestartResponseException(org.apache.wicket.RestartResponseException)

Example 43 with RestartResponseException

use of org.apache.wicket.RestartResponseException in project midpoint by Evolveum.

the class PrismPropertyRealValueFromPrismObjectModel method getObject.

@Override
public T getObject() {
    PrismObject<O> object = model.getObject();
    PrismProperty<T> property;
    try {
        property = object.findOrCreateProperty(path);
    } catch (SchemaException ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't create property in path {}", ex, path);
        //todo show message in page error [lazyman]
        throw new RestartResponseException(PageError.class);
    }
    return getRealValue(property != null ? property.getRealValue() : null);
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RestartResponseException(org.apache.wicket.RestartResponseException) PageError(com.evolveum.midpoint.web.page.error.PageError)

Example 44 with RestartResponseException

use of org.apache.wicket.RestartResponseException in project midpoint by Evolveum.

the class TreeTablePanel method deleteNodeConfirmedPerformed.

private void deleteNodeConfirmedPerformed(SelectableBean<OrgType> orgToDelete, AjaxRequestTarget target) {
    getPageBase().hideMainPopup(target);
    OperationResult result = new OperationResult(OPERATION_DELETE_OBJECT);
    PageBase page = getPageBase();
    if (orgToDelete == null) {
        orgToDelete = getTreePanel().getRootFromProvider();
    }
    if (orgToDelete.getValue() == null) {
        return;
    }
    String oidToDelete = orgToDelete.getValue().getOid();
    WebModelServiceUtils.deleteObject(OrgType.class, oidToDelete, result, page);
    result.computeStatusIfUnknown();
    page.showResult(result);
    // TODO is this ok? [pmed]
    throw new RestartResponseException(getPage().getClass());
}
Also used : RestartResponseException(org.apache.wicket.RestartResponseException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 45 with RestartResponseException

use of org.apache.wicket.RestartResponseException in project midpoint by Evolveum.

the class RunReportPopupPanel method createTypedInputPanel.

private InputPanel createTypedInputPanel(String componentId, IModel<JasperReportValueDto> model, String expression, JasperReportParameterDto param) {
    InputPanel panel;
    Class<?> type;
    try {
        if (param.isMultiValue()) {
            type = param.getNestedType();
        } else {
            type = param.getType();
        }
    } catch (ClassNotFoundException e) {
        getSession().error("Could not find parameter type definition. Check the configuration.");
        throw new RestartResponseException(getPageBase());
    }
    if (type.isEnum()) {
        panel = WebComponentUtil.createEnumPanel(type, componentId, new PropertyModel<>(model, expression), this);
    } else if (XMLGregorianCalendar.class.isAssignableFrom(type)) {
        panel = new DatePanel(componentId, new PropertyModel<>(model, expression));
    } else if (param.getProperties() != null && param.getProperties().getTargetType() != null) {
        // render autocomplete box
        LookupTableType lookup = new LookupTableType();
        panel = new AutoCompleteTextPanel<String>(componentId, new LookupPropertyModel<>(model, expression, lookup, false), String.class) {

            @Override
            public Iterator<String> getIterator(String input) {
                return prepareAutoCompleteList(input, lookup, param).iterator();
            }
        };
    } else {
        panel = new TextPanel<>(componentId, new PropertyModel<>(model, expression), type);
    }
    List<FormComponent> components = panel.getFormComponents();
    for (FormComponent component : components) {
        component.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    }
    panel.setOutputMarkupId(true);
    return panel;
}
Also used : FormComponent(org.apache.wicket.markup.html.form.FormComponent) InputPanel(com.evolveum.midpoint.web.component.prism.InputPanel) LookupPropertyModel(com.evolveum.midpoint.web.model.LookupPropertyModel) PropertyModel(org.apache.wicket.model.PropertyModel) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) RestartResponseException(org.apache.wicket.RestartResponseException) DatePanel(com.evolveum.midpoint.web.component.input.DatePanel) Iterator(java.util.Iterator) LookupPropertyModel(com.evolveum.midpoint.web.model.LookupPropertyModel) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType)

Aggregations

RestartResponseException (org.apache.wicket.RestartResponseException)73 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)36 Task (com.evolveum.midpoint.task.api.Task)27 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)20 ArrayList (java.util.ArrayList)10 PrismObject (com.evolveum.midpoint.prism.PrismObject)8 CommonException (com.evolveum.midpoint.util.exception.CommonException)8 SecurityPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType)8 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)6 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)6 WrapperContext (com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext)5 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)5 MidPointPrincipal (com.evolveum.midpoint.security.api.MidPointPrincipal)5 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)5 PageError (com.evolveum.midpoint.web.page.error.PageError)5 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)4 Collection (java.util.Collection)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)4 IModel (org.apache.wicket.model.IModel)4 StringValue (org.apache.wicket.util.string.StringValue)4