Package org.gatein.mop.api.workspace

Examples of org.gatein.mop.api.workspace.Site


      }

      public Void run(POMSession session) throws Exception
      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(siteType, ownerId);

         //
         Customization customization = null;
         if (site != null)
         {
            if (instanceName.startsWith("@"))
            {
               String id = instanceName.substring(1);
               UIWindow window = session.findObjectById(ObjectType.WINDOW, id);

               // Should check it's pointing to same instance though
               customization = window.getCustomization();
            }
            else
            {
               int pos = instanceName.indexOf("#");
               if (pos != -1)
               {
                  String a = instanceName.substring(0, pos);
                  String b = instanceName.substring(pos + 1);
                  Page page = site.getRootPage().getChild("pages").getChild(b);
                  Customization c = page.getCustomizationContext().getCustomization(a);
                  if (c != null)
                  {
                     c.destroy();
                  }
                  customization =
                     page.getCustomizationContext().customize(a, Portlet.CONTENT_TYPE, applicationName + "/" + portletName,
                        new PortletBuilder().build());
               }
               else
               {
                  Customization c = site.getCustomizationContext().getCustomization(instanceName);
                  if (c != null)
                  {
                     c.destroy();
                  }
                  customization =
                     site.getCustomizationContext().customize(instanceName, Portlet.CONTENT_TYPE, applicationName + "/" + portletName,
                        new PortletBuilder().build());
               }
            }
         }
View Full Code Here


      }

      public PortletPreferences run(POMSession session) throws Exception
      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(siteType, ownerId);
         if (site == null)
         {
            throw new IllegalArgumentException("Cannot load portlet preferences " + windowId
               + " as the corresponding portal " + ownerId + " with type " + siteType + " does not exist");
         }

         //
         if (instanceName != null)
         {
            Customization<Portlet> customization;
            if (instanceName.startsWith("@"))
            {
               String id = instanceName.substring(1);
               UIWindow window = session.findObjectById(ObjectType.WINDOW, id);
               customization = (Customization<Portlet>)window.getCustomization();
            }
            else
            {
               int pos = instanceName.indexOf('#');
               if (pos == -1)
               {
                  customization = (Customization<Portlet>)site.getCustomizationContext().getCustomization(instanceName);
               }
               else
               {
                  String a = instanceName.substring(0, pos);
                  String b = instanceName.substring(pos + 1);
                  Page page = site.getRootPage().getChild("pages").getChild(b);
                  customization = (Customization<Portlet>)page.getCustomizationContext().getCustomization(a);
               }
            }

            //
View Full Code Here

            {
               Iterator<? extends Site> iterator = portals.iterator();
               PortalKey[] result = new PortalKey[length];
               for (int i = 0; i < length; i++)
               {
                  Site site = iterator.next();
                  result[i] = new PortalKey("portal", site.getName());
               }
               return result;
            }

            public int getSize() throws Exception
View Full Code Here

      }

      public NavigationData run(POMSession session) throws Exception
      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(siteType, key.getId());
         if (site != null)
         {
            Navigation nav = site.getRootNavigation();
            Navigation defaultNav = nav.getChild("default");
            if (defaultNav != null)
            {
               return new Mapper(session).load(defaultNav);
            }
View Full Code Here

      }

      public Void run(POMSession session) throws Exception
      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(siteType, key.getId());
         if (site == null)
         {
            throw new IllegalArgumentException("Cannot insert page navigation "
               + " as the corresponding portal " + key.getId() + " with type " + siteType + " does not exist");
         }

         // Delete node descendants first
         Navigation nav = site.getRootNavigation();

         //
         Navigation defaultNav = nav.getChild("default");
         if (defaultNav == null)
         {
View Full Code Here

      }

      public Void run(POMSession session) throws Exception
      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(siteType, key.getId());
         if (site == null)
         {
            throw new IllegalArgumentException("Cannot insert page navigation "
               + " as the corresponding portal " + key.getId() + " with type " + siteType + " does not exist");
         }

         // Delete descendants
         Navigation nav = site.getRootNavigation();

         //
         Navigation defaultNav = nav.getChild("default");
         if (defaultNav != null)
         {
View Full Code Here

      }

      public Void run(POMSession session)
      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(type, key.getId());
         if (site == null)
         {
            throw new NoSuchDataException("Could not remove non existing portal " + key.getId());
         }
         else
         {
            site.destroy();
         }
         return null;
      }
View Full Code Here

      }

      public Void run(POMSession session) throws Exception
      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(type, key.getId());
         if (site != null)
         {
            if (!overwrite)
            {
               throw new IllegalArgumentException("Cannot create portal " + config.getName() + " that already exist");
            }
         }
         else
         {
            if (overwrite)
            {
               throw new IllegalArgumentException("Cannot update portal " + config.getName() + " that does not exist");
            }

            //
            site = workspace.addSite(type, config.getName());
            Page root = site.getRootPage();
            root.addChild("pages");
            root.addChild("templates");

            // Add pending preferences
            for (PortletPreferences prefs : session.getPortletPreferences(site))
View Full Code Here

      }

      public PortalData run(POMSession session)
      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(type, key.getId());
         if (site != null)
         {
            return new Mapper(session).load(site);
         }
View Full Code Here

      {
         Workspace workspace = session.getWorkspace();

         //
         org.gatein.mop.api.workspace.Page srcPage;
         Site srcSite = workspace.getSite(siteType, ownerId);
         if (srcSite == null)
         {
            throw new NoSuchDataException("Could not clone  page " + name + "from non existing site of type "
               + ownerType + " with id " + ownerId);
         }
         else
         {
            org.gatein.mop.api.workspace.Page root = srcSite.getRootPage();
            org.gatein.mop.api.workspace.Page pages = root.getChild("pages");
            srcPage = pages.getChild(name);
         }

         //
         if (srcPage == null)
         {
            throw new NoSuchDataException("Could not clone non existing page " + name + " from site of type "
               + ownerType + " with id " + ownerId);
         }

         //
         Site dstSite = workspace.getSite(cloneSiteType, cloneOwnerId);
         if (dstSite == null)
         {
            throw new IllegalArgumentException("Could not clone page " + name + "to non existing site of type "
               + ownerType + " with id " + ownerId);
         }
View Full Code Here

TOP

Related Classes of org.gatein.mop.api.workspace.Site

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.