Package org.exoplatform.portal.mop.user

Examples of org.exoplatform.portal.mop.user.UserPortal


*/
public class UIPageActionListener {
    public static class ChangeNodeActionListener extends EventListener<UIPortalApplication> {
        public void execute(Event<UIPortalApplication> event) throws Exception {
            PortalRequestContext pcontext = PortalRequestContext.getCurrentInstance();
            UserPortal userPortal = pcontext.getUserPortalConfig().getUserPortal();
            UIPortalApplication uiPortalApp = event.getSource();
            UIPortal showedUIPortal = uiPortalApp.getCurrentSite();

            UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder();
            builder.withReadCheck();

            PageNodeEvent<UIPortalApplication> pageNodeEvent = (PageNodeEvent<UIPortalApplication>) event;
            String nodePath = pageNodeEvent.getTargetNodeUri();

            UserNode targetNode = null;
            SiteKey siteKey = pageNodeEvent.getSiteKey();
            if (siteKey != null) {
                if (pcontext.getRemoteUser() == null
                        && (siteKey.getType().equals(SiteType.GROUP) || siteKey.getType().equals(SiteType.USER))) {
                    NavigationService service = uiPortalApp.getApplicationComponent(NavigationService.class);
                    NavigationContext navContext = service.loadNavigation(siteKey);
                    if (navContext != null) {
                        uiPortalApp.setLastRequestNavData(null);
                        pcontext.requestAuthenticationLogin();
                        return;
                    }
                }

                UserNavigation navigation = userPortal.getNavigation(siteKey);
                if (navigation != null) {
                    targetNode = userPortal.resolvePath(navigation, builder.build(), nodePath);
                    if (targetNode == null) {
                        // If unauthenticated users have no permission on PORTAL node and URL is valid, they will be required to
                        // login
                        if (pcontext.getRemoteUser() == null && siteKey.getType().equals(SiteType.PORTAL)) {
                            targetNode = userPortal.resolvePath(navigation, null, nodePath);
                            if (targetNode != null) {
                                uiPortalApp.setLastRequestNavData(null);
                                pcontext.requestAuthenticationLogin();
                                return;
                            }
                        } else {
                            // If path to node is invalid, get the default node instead of.
                            targetNode = userPortal.getDefaultPath(navigation, builder.build());
                        }
                    }
                }
            }

            if (targetNode == null) {
                targetNode = userPortal.getDefaultPath(builder.build());
                if (targetNode == null) {
                    if (showedUIPortal != null) {
                        UIPageBody uiPageBody = showedUIPortal.findFirstComponentOfType(UIPageBody.class);
                        uiPageBody.setUIComponent(null);
                    }
View Full Code Here


                log.debug("About to create user site for user " + userName);
                configService.createUserSite(userName);
            }

            UserPortalConfig userPortalConfig = context.getUserPortalConfig();
            UserPortal userPortal = userPortalConfig.getUserPortal();
            SiteKey siteKey = context.getSiteKey();
            UserNavigation nav = userPortal.getNavigation(siteKey);

            try {
                UserNode rootNode = userPortal.getNode(nav, Scope.CHILDREN, UserNodeFilterConfig.builder().build(), null);
                if (rootNode.getChildren().size() < 1) {
                    // TODO: Retrieve tab name from request
                    Page page = configService.createPageTemplate(PAGE_TEMPLATE, siteKey.getTypeName(), siteKey.getName());
                    page.setName(DEFAULT_TAB_NAME);
                    page.setTitle(DEFAULT_TAB_NAME);

                    //
                    PageState pageState = new PageState(page.getTitle(), page.getDescription(), page.isShowMaxWindow(),
                            page.getFactoryId(), page.getAccessPermissions() != null ? Arrays.asList(page
                                    .getAccessPermissions()) : null, page.getEditPermission());
                    configService.getPageService().savePage(new PageContext(page.getPageKey(), pageState));

                    //
                    storage.save(page);

                    //
                    UserNode tabNode = rootNode.addChild(DEFAULT_TAB_NAME);
                    tabNode.setLabel(DEFAULT_TAB_NAME);
                    tabNode.setPageRef(PageKey.parse(page.getPageId()));

                    userPortal.saveNode(tabNode, null);
                }
            } catch (Exception ex) {
                log.warn("Navigation " + nav.getKey().getName() + " does not exist!", ex);
            }
View Full Code Here

            event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
        }

        private UserNode resolveNode(UserNode selectedNode, UserNodeFilterConfig filterConfig) {
            UserNavigation currNav = selectedNode.getNavigation();
            UserPortal userPortal = Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();
            if (currNav.getKey().getType().equals(SiteType.USER)) {
                return userPortal.getNode(currNav, Scope.CHILDREN, filterConfig, null);
            } else {
                return userPortal.resolvePath(currNav, filterConfig, selectedNode.getURI());
            }
        }
View Full Code Here

        // Resolve the user node if node path is indicated
        if (!requestPath.equals("")) {
            UserPortalConfig cfg = userPortalService.getUserPortalConfig(requestSiteName, request.getRemoteUser(),
                    userPortalContext);
            if (cfg != null) {
                UserPortal userPortal = cfg.getUserPortal();
                UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder().withAuthMode(
                        UserNodeFilterConfig.AUTH_READ);
                UserNode userNode = userPortal.resolvePath(builder.build(), requestPath);

                if (userNode != null) {
                    siteKey = userNode.getNavigation().getKey();
                    uri = userNode.getURI();
                }
View Full Code Here

         * @param event
         * @throws Exception any exception
         */
        private void removePageNode(PageContext page, Event<UIPageBrowser> event) throws Exception {
            PortalRequestContext prc = Util.getPortalRequestContext();
            UserPortal userPortal = prc.getUserPortalConfig().getUserPortal();

            UserNavigation userNav = userPortal.getNavigation(SiteKey.user(event.getRequestContext().getRemoteUser()));
            UserNode rootNode = userPortal.getNode(userNav, Scope.CHILDREN, null, null);
            if (rootNode == null) {
                return;
            }

            for (UserNode userNode : rootNode.getChildren()) {
                if (page.getKey().equals(userNode.getPageRef())) {
                    // Remove pageNode
                    rootNode.removeChild(userNode.getName());
                    userPortal.saveNode(rootNode, null);

                    // Update navigation and UserToolbarGroupPortlet

                    String pageRef = page.getKey().format();
                    if (pageRef != null && pageRef.length() > 0) {
View Full Code Here

        //
        DataStorage dataService = getApplicationComponent(DataStorage.class);
        dataService.save(page);

        UserPortal userPortal = Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();
        userPortal.saveNode(selectedNode, null);

        DescriptionService descriptionService = getApplicationComponent(DescriptionService.class);
        Map<Locale, Described.State> descriptions = new HashMap<Locale, Described.State>();
        Map<String, String> cachedLabels = uiPageInfo.getCachedLabels();
View Full Code Here

            UIPageNavigationForm uiForm = event.getSource();
            UserNavigation userNav = uiForm.getUserNav();

            // Check existed
            PortalRequestContext prContext = Util.getPortalRequestContext();
            UserPortal userPortal = prContext.getUserPortalConfig().getUserPortal();

            userNav = userPortal.getNavigation(userNav.getKey());

            if (userNav == null) {
                UIPortalApplication uiPortalApp = (UIPortalApplication) prContext.getUIApplication();
                uiPortalApp.addMessage(new ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore", null));
                UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
View Full Code Here

            UserNode currRootNode = getCurrentNavigation();
            if (currRootNode != null) {
                nodes.add(currRootNode);
            }
        } else {
            UserPortal userPortal = Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();
            List<UserNavigation> navigations = userPortal.getNavigations();
            for (UserNavigation userNav : navigations) {
                if (!showUserNavigation && userNav.getKey().getType().equals(SiteType.USER)) {
                    continue;
                }

                UserNode rootNode = userPortal.getNode(userNav, navigationScope, NAVIGATION_FILTER_CONFIG, null);
                if (rootNode != null) {
                    nodes.add(rootNode);
                }
            }
        }
View Full Code Here

    }

    public void loadTreeNodes() throws Exception {
        treeNode_ = new TreeNode();

        UserPortal userPortal = Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();
        List<UserNavigation> listNavigations = userPortal.getNavigations();

        List<UserNode> childNodes = new LinkedList<UserNode>();
        for (UserNavigation nav : rearrangeNavigations(listNavigations)) {
            if (!showUserNavigation && nav.getKey().getType().equals(SiteType.USER)) {
                continue;
            }
            try {
                UserNode rootNode = userPortal.getNode(nav, navigationScope, NAVIGATION_FILTER_CONFIG, null);
                if (rootNode != null) {
                    childNodes.addAll(rootNode.getChildren());
                }
            } catch (Exception ex) {
                log.error(ex.getMessage(), ex);
View Full Code Here

        treeNode_.setChildren(childNodes);
    }

    public UserNode resolvePath(String path) throws Exception {
        WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
        UserPortal userPortal = Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();

        UserNode node;
        if (context.getRemoteUser() != null) {
            node = userPortal.resolvePath(Util.getUIPortal().getUserNavigation(), NAVIGATION_FILTER_CONFIG, path);
        } else {
            node = userPortal.resolvePath(NAVIGATION_FILTER_CONFIG, path);
        }

        if (node != null && !node.getURI().equals(path)) {
            // Node has been deleted
            return null;
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.mop.user.UserPortal

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.