/** * 初始化用户信息 * * @param sbean * @throws PortalServiceException */ public void initUser(LfwSessionBean sbean) throws PortalServiceException { String groupId = sbean.getPk_unit(); String userId = sbean.getPk_user(); Integer userType = ((PtSessionBean) sbean).getUserType(); IPtPortalPageQryService ppq = NCLocator.getInstance().lookup(IPtPortalPageQryService.class); PtPageVO[] currPages = new PtPageVO[0]; if (userType.equals(IUserVO.USERTYPE_GROUP)) { currPages = ppq.getGroupsPage(groupId); /** 过滤掉非用户类型Page */ currPages = PortalPageDataWrap.filterPagesByUserType(currPages, userType); } else { currPages = PortalServiceUtil.getPageQryService().getPageByLevel(userType); } PtPageVO[] userPages = ppq.getUserPages(userId); /** 对比是否有新增加 */ PtPageVO[] newPages = PortalPageDataWrap.checkNews(userPages, currPages); /** 生成缓存对象 */ List<Page> userPageList = PortalPageDataWrap.praseUserPages(userPages); /** 有页面 */ if (newPages != null && newPages.length > 0) { /** 追加到缓存对象 */ userPageList.addAll(PortalPageDataWrap.praseUserPages(newPages)); /** 追加到数据库中 */ IPtPortalPageService pageService = NCLocator.getInstance().lookup(IPtPortalPageService.class); pageService.addUserNewPages(userId, groupId, newPages); } /** 转换为用户缓存 */ Map<String, Page> userPagesCache = PortalPageDataWrap.praseUserPages(userPageList.toArray(new Page[0])); PortalCacheManager.getUserPageCache().clear(); PortalCacheManager.getUserPageCache().putAll(userPagesCache); }
@Override public void deployPortletApp(String projectModuleName) { String runtimeDir = RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR + "/" + projectModuleName; PortalDeployDefinition define = parseModule(runtimeDir); new PtPortletDeploy().deploy(define); PortalCacheManager.notify(CacheKeys.PORTLETS_CACHE, CacheKeys.USER_DIY_PORTLETS_CACHE); PortalCacheManager.notify(CacheKeys.PORTLETS_CACHE, CacheKeys.GROUP_PORTLETS_CACHE); PortalCacheManager.notify(CacheKeys.PORTLETS_CACHE, CacheKeys.SYSTEM_PORTLETS_CACHE); }
@Override public void delete(String systemCode) { PtBaseDAO dao = new PtBaseDAO(); try { dao.deleteByClause(PtSsopropVO.class, " systemcode = '" + systemCode + "'"); } catch (DAOException e) { LfwLogger.error(e.getMessage(), e); } PortalCacheManager.notify( CacheKeys.PORTAL_SSO_PROVIDER_CACHE, CacheKeys.PORTAL_SSO_PROVIDER_MAP_CACHE); }
@Override public void update(PtSsopropVO ssoProp) { PtBaseDAO dao = new PtBaseDAO(); try { dao.updateVO(ssoProp); } catch (DAOException e) { LfwLogger.error(e.getMessage(), e); } PortalCacheManager.notify( CacheKeys.PORTAL_SSO_PROVIDER_CACHE, CacheKeys.PORTAL_SSO_PROVIDER_MAP_CACHE); }
@Override public void add(SSOProviderVO provider) { PtBaseDAO dao = new PtBaseDAO(); PtSsopropVO vo = SSOUtil.provider2prop(provider); try { dao.insertVO(vo); } catch (DAOException e) { LfwLogger.error(e.getMessage(), e); } PortalCacheManager.notify( CacheKeys.PORTAL_SSO_PROVIDER_CACHE, CacheKeys.PORTAL_SSO_PROVIDER_MAP_CACHE); }
@Override public void deployPage(String projectModuleName, String pageName) { String runtimeDir = RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR + "/" + projectModuleName; try { /*从数据库中删除page,重新部署*/ IPtPortalPageService prs = NCLocator.getInstance().lookup(IPtPortalPageService.class); // PortalServiceUtil.getPageService(); prs.delete(projectModuleName, pageName); PortalDeployDefinition define = parseModule(runtimeDir); new PtPageDeploy().deploy(define); PortalCacheManager.clearCache(CacheKeys.PORTTAL_PAGES_CACHE, CacheKeys.GROUP_PAGES_CACHE); } catch (Exception e) { LfwLogger.error(e.getMessage(), e); } }
@SuppressWarnings("unchecked") @Override public void update(SSOProviderVO provider) { PtBaseDAO dao = new PtBaseDAO(); try { List<PtSsopropVO> vos = (List<PtSsopropVO>) dao.retrieveByClause( PtSsopropVO.class, " systemcode = '" + provider.getSystemCode() + "'"); if (vos == null || vos.isEmpty()) { add(provider); } else { PtSsopropVO vo = SSOUtil.provider2prop(provider); vo.setPk_ssoprop(vos.get(0).getPk_ssoprop()); dao.updateVO(vo); } } catch (Exception e) { LfwLogger.error(e.getMessage(), e); } PortalCacheManager.notify( CacheKeys.PORTAL_SSO_PROVIDER_CACHE, CacheKeys.PORTAL_SSO_PROVIDER_MAP_CACHE); }