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;
}
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);
}
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;
}
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);
}
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"));
}
Aggregations