Search in sources :

Example 11 with IPage

use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.

the class PageService method updatePage.

@Override
public PageDto updatePage(String pageCode, PageRequest pageRequest) {
    IPage oldPage = this.getPageManager().getDraftPage(pageCode);
    if (null == oldPage) {
        throw new RestRourceNotFoundException(null, "page", pageCode);
    }
    this.validateRequest(pageRequest);
    try {
        IPage newPage = this.updatePage(oldPage, pageRequest);
        this.getPageManager().updatePage(newPage);
        return this.getDtoBuilder().convert(newPage);
    } catch (ApsSystemException e) {
        logger.error("Error updating page {}", pageCode, e);
        throw new RestServerError("error in update page", e);
    }
}
Also used : RestRourceNotFoundException(org.entando.entando.aps.system.exception.RestRourceNotFoundException) IPage(com.agiletec.aps.system.services.page.IPage) RestServerError(org.entando.entando.aps.system.exception.RestServerError) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException)

Example 12 with IPage

use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.

the class CacheInfoManager method updateFromPageChanged.

@Override
public void updateFromPageChanged(PageChangedEvent event) {
    IPage page = event.getPage();
    if (null != page) {
        String pageCacheGroupName = SystemConstants.PAGES_CACHE_GROUP_PREFIX + page.getCode();
        this.flushGroup(DEFAULT_CACHE_NAME, pageCacheGroupName);
    }
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage)

Example 13 with IPage

use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.

the class SystemInfoWrapper method getActionPathUrl.

public String getActionPathUrl(String actionPath) {
    String url = null;
    RequestContext reqCtx = this.getReqCtx();
    IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER, reqCtx.getRequest());
    try {
        PageURL pageUrl = urlManager.createURL(reqCtx);
        IPage currPage = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
        Integer currentFrame = (Integer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME);
        pageUrl.setPage(currPage);
        pageUrl.addParam(InternalServletTag.REQUEST_PARAM_ACTIONPATH, actionPath);
        pageUrl.addParam(InternalServletTag.REQUEST_PARAM_FRAMEDEST, currentFrame.toString());
        url = pageUrl.getURL();
    } catch (Throwable t) {
        _logger.error("Error getting path for action path: {}", actionPath, t);
        return null;
    }
    return url;
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) PageURL(com.agiletec.aps.system.services.url.PageURL) IURLManager(com.agiletec.aps.system.services.url.IURLManager) RequestContext(com.agiletec.aps.system.RequestContext)

Example 14 with IPage

use of com.agiletec.aps.system.services.page.IPage in project entando-core by entando.

the class SystemInfoWrapper method getPageWithWidget.

public IPage getPageWithWidget(String widgetCode) {
    IPage page = null;
    try {
        IPageManager pageManager = (IPageManager) ApsWebApplicationUtils.getBean(SystemConstants.PAGE_MANAGER, this.getReqCtx().getRequest());
        List<IPage> pages = pageManager.getOnlineWidgetUtilizers(widgetCode);
        if (null != pages && !pages.isEmpty()) {
            page = pages.get(0);
        }
        return page;
    } catch (Throwable t) {
        _logger.error("Error getting page with widget: {}", widgetCode, t);
        return null;
    }
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager) IPage(com.agiletec.aps.system.services.page.IPage)

Example 15 with IPage

use of com.agiletec.aps.system.services.page.IPage 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)

Aggregations

IPage (com.agiletec.aps.system.services.page.IPage)209 Widget (com.agiletec.aps.system.services.page.Widget)43 ArrayList (java.util.ArrayList)33 Page (com.agiletec.aps.system.services.page.Page)21 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)20 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)18 ApsProperties (com.agiletec.aps.util.ApsProperties)16 RequestContext (com.agiletec.aps.system.RequestContext)15 List (java.util.List)14 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)14 Lang (com.agiletec.aps.system.services.lang.Lang)12 IPageManager (com.agiletec.aps.system.services.page.IPageManager)12 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)12 HashMap (java.util.HashMap)12 RestServerError (org.entando.entando.aps.system.exception.RestServerError)11 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)10 UserDetails (com.agiletec.aps.system.services.user.UserDetails)8 HttpServletRequest (javax.servlet.http.HttpServletRequest)8 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)8 WidgetConfigurationDto (org.entando.entando.aps.system.services.page.model.WidgetConfigurationDto)8