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());
}
}
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;
}
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);
}
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());
}
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;
}
Aggregations