Package org.gatein.mop.api

Examples of org.gatein.mop.api.Attributes


      //
      Navigation defaultNav = rootNavigation.getChild("default");

      //
      Attributes defaultAttrs = defaultNav.getAttributes();
      assertEquals(1, (int)defaultAttrs.getInteger("priority"));

      //
      Collection<? extends Navigation> childrenNavigations = defaultNav.getChildren();
      assertNotNull(childrenNavigations);
      assertEquals(2, childrenNavigations.size());
      Iterator<? extends Navigation> i = childrenNavigations.iterator();

      //
      assertTrue(i.hasNext());
      Navigation nodeNavigation = i.next();
      assertNotNull(nodeNavigation);
      assertEquals(0, nodeNavigation.getChildren().size());
      assertEquals("node_name", nodeNavigation.getName());
      Described nodeDescribed = nodeNavigation.adapt(Described.class);
      assertEquals("node_label", nodeDescribed.getName());
      Attributes nodeAttrs = nodeNavigation.getAttributes();
      assertEquals("node_uri", nodeAttrs.getString("uri"));
      assertEquals("node_icon", nodeAttrs.getString("icon"));

      //
      assertTrue(nodeNavigation.isAdapted(Visible.class));
      Visible visible = nodeNavigation.adapt(Visible.class);
      GregorianCalendar start = new GregorianCalendar(2000, 2, 21, 1, 33, 0);
View Full Code Here


      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

      Described testPageDescribed = testPage.adapt(Described.class);
      assertEquals("test_title", testPageDescribed.getName());
      assertEquals(null, testPageDescribed.getDescription());

      //
      Attributes testPageAttrs = testPage.getAttributes();
      assertEquals("test_factory_id", testPageAttrs.getString("factory-id"));
      assertEquals(true, (boolean)testPageAttrs.getBoolean("show-max-window"));

      //
      UIContainer c = testPage.getRootComponent();
      assertNotNull(c);
      assertEquals(2, c.getComponents().size());
      Iterator<? extends UIComponent> it = c.getComponents().iterator();

      //
      UIContainer container1 = (UIContainer)it.next();
      assertTrue(container1.isAdapted(ProtectedResource.class));
      ProtectedResource container1PR = container1.adapt(ProtectedResource.class);
      assertEquals(Collections.singletonList("container_1_access_permissions"), container1PR.getAccessPermissions());
      Described container1Described = container1.adapt(Described.class);
      assertEquals("container_1_title", container1Described.getName());
      assertEquals("container_1_description", container1Described.getDescription());
      Attributes container1Attrs = container1.getAttributes();
      assertEquals("container_1", container1Attrs.getString("name"));
      assertEquals("container_1_icon", container1Attrs.getString("icon"));
      assertEquals("container_1_template", container1Attrs.getString("template"));
      assertEquals("container_1_factory_id", container1Attrs.getString("factory-id"));
      assertEquals("container_1_width", container1Attrs.getString("width"));
      assertEquals("container_1_height", container1Attrs.getString("height"));

      //
      UIWindow application1 = (UIWindow)it.next();
      assertTrue(application1.isAdapted(ProtectedResource.class));
      ProtectedResource application1PR = application1.adapt(ProtectedResource.class);
      assertEquals(Collections.singletonList("application_1_access_permissions"), application1PR.getAccessPermissions());
      Described application1Described = application1.adapt(Described.class);
      assertEquals("application_1_title", application1Described.getName());
      assertEquals("application_1_description", application1Described.getDescription());
      Attributes application1Attrs = application1.getAttributes();
      assertEquals("application_1_theme", application1Attrs.getString("theme"));
      assertEquals(true, (boolean)application1Attrs.getBoolean("showinfobar"));
      assertEquals(true, (boolean)application1Attrs.getBoolean("showmode"));
      assertEquals(true, (boolean)application1Attrs.getBoolean("showwindowstate"));
      assertEquals("application_1_icon", application1Attrs.getString("icon"));
      assertEquals("application_1_width", application1Attrs.getString("width"));
      assertEquals("application_1_height", application1Attrs.getString("height"));
      assertEquals("application_1_prop_value", application1Attrs.getString("prop_key"));

      //
      Customization<?> customization = application1.getCustomization();
      assertNotNull(customization);
      assertEquals("application/portlet", customization.getType().getMimeType());
View Full Code Here

      if (type == NavigationData.class)
      {
         Site site = src.getSite();
         String ownerType = getOwnerType(site.getObjectType());
         String ownerId = site.getName();
         Attributes attrs = src.getAttributes();
         NavigationData dstNav = new NavigationData(
            src.getObjectId(),
            ownerType,
            ownerId,
            attrs.getValue(MappedAttributes.PRIORITY, 1),
            children);
         dst = (T)dstNav;
      }
      else if (type == NavigationNodeData.class)
      {
         Attributes attrs = src.getAttributes();
         String pageReference = null;
         Link link = src.getLink();
         if (link instanceof PageLink)
         {
            PageLink pageLink = (PageLink)link;
            org.gatein.mop.api.workspace.Page target = pageLink.getPage();
            if (target != null)
            {
               Site site = target.getSite();
               ObjectType<? extends Site> siteType = site.getObjectType();
               pageReference = getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
            }
         }

         //
         Described described = src.adapt(Described.class);

         //
         Visible visible = src.adapt(Visible.class);

         //
         NavigationNodeData dstNode = new NavigationNodeData(
            src.getObjectId(),
            attrs.getValue(MappedAttributes.URI),
            described.getName(),
            attrs.getValue(MappedAttributes.ICON),
            src.getName(),
            visible.getStartPublicationDate(),
            visible.getEndPublicationDate(),
            visible.getVisibility() != null ? visible.getVisibility() : Visibility.DISPLAYED,
            pageReference,
View Full Code Here

         visible.setVisibility(node.getVisibility());
         visible.setStartPublicationDate(node.getStartPublicationDate());
         visible.setEndPublicationDate(node.getEndPublicationDate());

         //
         Attributes attrs = dst.getAttributes();
         attrs.setValue(MappedAttributes.URI, node.getURI());
         attrs.setValue(MappedAttributes.ICON, node.getIcon());
      }
      else if (src instanceof NavigationData)
      {
         NavigationData pageNav = (NavigationData)src;

         //
         Attributes attrs = dst.getAttributes();
         attrs.setValue(MappedAttributes.PRIORITY, pageNav.getPriority());
      }
      else
      {
         throw new AssertionError();
      }
View Full Code Here

   }

   public PortalData load(Site src)
   {
      String type = Mapper.getOwnerType(src.getObjectType());
      Attributes attrs = src.getAttributes();

      //
      Templatized templarized = src.getRootNavigation().getTemplatized();
      org.gatein.mop.api.workspace.Page template = templarized.getTemplate();
      UIContainer srcLayout = template.getRootComponent();

      //
      Map<String, String> properties = new HashMap<String, String>();
      load(attrs, properties, portalPropertiesBlackList);

      //
      List<ComponentData> layoutChildren = loadChildren(srcLayout);
      ContainerData layout = load(srcLayout, layoutChildren);

      //
      List<String> accessPermissions = Collections.emptyList();
      String editPermission = null;
      if (src.isAdapted(ProtectedResource.class)) {
         ProtectedResource pr = src.adapt(ProtectedResource.class);
         accessPermissions = pr.getAccessPermissions();
         editPermission = pr.getEditPermission();
      }

      //
      return new PortalData(
         src.getObjectId(),
         src.getName(),
         type,
         attrs.getValue(MappedAttributes.LOCALE),
         accessPermissions,
         editPermission,
         Collections.unmodifiableMap(properties),
         attrs.getValue(MappedAttributes.SKIN),
         layout);
   }
View Full Code Here

               + dst.getObjectType() + "/" + dst.getName();
         throw new IllegalArgumentException(msg);
      }

      //
      Attributes attrs = dst.getAttributes();
      attrs.setValue(MappedAttributes.LOCALE, src.getLocale());
      attrs.setValue(MappedAttributes.SKIN, src.getSkin());
      if (src.getProperties() != null)
      {
         save(src.getProperties(), attrs, portalPropertiesBlackList);
      }
View Full Code Here

      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();

      //
      List<String> accessPermissions = Collections.emptyList();
      String editPermission = null;
      if (src.isAdapted(ProtectedResource.class))
      {
         ProtectedResource pr = src.adapt(ProtectedResource.class);
         accessPermissions = pr.getAccessPermissions();
         editPermission = pr.getEditPermission();
      }

      //
      Described described = src.adapt(Described.class);

      //
      return new PageData(
         src.getObjectId(),
         null,
         name,
         null,
         null,
         attrs.getValue(MappedAttributes.FACTORY_ID),
         described.getName(),
         described.getDescription(),
         null,
         null,
         Utils.safeImmutableList(accessPermissions),
         children,
         ownerType,
         ownerId,
         editPermission,
         attrs.getValue(MappedAttributes.SHOW_MAX_WINDOW, false)
      );
   }
View Full Code Here

      }

      //
      Described described = src.adapt(Described.class);

      Attributes attrs = src.getAttributes();
      return new ContainerData(
         src.getObjectId(),
         attrs.getValue(MappedAttributes.ID),
         attrs.getValue(MappedAttributes.NAME),
         attrs.getValue(MappedAttributes.ICON),
         attrs.getValue(MappedAttributes.TEMPLATE),
         attrs.getValue(MappedAttributes.FACTORY_ID),
         described.getName(),
         described.getDescription(),
         attrs.getValue(MappedAttributes.WIDTH),
         attrs.getValue(MappedAttributes.HEIGHT),
         Utils.safeImmutableList(accessPermissions),
         children
      );
   }
View Full Code Here

         // Obtain a model object from the ui component
         ComponentData mo;
         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(),
                  null
               );

               //
               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);
               String theme = attrs.getValue(MappedAttributes.THEME, null);

               //
               List<String> a = Collections.singletonList(UserACL.EVERYONE);
               if (srcContainer.isAdapted(ProtectedResource.class)) {
                  ProtectedResource pr = srcContainer.adapt(ProtectedResource.class);
View Full Code Here

TOP

Related Classes of org.gatein.mop.api.Attributes

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.