use of com.evolveum.midpoint.gui.api.component.result.OpResult in project midpoint by Evolveum.
the class PageReport method createFullXmlValidator.
private IValidator<String> createFullXmlValidator() {
return new IValidator<String>() {
@Override
public void validate(IValidatable<String> validatable) {
String value = validatable.getValue();
OperationResult result = new OperationResult(OPERATION_VALIDATE_REPORT);
Holder<PrismObject<ReportType>> reportHolder = new Holder<>(null);
OpResult opResult = null;
try {
validateObject(value, reportHolder, PrismContext.LANG_XML, true, result);
if (!result.isAcceptable()) {
result.recordFatalError("Could not validate object", result.getCause());
opResult = OpResult.getOpResult((PageBase) getPage(), result);
validatable.error(new RawValidationError(opResult));
}
} catch (Exception e) {
LOGGER.error("Validation problem occured." + e.getMessage());
result.recordFatalError("Could not validate object.", e);
try {
opResult = OpResult.getOpResult((PageBase) getPage(), result);
validatable.error(new RawValidationError(opResult));
} catch (Exception ex) {
error(ex);
}
}
}
};
}
use of com.evolveum.midpoint.gui.api.component.result.OpResult in project midpoint by Evolveum.
the class FeedbackListView method populateItem.
@Override
protected void populateItem(final ListItem<FeedbackMessage> item) {
final FeedbackMessage message = item.getModelObject();
if (message.getMessage() instanceof OpResult) {
final OpResult opResult = (OpResult) message.getMessage();
OperationResultPanel panel = new OperationResultPanel("message", Model.of(opResult)) {
private static final long serialVersionUID = 1L;
@Override
public void close(AjaxRequestTarget target) {
super.close(target);
message.markRendered();
}
protected void onAfterRender() {
opResult.setAlreadyShown(true);
super.onAfterRender();
}
};
panel.add(new VisibleBehaviour(() -> opResult != null && !opResult.isAlreadyShown()));
panel.setOutputMarkupId(true);
item.add(panel);
} else {
message.markRendered();
ValidationErrorPanel validationPanel = new ValidationErrorPanel("message", item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void close(AjaxRequestTarget target) {
super.close(target);
message.markRendered();
}
};
validationPanel.setOutputMarkupId(true);
item.add(validationPanel);
}
}
use of com.evolveum.midpoint.gui.api.component.result.OpResult in project midpoint by Evolveum.
the class TestConnectionMessagesPanel method initResultsModel.
private void initResultsModel(String resourceOid) {
OperationResult result = new OperationResult(OPERATION_TEST_CONNECTION);
List<OpResult> resourceResultsDto = new ArrayList<>();
List<ConnectorStruct> connectorStructs = new ArrayList<>();
if (StringUtils.isNotEmpty(resourceOid)) {
Task task = parentPage.createSimpleTask(OPERATION_TEST_CONNECTION);
try {
result = parentPage.getModelService().testResource(resourceOid, task);
} catch (ObjectNotFoundException e) {
result.recordFatalError(getString("TestConnectionMessagesPanel.message.testConnection.fatalError"), e);
}
for (OperationResult subresult : result.getSubresults()) {
if (isConnectorResult(subresult)) {
ConnectorStruct connectorStruct = new ConnectorStruct();
connectorStruct.connectorName = subresult.getParamSingle(OperationResult.PARAM_NAME);
if (connectorStruct.connectorName == null) {
connectorStruct.connectorName = "";
}
connectorStruct.connectorResultsDto = new ArrayList<>();
for (OperationResult subsubresult : subresult.getSubresults()) {
if (isKnownResult(subsubresult)) {
connectorStruct.connectorResultsDto.add(OpResult.getOpResult(parentPage, subsubresult));
}
}
connectorStructs.add(connectorStruct);
} else if (isKnownResult(subresult)) {
// resource operation
resourceResultsDto.add(OpResult.getOpResult(parentPage, subresult));
}
}
if (result.isSuccess()) {
result.recomputeStatus();
}
}
modelResourceResults = new ListModel<>(resourceResultsDto);
connectorResourceResults = new ListModel<>(connectorStructs);
}
use of com.evolveum.midpoint.gui.api.component.result.OpResult in project midpoint by Evolveum.
the class TestConnectionMessagesPanel method initLayout.
private void initLayout() {
setOutputMarkupId(true);
WebMarkupContainer messagesPanel = new WebMarkupContainer(ID_MESSAGES_PANEL);
messagesPanel.setOutputMarkupId(true);
add(messagesPanel);
ListView<ConnectorStruct> connectorView = new ListView<ConnectorStruct>(ID_CONNECTOR_MESSAGES_PANEL, connectorResourceResults) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<ConnectorStruct> item) {
Label connectorNameLabel = new Label(ID_CONNECTOR_NAME, item.getModelObject().connectorName);
item.add(connectorNameLabel);
RepeatingView connectorResultView = new RepeatingView(ID_CONNECTOR_MESSAGES);
List<OpResult> resultsDto = item.getModelObject().connectorResultsDto;
if (resultsDto != null) {
initResultsPanel(connectorResultView, resultsDto, parentPage);
}
item.add(connectorResultView);
}
};
messagesPanel.add(connectorView);
RepeatingView resultView = new RepeatingView(ID_RESOURCE_MESSAGES);
if (modelResourceResults.getObject() != null) {
initResultsPanel(resultView, modelResourceResults.getObject(), parentPage);
}
resultView.setOutputMarkupId(true);
messagesPanel.add(resultView);
}
use of com.evolveum.midpoint.gui.api.component.result.OpResult in project midpoint by Evolveum.
the class TestConnectionMessagesPanel method initResultsPanel.
public void initResultsPanel(RepeatingView resultView, List<OpResult> opresults, Page parentPage) {
for (OpResult result : opresults) {
OperationResultPanel resultPanel = new OperationResultPanel(resultView.newChildId(), new Model<>(result));
resultPanel.add(new VisibleBehaviour(() -> result != null));
resultPanel.setOutputMarkupId(true);
resultView.add(resultPanel);
}
}
Aggregations