Search in sources :

Example 1 with OperationResultStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType in project midpoint by Evolveum.

the class ResourceContentPanel method getResultLabel.

private String getResultLabel(IModel<SelectableBean<ShadowType>> model) {
    OperationResultType result = getResult(model);
    if (result == null) {
        return "";
    }
    StringBuilder b = new StringBuilder(createStringResource("FailedOperationTypeType." + getShadow(model).getFailedOperationType()).getObject());
    b.append(":");
    b.append(createStringResource("OperationResultStatusType." + result.getStatus()).getObject());
    return b.toString();
}
Also used : OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)

Example 2 with OperationResultStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType in project midpoint by Evolveum.

the class OperationResultFactory method createOperationResult.

public static OperationResultType createOperationResult(String operation, OperationResultStatusType status, Map<String, Element> params, String message) {
    OperationResultType result = createOperationResult(operation, status, params);
    result.setMessage(message);
    return result;
}
Also used : OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)

Example 3 with OperationResultStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType in project midpoint by Evolveum.

the class OperationResultFactory method createOperationResult.

public static OperationResultType createOperationResult(String operation, OperationResultStatusType status) {
    if (StringUtils.isEmpty(operation)) {
        throw new IllegalArgumentException("Operation name not defined.");
    }
    if (status == null) {
        throw new IllegalArgumentException("Operation status not defined.");
    }
    ObjectFactory factory = new ObjectFactory();
    OperationResultType result = factory.createOperationResultType();
    result.setToken(getNextToken());
    result.setOperation(operation);
    result.setStatus(status);
    return result;
}
Also used : ObjectFactory(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)

Example 4 with OperationResultStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType in project midpoint by Evolveum.

the class AbstractManualResourceTest method assertPendingOperation.

private PendingOperationType assertPendingOperation(PrismObject<ShadowType> shadow, PendingOperationType pendingOperation, XMLGregorianCalendar requestStart, XMLGregorianCalendar requestEnd, OperationResultStatusType expectedStatus, XMLGregorianCalendar completionStart, XMLGregorianCalendar completionEnd) {
    assertNotNull("No operation ", pendingOperation);
    ObjectDeltaType deltaType = pendingOperation.getDelta();
    assertNotNull("No delta in pending operation in " + shadow, deltaType);
    // TODO: check content of pending operations in the shadow
    TestUtil.assertBetween("No request timestamp in pending operation in " + shadow, requestStart, requestEnd, pendingOperation.getRequestTimestamp());
    OperationResultStatusType status = pendingOperation.getResultStatus();
    assertEquals("Wrong status in pending operation in " + shadow, expectedStatus, status);
    if (expectedStatus != OperationResultStatusType.IN_PROGRESS) {
        TestUtil.assertBetween("No completion timestamp in pending operation in " + shadow, completionStart, completionEnd, pendingOperation.getCompletionTimestamp());
    }
    return pendingOperation;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) OperationResultStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType)

Example 5 with OperationResultStatusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType in project midpoint by Evolveum.

the class ProgressPanel method initLayout.

private void initLayout(ProgressReportingAwarePage page) {
    progressForm = new Form<>(ID_PROGRESS_FORM, true);
    add(progressForm);
    contentsPanel = new WebMarkupContainer(ID_CONTENTS_PANEL);
    contentsPanel.setOutputMarkupId(true);
    progressForm.add(contentsPanel);
    ListView statusItemsListView = new ListView<ProgressReportActivityDto>(ID_ACTIVITIES, new AbstractReadOnlyModel<List<ProgressReportActivityDto>>() {

        @Override
        public List<ProgressReportActivityDto> getObject() {
            ProgressDto progressDto = ProgressPanel.this.getModelObject();
            return progressDto.getProgressReportActivities();
        }
    }) {

        protected void populateItem(final ListItem<ProgressReportActivityDto> item) {
            item.add(new Label(ID_ACTIVITY_DESCRIPTION, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    ProgressReportActivityDto si = item.getModelObject();
                    if (si.getActivityType() == RESOURCE_OBJECT_OPERATION && si.getResourceShadowDiscriminator() != null) {
                        ResourceShadowDiscriminator rsd = si.getResourceShadowDiscriminator();
                        return createStringResource(rsd.getKind()).getString() + " (" + rsd.getIntent() + ") on " + // TODO correct i18n
                        si.getResourceName();
                    } else {
                        return createStringResource(si.getActivityType()).getString();
                    }
                }
            }));
            item.add(createImageLabel(ID_ACTIVITY_STATE, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    OperationResultStatusType statusType = item.getModelObject().getStatus();
                    if (statusType == null) {
                        return null;
                    } else {
                        return OperationResultStatusPresentationProperties.parseOperationalResultStatus(statusType).getIcon() + " fa-lg";
                    }
                }
            }, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    // TODO why this does not work???
                    // TODO i18n
                    OperationResultStatusType statusType = item.getModelObject().getStatus();
                    if (statusType == null) {
                        return null;
                    } else {
                        return statusType.toString();
                    }
                }
            }));
            item.add(new Label(ID_ACTIVITY_COMMENT, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    ProgressReportActivityDto si = item.getModelObject();
                    if (si.getResourceName() != null || si.getResourceOperationResultList() != null) {
                        StringBuilder sb = new StringBuilder();
                        boolean first = true;
                        if (si.getResourceOperationResultList() != null) {
                            for (ResourceOperationResult ror : si.getResourceOperationResultList()) {
                                if (!first) {
                                    sb.append(", ");
                                } else {
                                    first = false;
                                }
                                sb.append(createStringResource("ChangeType." + ror.getChangeType()).getString());
                                sb.append(":");
                                sb.append(createStringResource(ror.getResultStatus()).getString());
                            }
                        }
                        if (si.getResourceObjectName() != null) {
                            if (!first) {
                                sb.append(" -> ");
                            }
                            sb.append(si.getResourceObjectName());
                        }
                        return sb.toString();
                    } else {
                        return null;
                    }
                }
            }));
        }

        private Label createImageLabel(String id, IModel<String> cssClass, IModel<String> title) {
            Label label = new Label(id);
            label.add(AttributeModifier.replace("class", cssClass));
            // does not work, currently
            label.add(AttributeModifier.replace("title", title));
            return label;
        }
    };
    contentsPanel.add(statusItemsListView);
    statisticsPanel = new StatisticsPanel(ID_STATISTICS, new StatisticsDtoModel());
    contentsPanel.add(statisticsPanel);
    ListView logItemsListView = new ListView(ID_LOG_ITEMS, new AbstractReadOnlyModel<List>() {

        @Override
        public List getObject() {
            ProgressDto progressDto = ProgressPanel.this.getModelObject();
            return progressDto.getLogItems();
        }
    }) {

        protected void populateItem(ListItem item) {
            item.add(new Label(ID_LOG_ITEM, item.getModel()));
        }
    };
    contentsPanel.add(logItemsListView);
    Label executionTime = new Label(ID_EXECUTION_TIME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            if (operationDurationTime > 0) {
                return createStringResource("ProgressPanel.ExecutionTimeWhenFinished", operationDurationTime).getString();
            } else if (operationStartTime > 0) {
                return createStringResource("ProgressPanel.ExecutionTimeWhenRunning", (System.currentTimeMillis() - operationStartTime) / 1000).getString();
            } else {
                return null;
            }
        }
    });
    contentsPanel.add(executionTime);
    initButtons(progressForm, page);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) IModel(org.apache.wicket.model.IModel) Label(org.apache.wicket.markup.html.basic.Label) OperationResultStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ListView(org.apache.wicket.markup.html.list.ListView) List(java.util.List) ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator) ListItem(org.apache.wicket.markup.html.list.ListItem) ResourceOperationResult(com.evolveum.midpoint.web.component.progress.ProgressReportActivityDto.ResourceOperationResult)

Aggregations

OperationResultStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType)6 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)5 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)4 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 ObjectFactory (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory)2 PendingOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType)2 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 QName (javax.xml.namespace.QName)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 IModel (org.apache.wicket.model.IModel)2 ItemPathDto (com.evolveum.midpoint.gui.api.component.path.ItemPathDto)1 ItemPathPanel (com.evolveum.midpoint.gui.api.component.path.ItemPathPanel)1 CanonicalItemPath (com.evolveum.midpoint.prism.path.CanonicalItemPath)1 ResourceShadowDiscriminator (com.evolveum.midpoint.schema.ResourceShadowDiscriminator)1 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)1 MultiValueChoosePanel (com.evolveum.midpoint.web.component.form.multivalue.MultiValueChoosePanel)1 DatePanel (com.evolveum.midpoint.web.component.input.DatePanel)1