Examples of PortletInfo


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

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

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

               {
                  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

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

         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

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

            properties = producer.getPortletInvoker().getProperties(jbpContext);
         }

         //todo: we need to check that the user can actually modify the properties
         Portlet portlet = getPortletFrom(portletContext, registration);
         PortletInfo info = portlet.getInfo();

         PropertyList result = WSRPTypeFactory.createPropertyList();
         int propertyNb = properties.size();

         if (propertyNb > 0)
         {
            PreferenceInfo prefInfo;
            String key;
            List<String> values;
            LocalizedString displayName;

            for (Map.Entry<String, List<String>> entry : properties.entrySet())
            {
               key = entry.getKey();
               values = entry.getValue();
               prefInfo = info.getPreferences().getPreference(key);
               String lang = WSRPConstants.DEFAULT_LOCALE;
               if (prefInfo != null)
               {
                  displayName = prefInfo.getDisplayName();
                  if (displayName != null)
View Full Code Here

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

      {
         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

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

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

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

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

      return windows.get(portletWindowId);
   }

   public Map<String, String[]> getPortletPublicNavigationalState(String portletWindowId)
   {
      PortletInfo info = context.portletControllerContext.getPortletInfo(portletWindowId);

      //
      if (info != null)
      {
         ParameterMap publicNavigationalState = new ParameterMap();
         for (ParameterInfo parameterInfo : info.getNavigation().getPublicParameters())
         {
            String[] parameterValue = page.get(parameterInfo.getName());

            //
            if (parameterValue != null)
View Full Code Here

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

      {
         throw new IllegalStateException("The page navigational state is not modifiable");
      }

      //
      PortletInfo info = context.portletControllerContext.getPortletInfo(portletWindowId);

      //
      if (info != null)
      {
         NavigationInfo navigationInfo = info.getNavigation();
         for (Map.Entry<String, String[]> entry : update.entrySet())
         {
            String id = entry.getKey();

            //
View Full Code Here

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

            EventProduction eventProduction = phaseContext.producedEvents.removeFirst();
            PortletWindowEvent producedEvent = eventProduction.getProducedEvent();

            //
            String producerId = producedEvent.getWindowId();
            PortletInfo producerPortletInfo = context.getPortletInfo(producerId);

            //
            if (producerPortletInfo == null)
            {
               log.trace("Cannot deliver event " + producedEvent +" because the producer does not have portlet info");
               safeInvoker.eventDiscarded(eventCC, phaseContext, producedEvent, EventControllerContext.EVENT_PRODUCER_INFO_NOT_AVAILABLE);
               continue;
            }

            //
            if (!controller.getDistributeNonProduceableEvents())
            {
               if (!producerPortletInfo.getEventing().getProducedEvents().containsKey(producedEvent.getName()))
               {
                  log.trace("Cannot deliver event " + producedEvent +" because the producer of the event does not produce the event name");
                  safeInvoker.eventDiscarded(eventCC, phaseContext, producedEvent, EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
                  continue;
               }
            }

            // Apply produced event quota if necessary
            int producedEventThreshold = controller.getProducedEventThreshold();
            if (producedEventThreshold >= 0)
            {
               if (phaseContext.producedEventSize + 1 > producedEventThreshold)
               {
                  log.trace("Event distribution interrupted because the maximum number of produced event is reached");
                  eventDistributionStatus = PortletResponse.PRODUCED_EVENT_FLOODED;
                  safeInvoker.eventDiscarded(eventCC, phaseContext, producedEvent, EventControllerContext.PRODUCED_EVENT_FLOODED);
                  break;
               }
            }

            // Give control to the event context
            phaseContext.mode = EventPhaseContextImpl.READ_WRITE_MODE;
            if (!safeInvoker.eventProduced(eventCC, phaseContext, eventProduction.getConsumedEvent(), producedEvent))
            {
               continue;
            }

            // Perform flow control
            if (phaseContext.mode == EventPhaseContextImpl.INTERRUPTED_MODE)
            {
               log.trace("Event distribution interrupted by controller context");
               eventDistributionStatus = PortletResponse.INTERRUPTED;
               break;
            }

            //
            while (phaseContext.toConsumeEvents.size() > 0)
            {
               PortletWindowEvent toConsumeEvent = phaseContext.toConsumeEvents.removeFirst();
               String consumedId = toConsumeEvent.getWindowId();

               //
               PortletInfo consumerPortletInfo = context.getPortletInfo(consumedId);
               if (consumerPortletInfo == null)
               {
                  log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not have a portlet info");
                  safeInvoker.eventDiscarded(eventCC, phaseContext, toConsumeEvent, EventControllerContext.EVENT_CONSUMER_INFO_NOT_AVAILABLE);
                  continue;
               }

               //
               if (!controller.getDistributeNonConsumableEvents())
               {
                  if (!consumerPortletInfo.getEventing().getConsumedEvents().containsKey(toConsumeEvent.getName()))
                  {
                     log.trace("Cannot deliver event " + producedEvent +" because the consumer of the event does not accept the event name");
                     safeInvoker.eventDiscarded(eventCC, phaseContext, toConsumeEvent, EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
                     continue;
                  }
View Full Code Here

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

   {
      try
      {
         for (Portlet portlet : invoker.getPortlets())
         {
            PortletInfo portletInfo = portlet.getInfo();
            if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
            {
               PortletWindowEvent distributedEvent = new PortletWindowEvent(producedEvent.getName(), producedEvent.getPayload(), portlet.getContext().getId());
               context.queueEvent(distributedEvent);
            }
         }
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.