Package org.gatein.pc.api.info

Examples of org.gatein.pc.api.info.PortletInfo


      try
      {
         LinkedList<WindowEvent> toConsume = new LinkedList<WindowEvent>();
         for (Portlet portlet : invoker.getPortlets())
         {
            PortletInfo portletInfo = portlet.getInfo();
            if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
            {
               WindowEvent distributedEvent = new WindowEvent(producedEvent.getName(), producedEvent.getPayload(), portlet.getContext().getId());
               toConsume.addLast(distributedEvent);
            }
         }
View Full Code Here


      //
      Map<Key, Portlet> portlets = new HashMap<Key, Portlet>();
      for (Portlet portlet : invoker.getPortlets())
      {
         PortletInfo portletInfo = portlet.getInfo();
         String portletName = portletInfo.getName();
         String applicationName = portletInfo.getApplicationName();
         Key key = new Key(applicationName, portletName);
         portlets.put(key, portlet);
      }

      //
View Full Code Here

            Portlet portlet = this.context.getPortlet(windowId);

            //
            if (portlet != null)
            {
               PortletInfo portletInfo = portlet.getInfo();

               //
               if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
               {
                  PortletWindowEvent destinationEvent = new PortletWindowEvent(producedEvent.getName(), producedEvent.getPayload(), windowId);

                  //
                  EventRoute eventRoute = new EventRoute(
View Full Code Here

        PortletInvoker portletInvoker = (PortletInvoker) manager.getComponentInstance(PortletInvoker.class);
        Set<org.gatein.pc.api.Portlet> portlets = portletInvoker.getPortlets();

        //
        portlet: for (org.gatein.pc.api.Portlet portlet : portlets) {
            PortletInfo info = portlet.getInfo();
            String portletApplicationName = info.getApplicationName();
            String portletName = portlet.getContext().getId();

            // Need to sanitize portlet and application names in case they contain characters that would
            // cause an improper Application name
            portletApplicationName = portletApplicationName.replace('/', '_');
            portletName = portletName.replace('/', '_');

            MetaInfo metaInfo = portlet.getInfo().getMeta();
            LocalizedString keywordsLS = metaInfo.getMetaValue(MetaInfo.KEYWORDS);

            //
            Set<String> categoryNames = new HashSet<String>();

            // Process keywords
            if (keywordsLS != null) {
                String keywords = keywordsLS.getDefaultString();
                if (keywords != null && keywords.length() != 0) {
                    for (String categoryName : keywords.split(",")) {
                        // Trim name
                        categoryName = categoryName.trim();
                        if (INTERNAL_PORTLET_TAG.equalsIgnoreCase(categoryName)) {
                            log.debug("Skipping portlet (" + portletApplicationName + "," + portletName
                                    + ") + tagged as internal");
                            continue portlet;
                        } else {
                            categoryNames.add(categoryName);
                        }
                    }
                }
            }

            ArrayList<String> permissions = new ArrayList<String>();
            permissions.add(anyOfAdminGroup);
            // If no keywords, use the portlet application name
            if (categoryNames.isEmpty()) {
                categoryNames.add(portletApplicationName.trim());
            }

            // Additionally categorise the portlet as remote
            boolean remote = portlet.isRemote();
            if (remote) {
                categoryNames.add(REMOTE_CATEGORY_NAME);

                // add producer name to categories for easier finding of portlets for GTNPORTAL-823
                LocalizedString producerNameLS = metaInfo.getMetaValue(PRODUCER_NAME_META_INFO_KEY);
                if (producerNameLS != null) {
                    categoryNames.add(producerNameLS.getDefaultString() + PRODUCER_CATEGORY_NAME_SUFFIX);
                }
            }

            //
            log.info("Importing portlet (" + portletApplicationName + "," + portletName + ") in categories " + categoryNames);

            // Process category names
            for (String categoryName : categoryNames) {
                CategoryDefinition category = registry.getCategory(categoryName);

                //
                if (category == null) {
                    category = registry.createCategory(categoryName);
                    category.setDisplayName(categoryName);
                    category.setAccessPermissions(permissions);
                }

                //
                ContentDefinition app = category.getContentMap().get(portletName);
                if (app == null) {
                    LocalizedString descriptionLS = metaInfo.getMetaValue(MetaInfo.DESCRIPTION);
                    LocalizedString displayNameLS = metaInfo.getMetaValue(MetaInfo.DISPLAY_NAME);
                    String displayName = getLocalizedStringValue(displayNameLS, portletName);

                    ContentType<?> contentType;
                    String contentId;
                    if (remote) {
                        contentType = WSRP.CONTENT_TYPE;
                        contentId = portlet.getContext().getId();
                        displayName += REMOTE_DISPLAY_NAME_SUFFIX; // add remote to display name to make it more obvious that
                                                                   // the portlet is remote
                    } else {
                        contentType = Portlet.CONTENT_TYPE;
                        contentId = info.getApplicationName() + "/" + info.getName();
                    }

                    // Check if the portlet has already existed in this category
                    List<Application> applications = load(category).getApplications();
                    boolean isExist = false;
View Full Code Here

            QName eventName = eventInvocation.getName();

            boolean trace = log.isTraceEnabled();

            // get the event metadata from the portlet metadata
            PortletInfo info = container.getInfo();
            EventingInfo eventingInfo = info.getEventing();
            Map<QName, ? extends EventInfo> consumedEventInfos = eventingInfo.getConsumedEvents();
            EventInfo eventInfo = consumedEventInfos.get(eventName);

            Class dstPayloadClass;
            if (eventInfo != null)
View Full Code Here

TOP

Related Classes of org.gatein.pc.api.info.PortletInfo

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.