Search in sources :

Example 6 with Widget

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;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity) Lang(com.agiletec.aps.system.services.lang.Lang) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 7 with Widget

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;
}
Also used : DataObjectRenderizationInfo(org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo) Widget(com.agiletec.aps.system.services.page.Widget) Lang(com.agiletec.aps.system.services.lang.Lang) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 8 with Widget

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;
}
Also used : PublicDataTypeAuthorizationInfo(org.entando.entando.aps.system.services.dataobject.helper.PublicDataTypeAuthorizationInfo) Widget(com.agiletec.aps.system.services.page.Widget) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException)

Example 9 with Widget

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;
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) Widget(com.agiletec.aps.system.services.page.Widget) RequestContext(com.agiletec.aps.system.RequestContext)

Example 10 with Widget

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;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType)

Aggregations

Widget (com.agiletec.aps.system.services.page.Widget)117 ApsProperties (com.agiletec.aps.util.ApsProperties)60 IPage (com.agiletec.aps.system.services.page.IPage)41 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)20 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)17 HashMap (java.util.HashMap)12 Lang (com.agiletec.aps.system.services.lang.Lang)10 Page (com.agiletec.aps.system.services.page.Page)7 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)7 ArrayList (java.util.ArrayList)7 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)6 NavigatorExpression (com.agiletec.aps.system.services.page.widget.NavigatorExpression)6 Properties (java.util.Properties)6 RequestContext (com.agiletec.aps.system.RequestContext)5 ActionSupport (com.opensymphony.xwork2.ActionSupport)4 JspException (javax.servlet.jsp.JspException)4 WidgetTypeParameter (org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter)4 List (java.util.List)3 ServletRequest (javax.servlet.ServletRequest)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3