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

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


      RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX);
      Lang lang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
      req.getSession().setAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_LANG, lang);
      UserDetails currentUser = (UserDetails) session.getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (!currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) {
        PageUserConfigBean userConfigBean = (PageUserConfigBean) session.getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG);
        if (null == userConfigBean || !currentUser.getUsername().equals(userConfigBean.getUsername())) {
          IPageUserConfigManager pageUserConfigManager = (IPageUserConfigManager) ApsWebApplicationUtils.getBean(JpmyportalplusSystemConstants.PAGE_USER_CONFIG_MANAGER, pageContext);
          userConfigBean = pageUserConfigManager.getUserConfig(currentUser);
          if (null != userConfigBean) {
            session.setAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG, userConfigBean);
          } else {
View Full Code Here


      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);
View Full Code Here

  }

  @Override
  public PageUserConfigBean getUserConfig(String username) {
    Connection conn = null;
    PageUserConfigBean result = null;
    PreparedStatement stat = null;
    ResultSet res = null;
    try {
      conn = this.getConnection();
      stat = conn.prepareStatement(GET_USER_CONFIG);
View Full Code Here

    newShowlet.setConfig(properties);
    return newShowlet;
  }

  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);
View Full Code Here

    this.init();
  }

  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);
View Full Code Here

    assertNull(showlets[7]);
  }

  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());
View Full Code Here

        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);
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

    ApsSystemUtils.getLogger().debug(this.getClass().getName() + ": initialized");
  }

  @Override
  public PageUserConfigBean getUserConfig(UserDetails user) throws ApsSystemException {
    PageUserConfigBean pageUserBean = null;
    try {
      List<WidgetType> customizables = this.getMyPortalConfigManager().getCustomizableShowlets();
      for (int i = 0; i < customizables.size(); i++) {
        WidgetType type = customizables.get(i);
        String mainGroup = type.getMainGroup();
View Full Code Here

  }

  @Override
  @Deprecated
  public PageUserConfigBean getUserConfig(String username) throws ApsSystemException {
    PageUserConfigBean pageUserBean = null;
    try {
      pageUserBean = this.getPageUserConfigDAO().getUserConfig(username);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getUserConfig");
      throw new ApsSystemException("Error reading the user configuration", t);
View Full Code Here

TOP

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

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.