Package org.gatein.mop.api.workspace

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


      super.tearDown();
   }

   public void testNavigation() throws Exception
   {
      Site portal = session.getWorkspace().getSite(ObjectType.PORTAL_SITE, "test");
      assertNotNull(portal);

      //
      Navigation rootNavigation = portal.getRootNavigation();
      assertNotNull(rootNavigation);

      //
      Navigation defaultNav = rootNavigation.getChild("default");
View Full Code Here


      assertNotNull(link);
   }

   public void testPortal() throws Exception
   {
      Site portal = session.getWorkspace().getSite(ObjectType.PORTAL_SITE, "test");
      assertNotNull(portal);

      //
      assertTrue(portal.isAdapted(ProtectedResource.class));
      ProtectedResource pr = portal.adapt(ProtectedResource.class);
      assertEquals(Arrays.asList("test_access_permissions"), pr.getAccessPermissions());
      assertEquals("test_edit_permission", pr.getEditPermission());

      //
      assertEquals("test", portal.getName());
      Attributes attrs = portal.getAttributes();
      assertEquals("en", attrs.getString("locale"));
      assertEquals("test_skin", attrs.getString("skin"));
      assertEquals("test_prop_value", attrs.getString("prop_key"));

      //
      Page layout = portal.getRootNavigation().getTemplatized().getTemplate();
      assertNotNull(layout);
      assertSame(portal.getRootPage().getChild("templates").getChild("default"), layout);
   }
View Full Code Here

      assertSame(portal.getRootPage().getChild("templates").getChild("default"), layout);
   }

   public void testPageWithoutPageId() throws Exception
   {
      Site testPortal = session.getWorkspace().getSite(ObjectType.PORTAL_SITE, "test");
      Page testRootPage = testPortal.getRootPage();
      Page pages = testRootPage.getChild("pages");
      Page testPage = pages.getChild("test2");
      assertNotNull(testPage);
   }
View Full Code Here

      assertNotNull(testPage);
   }

   public void testPage() throws Exception
   {
      Site testPortal = session.getWorkspace().getSite(ObjectType.PORTAL_SITE, "test");
      Page testRootPage = testPortal.getRootPage();
      Page pages = testRootPage.getChild("pages");
      Page testPage = pages.getChild("test1");
      assertNotNull(testPage);

      //
View Full Code Here

            // mappings.setRedirectMap((HashMap)mappingsData.getMappings());
        }
    }

    public PageData load(org.gatein.mop.api.workspace.Page src) {
        Site site = src.getSite();
        String ownerType = getOwnerType(site.getObjectType());
        String ownerId = site.getName();
        String name = src.getName();
        List<ComponentData> children = loadChildren(src.getRootComponent());
        Attributes attrs = src.getAttributes();

        //
View Full Code Here

            if (component instanceof UIContainer) {
                UIContainer srcContainer = (UIContainer) component;
                Attributes attrs = srcContainer.getAttributes();
                String type = attrs.getValue(MappedAttributes.TYPE);
                if ("dashboard".equals(type)) {
                    Site owner = src.getPage().getSite();
                    TransientApplicationState<Portlet> state = new TransientApplicationState<Portlet>(
                            "dashboard/DashboardPortlet", null, getOwnerType(owner.getObjectType()), owner.getName());

                    //
                    boolean showInfoBar = attrs.getValue(MappedAttributes.SHOW_INFO_BAR, false);
                    boolean showMode = attrs.getValue(MappedAttributes.SHOW_MODE, false);
                    boolean showWindowState = attrs.getValue(MappedAttributes.SHOW_WINDOW_STATE, false);
View Full Code Here

            //
            TransientApplicationState<S> transientState = (TransientApplicationState<S>) instanceState;

            // Attempt to get a site from the instance state
            Site site = null;
            if (transientState.getOwnerType() != null && transientState.getOwnerId() != null) {
                ObjectType<Site> siteType = parseSiteType(transientState.getOwnerType());
                site = session.getWorkspace().getSite(siteType, transientState.getOwnerId());
            }

            // The current site
            Site currentSite = dst.getPage().getSite();

            // If it is the same site than the current page
            // set null
            if (site == dst.getPage().getSite()) {
                site = null;
View Full Code Here

        POMSession session = pomMgr.getSession();

        WorkspaceObject workspaceObject = session.findObjectById(workspaceObjectId);

        if (workspaceObject instanceof UIComponent) {
            Site site = ((UIComponent) workspaceObject).getPage().getSite();
            ObjectType<? extends Site> siteType = site.getObjectType();

            String[] siteInfo = new String[2];

            // Put the siteType on returned map
            if (siteType == ObjectType.PORTAL_SITE) {
                siteInfo[0] = PortalConfig.PORTAL_TYPE;
            } else if (siteType == ObjectType.GROUP_SITE) {
                siteInfo[0] = PortalConfig.GROUP_TYPE;
            } else if (siteType == ObjectType.USER_SITE) {
                siteInfo[0] = PortalConfig.USER_TYPE;
            }

            // Put the siteOwner on returned map
            siteInfo[1] = site.getName();

            return siteInfo;
        }

        throw new Exception("The provided ID is not associated with an application");
View Full Code Here

            return key;
        }

        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

            return key;
        }

        public Void run(POMSession session) {
            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");
            }
            new Mapper(session).save(config, site);
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.