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