Search in sources :

Example 61 with IPage

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

the class NavigatorTarget method isParent.

/**
 * Check if the current target has children. Analyze the current target and
 * return true if it has at least one child, false otherwise.
 *
 * @return true if the current target has children, false otherwise.
 */
public boolean isParent() {
    IPage page = this.getPage();
    boolean isParent = (null != page && null != page.getChildrenCodes() && page.getChildrenCodes().length > 0);
    return isParent;
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage)

Example 62 with IPage

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

the class NavigatorParser method parseSpec.

/**
 * Crea e restituisce una lista di oggetti NavigatorTarget, che wrappano
 * pagine del portale e possono essere utilizzati dai sub-tag.
 *
 * @param spec L'espressione usata la specificazione delle pagine da
 * selezionare; possono essere assolute o relative o miste.
 * @param reqCtx Il contesto della richiesta corrente.
 * @return La lista di oggetti NavigatorTarget.
 */
@Override
public List<NavigatorTarget> parseSpec(String spec, RequestContext reqCtx) {
    IPage currentPage = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
    UserDetails currentUser = (UserDetails) reqCtx.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    return this.parseSpec(spec, currentPage, currentUser);
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) UserDetails(com.agiletec.aps.system.services.user.UserDetails)

Example 63 with IPage

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

the class PreviewRequestValidator method getDesiredPage.

private Page getDesiredPage(String pageCode) {
    Page page = null;
    IPage currentPage = this.getPageManager().getDraftPage(pageCode);
    if (null != currentPage) {
        page = new Page();
        page.setCode(currentPage.getCode());
        page.setParentCode(currentPage.getParentCode());
        page.setGroup(currentPage.getGroup());
        PageMetadata metadata = currentPage.getMetadata();
        page.setMetadata(metadata);
        String[] children = currentPage.getChildrenCodes();
        page.setChildrenCodes(children);
        Widget[] widgets = currentPage.getWidgets();
        page.setWidgets(widgets);
    }
    return page;
}
Also used : PageMetadata(com.agiletec.aps.system.services.page.PageMetadata) IPage(com.agiletec.aps.system.services.page.IPage) Widget(com.agiletec.aps.system.services.page.Widget) Page(com.agiletec.aps.system.services.page.Page) IPage(com.agiletec.aps.system.services.page.IPage)

Example 64 with IPage

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

the class TestRequestAuthorizator method testServiceFailure_2.

public void testServiceFailure_2() throws Throwable {
    RequestContext reqCtx = this.getRequestContext();
    reqCtx.getRequest().getSession().removeAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    IPage root = this._pageManager.getOnlineRoot();
    reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE, root);
    int status = _authorizator.service(reqCtx, ControllerManager.CONTINUE);
    assertEquals(status, ControllerManager.SYS_ERROR);
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) RequestContext(com.agiletec.aps.system.RequestContext)

Example 65 with IPage

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

the class TestRequestAuthorizator method testServiceFailure_1.

public void testServiceFailure_1() throws Throwable {
    RequestContext reqCtx = this.getRequestContext();
    ((MockHttpServletRequest) reqCtx.getRequest()).setRequestURI("/Entando/it/customers_page.page");
    this.setUserOnSession(SystemConstants.GUEST_USER_NAME);
    IPage requiredPage = this._pageManager.getOnlinePage("customers_page");
    reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE, requiredPage);
    int status = _authorizator.service(reqCtx, ControllerManager.CONTINUE);
    assertEquals(status, ControllerManager.REDIRECT);
    String redirectUrl = (String) reqCtx.getExtraParam(RequestContext.EXTRAPAR_REDIRECT_URL);
    assertTrue(redirectUrl.contains("/Entando/it/login.page?"));
    assertTrue(redirectUrl.contains("redirectflag=1"));
    assertTrue(redirectUrl.contains("returnUrl="));
    assertTrue(redirectUrl.contains("customers_page.page"));
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) RequestContext(com.agiletec.aps.system.RequestContext)

Aggregations

IPage (com.agiletec.aps.system.services.page.IPage)253 Widget (com.agiletec.aps.system.services.page.Widget)55 ArrayList (java.util.ArrayList)41 Page (com.agiletec.aps.system.services.page.Page)37 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)30 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)25 HashMap (java.util.HashMap)23 ApsProperties (com.agiletec.aps.util.ApsProperties)20 List (java.util.List)20 RestServerError (org.entando.entando.aps.system.exception.RestServerError)18 IPageManager (com.agiletec.aps.system.services.page.IPageManager)16 UserDetails (com.agiletec.aps.system.services.user.UserDetails)16 ResourceNotFoundException (org.entando.entando.aps.system.exception.ResourceNotFoundException)16 RequestContext (com.agiletec.aps.system.RequestContext)15 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)15 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)15 Test (org.junit.Test)14 BeanPropertyBindingResult (org.springframework.validation.BeanPropertyBindingResult)13 Lang (com.agiletec.aps.system.services.lang.Lang)12 ResultActions (org.springframework.test.web.servlet.ResultActions)12