Package org.exoplatform.portal.config

Examples of org.exoplatform.portal.config.DataStorage


      {
         UIPageBrowser uiPageBrowser = event.getSource();
         PortalRequestContext pcontext = Util.getPortalRequestContext();
         String id = pcontext.getRequestParameter(OBJECTID);
         UserPortalConfigService service = uiPageBrowser.getApplicationComponent(UserPortalConfigService.class);
         DataStorage dataService = uiPageBrowser.getApplicationComponent(DataStorage.class);

         UIPortalApplication uiPortalApp = (UIPortalApplication)pcontext.getUIApplication();
         if (service.getPage(id) == null)
         {
            uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{id}, 1));
            pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
            return;
         }
         Page page = service.getPage(id, pcontext.getRemoteUser());
         if (page == null || !page.isModifiable())
         {
            uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.delete.NotDelete", new String[]{id}, 1));
            pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
            return;
         }

         UIVirtualList virtualList = uiPageBrowser.getChild(UIVirtualList.class);
         UIRepeater repeater = (UIRepeater)virtualList.getDataFeed();
         PageListAccess datasource = (PageListAccess)repeater.getDataSource();
         int currentPage = datasource.getCurrentPage();

         dataService.remove(page);
         //Minh Hoang TO: The cached UIPage objects corresponding to removed Page should be removed here.
         //As we have multiple UIPortal, which means multiple caches of UIPage. It 's unwise to garbage
         // all UIPage caches at once. Better solution is to clear UIPage on browsing to PageNode having Page
         //removed
        
View Full Code Here


       * @throws Exception any exception
       */
      private void removePageNode(Page page, Event<UIPageBrowser> event) throws Exception
      {
         UIPageBrowser uiPageBrowser = event.getSource();
         DataStorage dataService = uiPageBrowser.getApplicationComponent(DataStorage.class);

         PageNavigation pageNavigation = null;
         UIPortalApplication portalApplication = Util.getUIPortalApplication();

         List<PageNavigation> listPageNavigation = portalApplication.getNavigations();

         for (PageNavigation pageNvg : listPageNavigation)
         {
            if (pageNvg.getOwnerType().equals(PortalConfig.USER_TYPE))
            {
               pageNavigation = pageNvg;
               break;
            }
         }
         UIPortal uiPortal = Util.getUIPortal();

         PageNode tobeRemoved = null;
         List<PageNode> nodes = pageNavigation.getNodes();
         for (PageNode pageNode : nodes)
         {
            String pageReference = pageNode.getPageReference();
            String pageId = page.getPageId();

            if (pageReference != null && pageReference.equals(pageId))
            {
               tobeRemoved = pageNode;
               break;
            }
         }

         if (tobeRemoved != null)
         {
            // Remove pageNode
            pageNavigation.getNodes().remove(tobeRemoved);

            // Update navigation and UserToolbarGroupPortlet

            String pageRef = tobeRemoved.getPageReference();
            if (pageRef != null && pageRef.length() > 0)
            {
               // Remove from cache
               uiPortal.clearUIPage(pageRef);
            }

            dataService.save(pageNavigation);

            //Update UserToolbarGroupPortlet
            UIWorkingWorkspace uiWorkingWS = portalApplication.getChild(UIWorkingWorkspace.class);
            uiWorkingWS.updatePortletsByName("UserToolbarDashboardPortlet");

View Full Code Here

            uiEvent.broadcast();
            return;
         }

         // Perform model update
         DataStorage dataService = uiWorkingWS.getApplicationComponent(DataStorage.class);
         try
         {
            dataService.save(page);
         }
         catch (StaleModelException ex)
         {
            //Temporary solution to concurrency-related issue
            //This catch block should be put in an appropriate ApplicationLifecyclec
         }
         uiToolPanel.setUIComponent(null);

         // Synchronize model object with UIPage object, that seems  redundant but in fact
         // mandatory to have consequent edit actions (on the same page) work properly
         page = dataService.getPage(page.getPageId());
         uiPage.getChildren().clear();
         PortalDataMapper.toUIPage(uiPage, page);
        
         // Update UIPage cache on UIPortal
         uiPortal.setUIPage(pageId, uiPage);
View Full Code Here

            UIPortalToolPanel toolPanel = Util.getUIPortalToolPanel();
            toolPanel.setShowMaskLayer(true);
            pcontext.setFullRender(true);
            UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
            pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
            DataStorage dataService = uiPageForm.getApplicationComponent(DataStorage.class);
            dataService.save(page);
            return;
         }

         List<UIComponent> uiChildren = uiPage.getChildren();
         if (uiChildren == null)
View Full Code Here

      {
         pageNav.addNode(pageNode);
      }
      uiNodeSelector.selectPageNodeByUri(pageNode.getUri());

      DataStorage dataService = getApplicationComponent(DataStorage.class);
      dataService.create(page);
      dataService.save(pageNav);
      UIPortal uiPortal = Util.getUIPortal();
      setNavigation(uiPortal.getNavigations(), uiNodeSelector.getSelectedNavigation());
   }
View Full Code Here

   {
      public void execute(Event<UIPortalForm> event) throws Exception
      {
         UIPortalForm uiForm = event.getSource();

         DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
         UserPortalConfigService service = uiForm.getApplicationComponent(UserPortalConfigService.class);
         PortalRequestContext prContext = Util.getPortalRequestContext();

         UserPortalConfig userConfig = service.getUserPortalConfig(uiForm.getPortalOwner(), prContext.getRemoteUser());
         if (userConfig != null)
         {
            UIPortal uiPortal = uiForm.createUIComponent(UIPortal.class, null, null);
            PortalDataMapper.toUIPortal(uiPortal, userConfig);

            UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
            uiForm.invokeSetBindingBean(uiPortal);
            //uiPortal.refreshNavigation(localeConfigService.getLocaleConfig(uiPortal.getLocale()).getLocale()) ;
            if (uiPortalApp.getModeState() == UIPortalApplication.NORMAL_MODE)
            {
               PortalConfig portalConfig = (PortalConfig)PortalDataMapper.buildModelObject(uiPortal);
               UserPortalConfigService configService = uiForm.getApplicationComponent(UserPortalConfigService.class);
               dataService.save(portalConfig);
            }
            else
            {
               UIWorkingWorkspace uiWorkingWS = uiPortalApp.findFirstComponentOfType(UIWorkingWorkspace.class);
               UIEditInlineWorkspace uiEditWS = uiWorkingWS.getChild(UIEditInlineWorkspace.class);
View Full Code Here

         UIPortalForm uiForm = event.getSource();
         PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();
   String template = "classic";
//         String template = uiForm.getChild(UIFormInputItemSelector.class).getSelectedItemOption().getValue().toString();
         String portalName = uiForm.getUIStringInput(FIELD_NAME).getValue();
         DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
         PortalConfig config = dataService.getPortalConfig(portalName);
         if (config != null)
         {
            UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.sameName", null));
            return;
         }

         UserPortalConfigService service = uiForm.getApplicationComponent(UserPortalConfigService.class);
         service.createUserPortalConfig(PortalConfig.PORTAL_TYPE, portalName, template);
         UserPortalConfig userPortalConfig = service.getUserPortalConfig(portalName, pcontext.getRemoteUser());
         PortalConfig pconfig = userPortalConfig.getPortalConfig();
         uiForm.invokeSetBindingBean(pconfig);
         PageNavigation navigation = dataService.getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
         dataService.save(pconfig);
         dataService.save(navigation);
         UIPortalApplication uiPortalApp = event.getSource().getAncestorOfType(UIPortalApplication.class);
         UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
         uiMaskWS.setUIComponent(null);
         pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
View Full Code Here

         PageNode pageNode = uiPageInfo.getPageNode();
         Page page = uiPageTemplateOptions.createPageFromSelectedOption(ownerType, ownerId);
         page.setName("page" + page.hashCode());
         String pageId = pageNavi.getOwnerType() + "::" + pageNavi.getOwnerId() + "::" + page.getName();
         DataStorage storage = uiWizard.getApplicationComponent(DataStorage.class);
         if (storage.getPage(pageId) != null)
         {
            uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.NameNotSame", null));
            uiWizard.viewStep(FIRST_STEP);
            uiWizard.updateWizardComponent();
         }
View Full Code Here

      if (state != null)
      {
         try
         {
            PortletInvoker portletInvoker = getApplicationComponent(PortletInvoker.class);
            DataStorage dataStorage = getApplicationComponent(DataStorage.class);
            String applicationId = dataStorage.getId(state.getApplicationState());
            ModelAdapter<S, C> adapter = ModelAdapter.getAdapter(state.getApplicationType());
            PortletContext producerOfferedPortletContext = adapter.getProducerOfferedPortletContext(applicationId);
            org.gatein.pc.api.Portlet producedOfferedPortlet;
           
            try
View Full Code Here

         UIPortalApplication uiPortalApp = uiPageForm.getAncestorOfType(UIPortalApplication.class);
         PortalRequestContext pcontext = Util.getPortalRequestContext();
         UIPage uiPage = uiPageForm.getUIPage();
         Page page = new Page();
         uiPageForm.invokeSetBindingBean(page);
         DataStorage dataService = uiPageForm.getApplicationComponent(DataStorage.class);
         // create new page
         if (uiPage == null)
         {
            Page existPage = dataService.getPage(page.getPageId());
            if (existPage != null)
            {
               uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.sameName", null));
               pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
               return;
            }
            page.setModifiable(true);
            if (page.getChildren() == null)
               page.setChildren(new ArrayList<ModelObject>());
            dataService.create(page);
            postSave(uiPortalApp, pcontext);
            return;
         }

         page.setOwnerType(uiPage.getOwnerType());
         List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
         findAllPortlet(uiPortlets, uiPage);
         ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
         for (UIPortlet uiPortlet : uiPortlets)
         {
            applications.add(PortalDataMapper.buildModelObject(uiPortlet));
         }

         if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(page.getFactoryId()))
         {
            page.setShowMaxWindow(false);
            uiPage.getChildren().clear();
            page.setChildren(applications);
            PortalDataMapper.toUIPage(uiPage, page);
            // if (page.getTemplate() == null)
            // page.setTemplate(uiPage.getTemplate());
            if (page.getChildren() == null)
               page.setChildren(new ArrayList<ModelObject>());
            dataService.save(page);
            postSave(uiPortalApp, pcontext);
            return;
         }

         List<UIComponent> uiChildren = uiPage.getChildren();
         if (uiChildren == null)
            return;
         ArrayList<ModelObject> children = new ArrayList<ModelObject>();
         for (UIComponent child : uiChildren)
         {
            ModelObject component = PortalDataMapper.buildModelObject(child);
            if (component != null)
               children.add(component);
         }
         page.setChildren(children);
         uiPage.getChildren().clear();

         PortalDataMapper.toUIPage(uiPage, page);
         // if (page.getTemplate() == null) page.setTemplate(uiPage.getTemplate());
         if (page.getChildren() == null)
            page.setChildren(new ArrayList<ModelObject>());
         if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()))
         {
            dataService.save(page);
            postSave(uiPortalApp, pcontext);
         }
      }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.config.DataStorage

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.