use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class DataObjectListHelper method getConfiguredUserFilters.
@Override
public List<UserFilterOptionBean> getConfiguredUserFilters(IDataObjectListTagBean bean, RequestContext reqCtx) throws ApsSystemException {
List<UserFilterOptionBean> userEntityFilters = null;
try {
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
ApsProperties config = (null != widget) ? widget.getConfig() : null;
if (null == config || null == config.getProperty(WIDGET_PARAM_CONTENT_TYPE)) {
return null;
}
String dataObjectTypeCode = config.getProperty(WIDGET_PARAM_CONTENT_TYPE);
IApsEntity prototype = this.getDataObjectManager().getEntityPrototype(dataObjectTypeCode);
if (null == prototype) {
_logger.error("Null dataObject type by code '{}'", dataObjectTypeCode);
return null;
}
Integer currentFrame = (Integer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME);
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
String userFilters = config.getProperty(WIDGET_PARAM_USER_FILTERS);
if (null != userFilters && userFilters.length() > 0) {
userEntityFilters = FilterUtils.getUserFilters(userFilters, currentFrame, currentLang, prototype, this.getUserFilterDateFormat(), reqCtx.getRequest());
}
} catch (Throwable t) {
_logger.error("Error extracting user filters", t);
throw new ApsSystemException("Error extracting user filters", t);
}
return userEntityFilters;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class DataObjectViewerHelper method getRenderizationInfo.
@Override
public DataObjectRenderizationInfo getRenderizationInfo(String dataobjectId, String modelId, boolean publishExtraTitle, RequestContext reqCtx) throws ApsSystemException {
DataObjectRenderizationInfo renderizationInfo = null;
try {
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
String langCode = currentLang.getCode();
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
ApsProperties widgetConfig = widget.getConfig();
dataobjectId = this.extractDataId(dataobjectId, widgetConfig, reqCtx);
modelId = this.extractModelId(dataobjectId, modelId, widgetConfig, reqCtx);
if (dataobjectId != null && modelId != null) {
long longModelId = new Long(modelId).longValue();
this.setStylesheet(longModelId, reqCtx);
renderizationInfo = this.getDataObjectDispenser().getRenderizationInfo(dataobjectId, longModelId, langCode, reqCtx, true);
if (null == renderizationInfo) {
_logger.info("Null Renderization informations: dataobject={}", dataobjectId);
return null;
}
this.manageAttributeValues(renderizationInfo, publishExtraTitle, reqCtx);
} else {
_logger.warn("Parametri visualizzazione dataobject incompleti: dataobject={} modello={}", dataobjectId, modelId);
}
} catch (Throwable t) {
_logger.error("Error extracting renderization info", t);
throw new ApsSystemException("Error extracting renderization info", t);
}
return renderizationInfo;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class DataObjectViewerHelper method getAuthorizationInfo.
@Override
public PublicDataTypeAuthorizationInfo getAuthorizationInfo(String dataobjectId, RequestContext reqCtx) throws ApsSystemException {
PublicDataTypeAuthorizationInfo authInfo = null;
try {
Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
dataobjectId = this.extractDataId(dataobjectId, widget.getConfig(), reqCtx);
if (null == dataobjectId) {
_logger.info("Null dataobjectId");
return null;
}
authInfo = this.getDataAuthorizationHelper().getAuthorizationInfo(dataobjectId, true);
if (null == authInfo) {
_logger.info("Null authorization info by dataobject '" + dataobjectId + "'");
}
} catch (Throwable t) {
_logger.error("Error extracting dataobject authorization info by dataobject {}", dataobjectId, t);
throw new ApsSystemException("Error extracting dataobject authorization info by dataobject '" + dataobjectId + "'", t);
}
return authInfo;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestContentListHelper method valueRequestContext.
private RequestContext valueRequestContext(String pageCode, int frame) throws Throwable {
RequestContext reqCtx = this.getRequestContext();
try {
Widget widgetToAdd = this.getShowletForTest("content_viewer_list", null);
this.setPageWidgets(pageCode, frame, widgetToAdd);
IPage page = this._pageManager.getOnlinePage(pageCode);
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE, page);
Widget widget = page.getWidgets()[frame];
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET, widget);
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME, new Integer(frame));
} catch (Throwable t) {
this.setPageWidgets(pageCode, frame, null);
throw t;
}
return reqCtx;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestContentListHelper method getShowletForTest.
private Widget getShowletForTest(String showletTypeCode, ApsProperties config) throws Throwable {
WidgetType type = this._showletTypeManager.getWidgetType(showletTypeCode);
Widget widget = new Widget();
widget.setType(type);
if (null != config) {
widget.setConfig(config);
}
return widget;
}
Aggregations