use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class AbstractPageActionHelper method getVirtualRoot.
/**
* Metodo a servizio della costruzione dell'albero delle pagine. Nel caso
* che l'utente corrente non sia abilitato alla visualizzazione del nodo
* root, fornisce un nodo "virtuale" nel quale inserire gli eventuali nodi
* visibili.
*
* @return Il nodo root virtuale.
*/
private PageTreeNodeWrapper getVirtualRoot() {
PageTreeNodeWrapper virtualRoot = new PageTreeNodeWrapper();
virtualRoot.setCode(AbstractPortalAction.VIRTUAL_ROOT_CODE);
List<Lang> langs = this.getLangManager().getLangs();
for (int i = 0; i < langs.size(); i++) {
Lang lang = langs.get(i);
virtualRoot.setTitle(lang.getCode(), "ROOT");
}
return virtualRoot;
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class LangAction method remove.
public String remove() {
try {
Lang langToRemove = this.getLangManager().getLang(this.getLangCode());
if (null == langToRemove || langToRemove.isDefault()) {
this.addActionError(this.getText("error.lang.removeDefault"));
return INPUT;
}
this.getLangManager().removeLang(this.getLangCode());
} catch (Throwable t) {
_logger.error("error in remove", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class ContentPreviewAction method prepareForward.
private void prepareForward(String pageDestCode) throws IOException {
Lang currentLang = this.getLangManager().getLang(this.getPreviewLangCode());
if (null == currentLang) {
currentLang = this.getLangManager().getDefaultLang();
}
IPageManager pageManager = this.getPageManager();
IPage pageDest = pageManager.getOnlinePage(pageDestCode);
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("contentOnSessionMarker", this.getContentOnSessionMarker());
String redirectUrl = this.getUrlManager().createURL(pageDest, currentLang, parameters, false);
this.getServletResponse().sendRedirect(redirectUrl);
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class TestRequestValidator method testService.
public void testService() throws ApsSystemException {
RequestContext reqCtx = this.getRequestContext();
((MockHttpServletRequest) reqCtx.getRequest()).setServletPath("/it/homepage.wp");
int status = this._requestValidator.service(reqCtx, ControllerManager.CONTINUE);
assertEquals(ControllerManager.CONTINUE, status);
Lang lang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
IPage page = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
assertNotNull(page);
assertNotNull(lang);
assertEquals("it", lang.getCode());
assertEquals("homepage", page.getCode());
}
use of com.agiletec.aps.system.services.lang.Lang in project entando-core by entando.
the class BaseTestCase method createRequestContext.
protected RequestContext createRequestContext(ApplicationContext applicationContext, ServletContext srvCtx) {
RequestContext reqCtx = new RequestContext();
srvCtx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setAttribute(RequestContext.REQCTX, reqCtx);
MockHttpServletResponse response = new MockHttpServletResponse();
MockHttpSession session = new MockHttpSession(srvCtx);
request.setSession(session);
reqCtx.setRequest(request);
reqCtx.setResponse(response);
ILangManager langManager = (ILangManager) this.getService(SystemConstants.LANGUAGE_MANAGER);
Lang defaultLang = langManager.getDefaultLang();
reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG, defaultLang);
return reqCtx;
}
Aggregations