use of com.evolveum.midpoint.web.page.admin.configuration.dto.ExecuteMappingDto in project midpoint by Evolveum.
the class PageEvaluateMapping method executeMappingPerformed.
private void executeMappingPerformed(AjaxRequestTarget target) {
Task task = createSimpleTask(OPERATION_EXECUTE_MAPPING);
OperationResult result = new OperationResult(OPERATION_EXECUTE_MAPPING);
ExecuteMappingDto dto = model.getObject();
if (StringUtils.isBlank(dto.getMapping())) {
warn(getString("PageEvaluateMapping.message.emptyString"));
target.add(getFeedbackPanel());
return;
}
try {
MappingEvaluationRequestType request;
if (StringUtils.isNotBlank(dto.getRequest())) {
request = getPrismContext().parserFor(dto.getRequest()).xml().parseRealValue(MappingEvaluationRequestType.class);
} else {
request = new MappingEvaluationRequestType();
}
if (StringUtils.isNotBlank(dto.getMapping())) {
request.setMapping(getPrismContext().parserFor(dto.getMapping()).xml().parseRealValue(MappingType.class));
}
MappingEvaluationResponseType response = getModelDiagnosticService().evaluateMapping(request, task, result);
dto.setResultText(response.getResponse());
} catch (CommonException | RuntimeException e) {
result.recordFatalError(getString("PageEvaluateMapping.message.executeMappingPerformed.fatalError"), e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't execute mapping", e);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
pw.close();
dto.setResultText(sw.toString());
} finally {
result.computeStatus();
}
showResult(result);
target.add(this);
}
Aggregations