use of org.apache.wicket.RestartResponseException in project midpoint by Evolveum.
the class ContainerListDataProvider method internalSize.
@Override
protected int internalSize() {
LOGGER.trace("begin::internalSize()");
int count = 0;
OperationResult result = new OperationResult(OPERATION_COUNT_CONTAINERS);
try {
count = WebModelServiceUtils.countContainers(getType(), getQuery(), options, getPageBase());
} catch (Exception ex) {
result.recordFatalError(getPageBase().createStringResource("ContainerListDataProvider.message.listContainers.fatalError").getString(), ex);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't count containers", ex);
} finally {
result.computeStatusIfUnknown();
}
if (!WebComponentUtil.isSuccessOrHandledError(result)) {
getPageBase().showResult(result);
return 0;
// 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 ProgressPanel method executeChangesInBackground.
public void executeChangesInBackground(Collection<ObjectDelta<? extends ObjectType>> deltas, boolean previewOnly, ModelExecuteOptions options, Task task, OperationResult result, AjaxRequestTarget target) {
PageBase page = getPageBase();
ProgressReporter reporter = reporterModel.getProcessData();
try {
TaskManager taskManager = page.getTaskManager();
MidPointPrincipal user = AuthUtil.getPrincipalUser();
if (user == null) {
throw new RestartResponseException(PageLogin.class);
} else {
task.setOwner(user.getFocus().asPrismObject());
}
task.setRootActivityDefinition(createNonIterativeChangeExecutionDef(deltas, toModelExecutionOptionsBean(options)));
task.setChannel(SchemaConstants.CHANNEL_USER_URI);
task.setName("Execute changes");
task.setInitiallyRunnable();
PrismObject<TaskType> taskType = task.getUpdatedTaskObject();
AssignmentType archetypeAssignment = new AssignmentType();
archetypeAssignment.setTargetRef(ObjectTypeUtil.createObjectRef(SystemObjectsType.ARCHETYPE_UTILITY_TASK.value(), ObjectTypes.ARCHETYPE));
taskType.asObjectable().getAssignment().add(archetypeAssignment);
taskType.asObjectable().getArchetypeRef().add(ObjectTypeUtil.createObjectRef(SystemObjectsType.ARCHETYPE_UTILITY_TASK.value(), ObjectTypes.ARCHETYPE));
taskManager.switchToBackground(task, result);
result.setBackgroundTaskOid(task.getOid());
} catch (Exception e) {
result.recordFatalError(e);
} finally {
result.computeStatusIfUnknown();
}
if (page instanceof ProgressReportingAwarePage) {
ProgressReportingAwarePage aware = (ProgressReportingAwarePage) page;
aware.finishProcessing(target, reporter.getObjectDeltaOperation(), reporter.isAsynchronousExecution(), result);
}
}
use of org.apache.wicket.RestartResponseException in project midpoint by Evolveum.
the class DynamicFieldGroupPanel method findItemWrapper.
@NotNull
private ItemWrapper<?, ?> findItemWrapper(AbstractFormItemType formField, PrismObjectWrapper<O> objectWrapper) {
ItemPath path = GuiImplUtil.getItemPath(formField);
if (path == null) {
getSession().error("Bad form item definition. It has to contain reference to the real attribute");
LOGGER.error("Bad form item definition. It has to contain reference to the real attribute");
throw new RestartResponseException(getPageBase());
}
ItemWrapper<?, ?> itemWrapper;
try {
itemWrapper = objectWrapper.findItem(path, ItemWrapper.class);
} catch (SchemaException e) {
getSession().error("Bad form item definition. No attribute with path: " + path + " was found");
LOGGER.error("Bad form item definition. No attribute with path: " + path + " was found");
throw new RestartResponseException(getPageBase());
}
if (itemWrapper == null) {
getSession().error("Bad form item definition. No attribute with path: " + path + " was found");
LOGGER.error("Bad form item definition. No attribute with path: " + path + " was found");
throw new RestartResponseException(getPageBase());
}
return itemWrapper;
}
Aggregations