use of com.evolveum.midpoint.web.page.admin.resources.dto.ResourceVisualizationDto in project midpoint by Evolveum.
the class PageResourceVisualization method loadVisualizationDto.
@NotNull
private ResourceVisualizationDto loadVisualizationDto() {
Task task = createSimpleTask(OPERATION_EXPORT_DATA_MODEL);
OperationResult result = task.getResult();
String dot;
try {
resourceObject.revive(getPrismContext());
dot = getModelDiagnosticService().exportDataModel(resourceObject.asObjectable(), DataModelVisualizer.Target.DOT, task, result);
} catch (CommonException | RuntimeException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't export the data model for {}", e, ObjectTypeUtil.toShortString(resourceObject));
showResult(result);
throw redirectBackViaRestartResponseException();
}
String renderer = DEFAULT_RENDERER;
Configuration dotConfig = getMidpointConfiguration().getConfiguration(MidpointConfiguration.DOT_CONFIGURATION);
if (dotConfig != null) {
renderer = dotConfig.getString(RENDERER, renderer);
}
renderer += " -Tsvg";
StringBuilder output = new StringBuilder();
try {
SystemUtil.executeCommand(renderer, dot, output, -1);
return new ResourceVisualizationDto(dot, output.toString(), null);
} catch (IOException | RuntimeException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't execute SVG renderer command: {}", e, renderer);
return new ResourceVisualizationDto(dot, null, e);
}
}
Aggregations