Search in sources :

Example 6 with OpResult

use of com.evolveum.midpoint.gui.api.component.result.OpResult in project midpoint by Evolveum.

the class PageBase method showResult.

public OpResult showResult(OperationResult result, String errorMessageKey, boolean showSuccess) {
    Validate.notNull(result, "Operation result must not be null.");
    Validate.notNull(result.getStatus(), "Operation result status must not be null.");
    OperationResult scriptResult = executeResultScriptHook(result);
    if (scriptResult == null) {
        return null;
    }
    result = scriptResult;
    OpResult opResult = OpResult.getOpResult((PageBase) getPage(), result);
    opResult.determineObjectsVisibility(this);
    switch(opResult.getStatus()) {
        case FATAL_ERROR:
        case PARTIAL_ERROR:
            getSession().error(opResult);
            break;
        case IN_PROGRESS:
        case NOT_APPLICABLE:
            getSession().info(opResult);
            break;
        case SUCCESS:
            if (!showSuccess) {
                break;
            }
            getSession().success(opResult);
            break;
        case UNKNOWN:
        case WARNING:
        default:
            getSession().warn(opResult);
    }
    return opResult;
}
Also used : OpResult(com.evolveum.midpoint.gui.api.component.result.OpResult) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 7 with OpResult

use of com.evolveum.midpoint.gui.api.component.result.OpResult in project midpoint by Evolveum.

the class PageOperationResult method initLayout.

private void initLayout() {
    if (result != null) {
        OpResult opresult = showResult(result);
        if (opresult != null) {
            opresult.setShowMoreAll(true);
        } else {
            warn(getString("PageOperationResult.noResultAvailable"));
        }
    }
    AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageError.button.back")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            backPerformed(target);
        }
    };
    add(back);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) OpResult(com.evolveum.midpoint.gui.api.component.result.OpResult)

Example 8 with OpResult

use of com.evolveum.midpoint.gui.api.component.result.OpResult in project midpoint by Evolveum.

the class TaskResultTabPanel method initLayout.

private void initLayout() {
    IModel<List<OperationResult>> resultModel = new ReadOnlyModel<>(() -> createOperationResultList());
    SelectableListDataProvider<SelectableBean<OperationResult>, OperationResult> provider = new SelectableListDataProvider<>(this, resultModel);
    BoxedTablePanel<SelectableBean<OperationResult>> resultTablePanel = new BoxedTablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
    resultTablePanel.setOutputMarkupId(true);
    add(resultTablePanel);
    AjaxFallbackLink<Void> showResult = new AjaxFallbackLink<Void>(ID_SHOW_RESULT) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(Optional<AjaxRequestTarget> optionalTarget) {
            if (!optionalTarget.isPresent()) {
                LOGGER.warn("Cannot show result in interactive way, request target not present.");
                return;
            }
            AjaxRequestTarget target = optionalTarget.get();
            PrismObjectWrapper<TaskType> taskWrapper = TaskResultTabPanel.this.getModelObject();
            TaskType taskType = taskWrapper.getObject().asObjectable();
            OperationResult opResult = OperationResult.createOperationResult(taskType.getResult());
            OpResult result = opResult != null ? OpResult.getOpResult(getPageBase(), opResult) : null;
            OperationResultPanel body = new OperationResultPanel(getPageBase().getMainPopupBodyId(), new Model<>(result));
            body.add(new VisibleBehaviour(() -> opResult != null));
            body.setOutputMarkupId(true);
            getPageBase().showMainPopup(body, target);
        }
    };
    showResult.setOutputMarkupId(true);
    add(showResult);
}
Also used : VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) OperationResultPanel(com.evolveum.midpoint.gui.api.component.result.OperationResultPanel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) SelectableListDataProvider(com.evolveum.midpoint.web.component.util.SelectableListDataProvider) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OpResult(com.evolveum.midpoint.gui.api.component.result.OpResult) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel)

Aggregations

OpResult (com.evolveum.midpoint.gui.api.component.result.OpResult)8 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 OperationResultPanel (com.evolveum.midpoint.gui.api.component.result.OperationResultPanel)3 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 ValidationErrorPanel (com.evolveum.midpoint.gui.api.component.result.ValidationErrorPanel)1 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)1 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 Task (com.evolveum.midpoint.task.api.Task)1 Holder (com.evolveum.midpoint.util.Holder)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)1 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)1 SelectableListDataProvider (com.evolveum.midpoint.web.component.util.SelectableListDataProvider)1 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)1 ArrayList (java.util.ArrayList)1 RestartResponseException (org.apache.wicket.RestartResponseException)1 AjaxFallbackLink (org.apache.wicket.ajax.markup.html.AjaxFallbackLink)1