Package org.gatein.pc.api.info

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


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

         // 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(UserACL.EVERYONE);
         // 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();
               }

               //
               app = category.createContent(portletName, contentType, contentId);
               app.setDisplayName(displayName);
View Full Code Here


         (FederatingPortletInvoker)manager.getComponentInstance(PortletInvoker.class);
      Set<Portlet> portlets = remote ? portletInvoker.getRemotePortlets() : portletInvoker.getLocalPortlets();
      List<Application> applications = new ArrayList<Application>(portlets.size());
      for (Portlet portlet : portlets)
      {
         PortletInfo info = portlet.getInfo();

         LocalizedString descriptionLS = info.getMeta().getMetaValue(MetaInfo.DESCRIPTION);
         LocalizedString displayNameLS = info.getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);

         String portletName = info.getName();
         Application app = new Application();
         app.setApplicationName(portletName);
         //         app.setApplicationGroup(info.getApplicationName());
         ApplicationType appType;
         String contentId;
         String displayName = Util.getLocalizedStringValue(displayNameLS, portletName);
         if (remote)
         {
            appType = ApplicationType.WSRP_PORTLET;
            contentId = portlet.getContext().getId();
            displayName += ApplicationRegistryService.REMOTE_DISPLAY_NAME_SUFFIX;  // add remote to display name to make it more obvious that the portlet is remote
         }
         else
         {
            appType = ApplicationType.PORTLET;
            contentId = info.getApplicationName() + "/" + info.getName();
         }
         app.setType(appType);
         app.setDisplayName(displayName);
         app.setDescription(Util.getLocalizedStringValue(descriptionLS, portletName));
         app.setAccessPermissions(new ArrayList<String>());
View Full Code Here

            QName eventName = eventInvocation.getName();
            String containerId = container.getId();
            String applicationId = application.getId();

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

            //
            if (trace)
View Full Code Here

      {
         throw new PortletInvokerException("The portlet " + context.getPortletContext() + " referenced by this clone " + portletId + " is not available");
      }

      // Get the portlet info
      PortletInfo referencedPortletInfo = referencedPortlet.getInfo();

      //
      PreferencesInfo prefs = referencedPortletInfo.getPreferences();

      // Clone the current state
      PropertyMap properties = new SimplePropertyMap(statefulContext.getProperties());

      // Clone argument
View Full Code Here

    public String getDisplayName() {
        if (displayName == null) {
            org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
            if (portlet != null) {
                PortletInfo info = portlet.getInfo();
                MetaInfo meta = info.getMeta();
                displayName = meta.getMetaValue(MetaInfo.DISPLAY_NAME);
                String value = null;
                if (displayName != null) {
                    RequestContext i = PortalRequestContext.getCurrentInstance();
                    Locale locale = i.getLocale();
                    value = displayName.getString(locale, true);
                }
                if (value == null || value.length() == 0) {
                    value = info.getName();
                }
                return value;
            } else {
                return "";
            }
        } else {
            RequestContext i = PortalRequestContext.getCurrentInstance();
            Locale locale = i.getLocale();
            String value = displayName.getString(locale, true);

            if (ParameterValidation.isNullOrEmpty(value)) {
                org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
                PortletInfo info = portlet.getInfo();
                value = info.getName();
            }

            return value;
        }
    }
View Full Code Here

        Portlet portlet = uiPortlet.getProducedOfferedPortlet();
        if (portlet == null || portlet.getInfo() == null)
            return;

        PortletInfo portletInfo = portlet.getInfo();

        /*
         * Define which portlet modes the portlet supports and hence should be shown in the portlet info bar
         */
        Set<ModeInfo> modes = portletInfo.getCapabilities().getModes(MediaType.create("text/html"));
        List<String> supportModes = new ArrayList<String>();
        for (ModeInfo modeInfo : modes) {
            String modeName = modeInfo.getModeName().toLowerCase();
            if ("config".equals(modeInfo.getModeName())) {
                supportModes.add(modeName);
View Full Code Here

               ManagedObjectLifeCycleEvent lifeCycleEvent = (ManagedObjectLifeCycleEvent)managedObjectEvent;
               LifeCycleStatus status = lifeCycleEvent.getStatus();
               if (LifeCycleStatus.STARTED.equals(status))
               {
                  // if the portlet started, add it to the service description
                  final PortletInfo info = portletContainer.getInfo();
                  // but only if it's remotable
                  if (isRemotable(info.getRuntimeOptionsInfo()))
                  {
                     serviceDescription.addPortletDescription(pc, info);
                  }
               }
               else
View Full Code Here

     */
    public String getDisplayName() {
        if (displayName == null) {
            org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
            if (portlet != null) {
                PortletInfo info = portlet.getInfo();
                MetaInfo meta = info.getMeta();
                displayName = meta.getMetaValue(MetaInfo.DISPLAY_NAME);
                String value = null;
                if (displayName != null) {
                    RequestContext i = PortalRequestContext.getCurrentInstance();
                    Locale locale = i.getLocale();
                    value = displayName.getString(locale, true);
                }
                if (value == null || value.length() == 0) {
                    value = info.getName();
                }
                return value;
            } else {
                return "";
            }
        } else {
            RequestContext i = PortalRequestContext.getCurrentInstance();
            Locale locale = i.getLocale();
            String value = displayName.getString(locale, true);

            if (ParameterValidation.isNullOrEmpty(value)) {
                org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
                PortletInfo info = portlet.getInfo();
                value = info.getName();
            }

            return value;
        }
    }
View Full Code Here

               {
                  try
                  {
                     // clones have the same metadata as original portlets so retrieve initial context from portlet info and get description from it
                     Portlet portlet = producer.getPortletWith(pcContext, registration);
                     PortletInfo info = portlet.getInfo();
                     org.gatein.pc.api.PortletContext original = org.gatein.pc.api.PortletContext.createPortletContext(info.getApplicationName(), info.getName());
                     return getPortletDescription(original.getId(), desiredLocales);
                  }
                  catch (Exception e)
                  {
                     log.debug("Couldn't retrieve portlet " + pcContext, e);
View Full Code Here

         UserContext userContext = getPortletPropertyDescription.getUserContext();
         checkUserAuthorization(userContext);

         Portlet portlet = getPortletFrom(portletContext, registration);
         PortletInfo info = portlet.getInfo();
         PreferencesInfo prefsInfo = info.getPreferences();

         List<PropertyDescription> descs = Collections.emptyList();
         if (prefsInfo != null)
         {
            Set keySet = prefsInfo.getKeys();
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.