Examples of Attributes


Examples of org.gatein.mop.api.Attributes

      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

Examples of org.gatein.mop.api.Attributes

      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

Examples of org.gatein.mop.api.Attributes

         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

Examples of org.gatein.mop.api.Attributes

   }

   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

Examples of org.gatein.mop.api.Attributes

               + 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

Examples of org.gatein.mop.api.Attributes

      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

Examples of org.gatein.mop.api.Attributes

      }

      //
      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

Examples of org.gatein.mop.api.Attributes

         // 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

Examples of org.gatein.mop.api.Attributes

      Described described = dst.adapt(Described.class);
      described.setName(src.getTitle());
      described.setDescription(src.getDescription());

      //
      Attributes attrs = dst.getAttributes();
      attrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
      attrs.setValue(MappedAttributes.SHOW_MAX_WINDOW, src.isShowMaxWindow());

      //
      UIContainer rootContainer = dst.getRootComponent();

      // We are creating a new Page with the root container id as this one is lost
View Full Code Here

Examples of org.gatein.mop.api.Attributes

      Described described = dst.adapt(Described.class);
      described.setName(src.getTitle());
      described.setDescription(src.getDescription());

      Attributes dstAttrs = dst.getAttributes();
      dstAttrs.setValue(MappedAttributes.ID, src.getId());
      dstAttrs.setValue(MappedAttributes.TYPE, src instanceof DashboardData ? "dashboard" : null);
      dstAttrs.setValue(MappedAttributes.ICON, src.getIcon());
      dstAttrs.setValue(MappedAttributes.TEMPLATE, src.getTemplate());
      dstAttrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
      dstAttrs.setValue(MappedAttributes.WIDTH, src.getWidth());
      dstAttrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
      dstAttrs.setValue(MappedAttributes.NAME, src.getName());
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.