Package com.agiletec.plugins.jpmyportalplus.aps.system.services.userconfig.model

Examples of com.agiletec.plugins.jpmyportalplus.aps.system.services.userconfig.model.CustomPageConfig


  protected void buildWidgetOutput(IPage page, String[] showletOutput) throws JspException {
    HttpServletRequest req =  (HttpServletRequest) this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX);
    try {
      IPageUserConfigManager pageUserConfigManager = (IPageUserConfigManager) ApsWebApplicationUtils.getBean(JpmyportalplusSystemConstants.PAGE_USER_CONFIG_MANAGER, pageContext);
      CustomPageConfig customPageConfig = null;
      UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) {
        customPageConfig = pageUserConfigManager.getGuestPageConfig(page, req);
      } else {
        PageUserConfigBean userConfigBean = (PageUserConfigBean) req.getSession().getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG);
        if (null != userConfigBean) {
          customPageConfig = userConfigBean.getConfig().get(page.getCode());
        }
      }
      if (null == customPageConfig || customPageConfig.getConfig() == null || !customPageConfig.getPageCode().equals(page.getCode())) {
        req.getSession().removeAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_PAGE_CONFIG);
        super.buildWidgetOutput(page, showletOutput);
        return;
      }
      req.getSession().setAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_PAGE_CONFIG, customPageConfig);
      Widget[] customShowlets = customPageConfig.getConfig();
      Widget[] showletsToRender = pageUserConfigManager.getShowletsToRender(page, customShowlets);
      List<IFrameDecoratorContainer> decorators = this.extractDecorators();
      BodyContent body = this.pageContext.pushBody();
      for (int scan = 0; scan < showletsToRender.length; scan++) {
        reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME, new Integer(scan));
View Full Code Here


  private PageUserConfigBean createPageUserConfigBeanFromResultSet(String username, ResultSet res) {
    PageUserConfigBean pageUserBean = new PageUserConfigBean(username);
    try {
      while (res.next()) {
        String currentPageCode = res.getString(1);
        CustomPageConfig pageConfig = pageUserBean.getConfig().get(currentPageCode);
        if (null == pageConfig) {
          int frames = this.getPageModelframe(currentPageCode);
          pageConfig = new CustomPageConfig(currentPageCode, frames);
          pageUserBean.getConfig().put(currentPageCode, pageConfig);
        }
        int currentFramePos = res.getInt(2);
        if (currentFramePos >= pageConfig.getConfig().length) {
          ApsSystemUtils.getLogger().error("Posizione " + currentFramePos + " incompatibile con pagina '" + currentPageCode + "' " +
              "- utente " + username);
          continue;
        }
        String currentShowletCode = res.getString(3);
        String currentConfig = res.getString(4);
        Widget showlet = this.createShowletFromRecord(currentShowletCode, currentConfig);
        pageConfig.getConfig()[currentFramePos] = showlet;
        int status = res.getInt(5);
        pageConfig.getStatus()[currentFramePos] = status;
      }
    } catch (Throwable t) {
      this.processDaoException(t, "Error while parsing the result set", "createPageUserConfigBeanFromResultSet");
    }
    return pageUserBean;
View Full Code Here

      MyPortalPageModel pageModel = (MyPortalPageModel) currentPage.getModel();
      Integer currentColumnId = pageModel.getFrameConfigs()[this.getFrameWhereOpenSection()].getColumn();
      if (null == currentColumnId) {
        return SUCCESS;
      }
      CustomPageConfig config = this.getCustomPageConfig();
      Widget[] customShowlets = (null == config || config.getConfig() == null) ? null : config.getConfig();
      Widget[] showletsToRender = this.getPageUserConfigManager().getShowletsToRender(currentPage, customShowlets);
      Lang currentLang = this.getCurrentLang();
      String voidShowletCode = this.getPageUserConfigManager().getVoidShowlet().getCode();
      for (int i = 0; i < showletsToRender.length; i++) {
        Frame frame = pageModel.getFrameConfigs()[i];
View Full Code Here

  public void testGetUserConfig() throws Throwable {
    UserDetails user = this.getUser("editorCustomers");
    PageUserConfigBean config = this._pageUserConfigManager.getUserConfig(user);
    assertNotNull(config);
    assertEquals(1, config.getConfig().size());
    CustomPageConfig pageConfig = config.getConfig().get("jpmyportalplus_testpage");
    assertNotNull(pageConfig);
    Widget[] showlets = pageConfig.getConfig();
    Integer[] status = pageConfig.getStatus();
    assertEquals(8, status.length);
    assertEquals(showlets.length, status.length);

    assertNull(status[0]);
    assertEquals(new Integer(0), status[1]);
View Full Code Here

  public void testGetShowletToRender() throws Throwable {
    UserDetails user = this.getUser("editorCustomers");
    PageUserConfigBean config = this._pageUserConfigManager.getUserConfig(user);
    IPage page = this._pageManager.getPage("jpmyportalplus_testpage");
    CustomPageConfig pageConfig = config.getConfig().get("jpmyportalplus_testpage");
    Widget[] showlets = this._pageUserConfigManager.getShowletsToRender(page, pageConfig.getConfig());

    assertEquals(8, showlets.length);

    assertEquals("login_form", showlets[0].getType().getCode());
    assertEquals("jpmyportalplus_void", showlets[1].getType().getCode());
View Full Code Here

    }

    protected Widget[] getCustomShowletConfig(IPage currentPage) throws Throwable {
        Widget[] customShowlets = null;
        try {
            CustomPageConfig customPageConfig =
                    (CustomPageConfig) this.pageContext.getSession().getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_PAGE_CONFIG);
            if (customPageConfig != null && !customPageConfig.getPageCode().equals(currentPage.getCode())) {
                throw new RuntimeException("Current page '" + currentPage.getCode()
                        + "' not equals then pageCode of custom config param '" + customPageConfig.getPageCode() + "'");
            }
            if (null != customPageConfig) {
                customShowlets = customPageConfig.getConfig();
            }
        } catch (Throwable t) {
            String message = "Error extracting custom showlets";
            ApsSystemUtils.logThrowable(t, this, "getCustomShowletConfig", message);
            throw new ApsSystemException(message, t);
View Full Code Here

  @Override
  public String swapFrames() {
    try {
      IPage currentPage = this.getCurrentPage();
      CustomPageConfig config = this.getCustomPageConfig();
      Widget[] customShowlets = (null == config || config.getConfig() == null) ? null : config.getConfig();
      Widget[] showletsToRender = this.getPageUserConfigManager().getShowletsToRender(currentPage, customShowlets);

      Widget showletToMove = showletsToRender[this.getStartFramePos()];
      Integer statusShowletToMoveInteger = this.getCustomShowletStatus() != null ? this.getCustomShowletStatus()[this.getStartFramePos()] : null;
      int statusShowletToMove = (statusShowletToMoveInteger == null) ? 0 : statusShowletToMoveInteger;
View Full Code Here

  }

  protected boolean executeResizeFrame(int status) {
    try {
      IPage currentPage = this.getCurrentPage();
      CustomPageConfig config = this.getCustomPageConfig();
      Widget[] customShowlets = (null == config || config.getConfig() == null) ? null : config.getConfig();
      Widget[] showletsToRender = this.getPageUserConfigManager().getShowletsToRender(currentPage, customShowlets);
      Widget showlet = showletsToRender[this.getFrameToResize()];
      if (null == showlet) return true;
      WidgetUpdateInfoBean resizingFrame =
        new WidgetUpdateInfoBean(this.getFrameToResize(), showlet, status);
View Full Code Here

      if (null == currentUser) {
        currentUser = this.getUserManager().getGuestUser();
        this.getRequest().getSession().setAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER, currentUser);
      }
      if (!currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) {
        CustomPageConfig customUserPageConfig = null;
        PageUserConfigBean pageUserConfigBean =
          (PageUserConfigBean) this.getRequest().getSession().getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG);
        if (null == pageUserConfigBean) {
          ApsSystemUtils.getLogger().info("No Page User Config by user " + currentUser.getUsername());
          pageUserConfigBean = this.createNewPageUserConfig(infos, currentUser, currentPage);
          this.getRequest().getSession().setAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG, pageUserConfigBean);
          customUserPageConfig = pageUserConfigBean.getConfig().get(currentPage.getCode());
        } else {
          customUserPageConfig = pageUserConfigBean.getConfig().get(currentPage.getCode());
          if (null == customUserPageConfig) {
            customUserPageConfig = this.createNewPageConfig(infos, currentPage);
            pageUserConfigBean.getConfig().put(currentPage.getCode(), customUserPageConfig);
          } else {
            this.updatePageConfig(customUserPageConfig, infos);
          }
        }
        this.getRequest().getSession().setAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_PAGE_CONFIG, customUserPageConfig);
      } else {
        CustomPageConfig customGuestPageConfig =
          (CustomPageConfig) this.getRequest().getSession().getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_PAGE_CONFIG);
        if (null != customGuestPageConfig) {
          this.updatePageConfig(customGuestPageConfig, infos);
        } else {
          customGuestPageConfig = this.createNewPageConfig(infos, currentPage);
View Full Code Here

    return true;
  }

  private PageUserConfigBean createNewPageUserConfig(WidgetUpdateInfoBean[] infos, UserDetails currentUser, IPage currentPage) {
    PageUserConfigBean bean = new PageUserConfigBean(currentUser.getUsername());
    CustomPageConfig pageConfig = this.createNewPageConfig(infos, currentPage);
    bean.getConfig().put(currentPage.getCode(), pageConfig);
    return bean;
  }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpmyportalplus.aps.system.services.userconfig.model.CustomPageConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.