use of org.entando.entando.aps.system.services.guifragment.GuiFragment in project entando-core by entando.
the class AbstractWidgetExecutorService method extractWidgetOutput.
public static String extractWidgetOutput(RequestContext reqCtx, WidgetType type) throws ApsSystemException {
if (null == type) {
return "";
}
String widgetTypeCode = (type.isLogic()) ? type.getParentType().getCode() : type.getCode();
try {
IGuiFragmentManager guiFragmentManager = (IGuiFragmentManager) ApsWebApplicationUtils.getBean(SystemConstants.GUI_FRAGMENT_MANAGER, reqCtx.getRequest());
GuiFragment guiFragment = guiFragmentManager.getUniqueGuiFragmentByWidgetType(widgetTypeCode);
if (null != guiFragment) {
String fragmentOutput = extractFragmentOutput(guiFragment, reqCtx);
if (StringUtils.isBlank(fragmentOutput)) {
_logger.info("The fragment '{}' of widget '{}' is not available", guiFragment.getCode(), widgetTypeCode);
return "The fragment '" + guiFragment.getCode() + "' of widget '" + widgetTypeCode + "' is not available";
}
return fragmentOutput;
} else {
String widgetJspPath = type.getJspPath();
return extractJspWidgetOutput(widgetTypeCode, reqCtx, widgetJspPath);
}
} catch (Throwable t) {
String msg = "Error creating widget output - Type '" + widgetTypeCode + "'";
_logger.error(msg, t);
throw new ApsSystemException(msg, t);
}
}
Aggregations