use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class LeftMenuPanel method createSystemConfigurationMenu.
private void createSystemConfigurationMenu(SideBarMenuItem item) {
MainMenuItem system = createMainMenuItem("PageAdmin.menu.top.configuration.basic", "fa fa-cog", com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.PageSystemConfiguration.class);
PageBase page = getPageBase();
if (page != null && PageBaseSystemConfiguration.class.isAssignableFrom(page.getClass())) {
// title key is not nice - model should be sent there...
MenuItem menuItem = new MenuItem(page.getClass().getSimpleName() + ".title", page.getClass(), new PageParameters());
system.addMenuItem(menuItem);
}
item.addMainMenuItem(system);
MainMenuItem systemConfigMenu = createMainMenuItem("PageAdmin.menu.top.configuration.basic", "fa fa-cog");
createSystemConfigurationTabMebu(systemConfigMenu);
item.addMainMenuItem(systemConfigMenu);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ProgressPanel method backPerformed.
protected void backPerformed(AjaxRequestTarget target) {
PageBase page = getPageBase();
page.redirectBack();
}
use of com.evolveum.midpoint.gui.api.page.PageBase 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 com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ProgressPanel method executeChanges.
/**
* Executes changes on behalf of the parent page. By default, changes are executed asynchronously (in
* a separate thread). However, when set in the midpoint configuration, changes are executed synchronously.
*
* @param deltas Deltas to be executed.
* @param options Model execution options.
* @param task Task in context of which the changes have to be executed.
* @param result Operation result.
*/
public void executeChanges(Collection<ObjectDelta<? extends ObjectType>> deltas, boolean previewOnly, ModelExecuteOptions options, Task task, OperationResult result, AjaxRequestTarget target) {
PageBase page = getPageBase();
ProgressReporter reporter = reporterModel.getProcessData();
if (page instanceof ProgressReportingAwarePage) {
ProgressReportingAwarePage aware = (ProgressReportingAwarePage) page;
aware.startProcessing(target, result);
}
if (reporter.isAsynchronousExecution() && page instanceof ProgressReportingAwarePage) {
reporter.setAsyncOperationResult(null);
clearProgressPanel();
startRefreshingProgressPanel(target);
show();
if (reporter.isAbortEnabled()) {
showAbortButton(target);
}
showBackButton(target);
setTask(task);
executeChangesAsync(reporter, deltas, previewOnly, options, task, result);
} else {
executeChangesSync(reporter, deltas, previewOnly, options, task, result);
}
if (!reporter.isAsynchronousExecution() && page instanceof ProgressReportingAwarePage) {
ProgressReportingAwarePage aware = (ProgressReportingAwarePage) page;
aware.finishProcessing(target, reporter.getObjectDeltaOperation(), reporter.isAsynchronousExecution(), result);
}
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ProgressPanel method startRefreshingProgressPanel.
// mess
private void startRefreshingProgressPanel(AjaxRequestTarget target) {
if (refreshingBehavior != null) {
return;
}
ProgressReporter reporter = reporterModel.getProcessData();
int refreshInterval = reporter.getRefreshInterval();
refreshingBehavior = new AjaxSelfUpdatingTimerBehavior(Duration.milliseconds(refreshInterval)) {
@Override
protected void onPostProcessTarget(AjaxRequestTarget target) {
invalidateCache();
ProgressReporter reporter = reporterModel.getProcessData();
OperationResult asyncOperationResult = reporter.getAsyncOperationResult();
if (asyncOperationResult != null) {
// by checking this we know that async operation has been finished
// because we set it to in-progress
asyncOperationResult.recomputeStatus();
stopRefreshingProgressPanel(target);
PageBase page = getPageBase();
if (reporter.isAbortRequested()) {
page.showResult(asyncOperationResult);
target.add(page.getFeedbackPanel());
return;
}
if (page instanceof ProgressReportingAwarePage) {
ProgressReportingAwarePage aware = (ProgressReportingAwarePage) page;
aware.finishProcessing(target, reporter.getObjectDeltaOperation(), true, asyncOperationResult);
}
reporter.setAsyncOperationResult(null);
}
}
@Override
public boolean isEnabled(Component component) {
return component != null;
}
};
add(refreshingBehavior);
target.add(this);
}
Aggregations