Package org.oasis.wsrp.v2

Examples of org.oasis.wsrp.v2.UploadContext


    */
   public PortletDescription getPortletDescription(PortletContext portletContext, List<String> desiredLocales, Registration registration) throws InvalidHandle, OperationFailed
   {
      ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "portlet context");

      final PortletDescription description = serviceDescription.getPortletDescription(portletContext, desiredLocales, registration);
      if (description == null)
      {
         throw WSRP2ExceptionFactory.throwWSException(InvalidHandle.class, "Couldn't find portlet '" + portletContext.getPortletHandle() + "'. Check that it's properly deployed.", null);
      }
      return description;
View Full Code Here


         // iterate over locales and create a portlet description for each
         MetaInfo metaInfo = info.getMeta();
         for (Locale localeMatch : supportedLocales)
         {
            PortletDescription desc = WSRPTypeFactory.createPortletDescription(handle, markupTypes);

            // group ID
            desc.setGroupID(info.getApplicationName());

            // description
            desc.setDescription(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.DESCRIPTION), localeMatch));

            // short title
            desc.setShortTitle(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.SHORT_TITLE), localeMatch));

            // title
            desc.setTitle(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.TITLE), localeMatch));

            // display name
            desc.setDisplayName(Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.DISPLAY_NAME), localeMatch));

            // keywords
            // metaInfo contains comma-separated keywords: we need to extract them into a list
            org.oasis.wsrp.v2.LocalizedString concatenatedKeywords = Utils.convertToWSRPLocalizedString(metaInfo.getMetaValue(MetaInfo.KEYWORDS), localeMatch);
            if (concatenatedKeywords != null)
            {
               String commaSeparatedKeywords = concatenatedKeywords.getValue();
               if (commaSeparatedKeywords != null && commaSeparatedKeywords.length() > 0)
               {
                  String lang = concatenatedKeywords.getLang();
                  String[] keywordArray = commaSeparatedKeywords.split(",");
                  for (String keyword : keywordArray)
                  {
                     // todo: fix resource name
                     desc.getKeywords().add(WSRPTypeFactory.createLocalizedString(lang, concatenatedKeywords.getResourceName(), keyword.trim()));
                  }
               }
            }

            // events
            EventingInfo eventsInfo = info.getEventing();
            if (eventsInfo != null)
            {
               // produced events are mapped to published events in wsrp
               Map<QName, ? extends EventInfo> producedEvents = eventsInfo.getProducedEvents();
               if (ParameterValidation.existsAndIsNotEmpty(producedEvents))
               {
                  List<QName> publishedEvents = desc.getPublishedEvents();
                  for (Map.Entry<QName, ? extends EventInfo> entry : producedEvents.entrySet())
                  {
                     publishedEvents.add(entry.getKey());
                     addEventInfo(entry.getValue(), localeMatch);
                  }
               }

               // consumed events -> handled events in wsrp
               Map<QName, ? extends EventInfo> consumedEvents = eventsInfo.getConsumedEvents();
               if (ParameterValidation.existsAndIsNotEmpty(consumedEvents))
               {
                  List<QName> handledEvents = desc.getHandledEvents();
                  for (Map.Entry<QName, ? extends EventInfo> entry : consumedEvents.entrySet())
                  {
                     handledEvents.add(entry.getKey());
                     addEventInfo(entry.getValue(), localeMatch);
                  }
               }
            }

            // public parameters
            NavigationInfo navigationInfo = info.getNavigation();
            if (navigationInfo != null)
            {
               Collection<? extends ParameterInfo> parameterInfos = navigationInfo.getPublicParameters();
               if (ParameterValidation.existsAndIsNotEmpty(parameterInfos))
               {
                  List<ParameterDescription> publicValueDescriptions = desc.getNavigationalPublicValueDescriptions();
                  for (ParameterInfo parameterInfo : parameterInfos)
                  {
                     String id = parameterInfo.getId();
                     ParameterDescription paramDesc = WSRPTypeFactory.createParameterDescription(id);
                     paramDesc.setDescription(Utils.convertToWSRPLocalizedString(parameterInfo.getDescription(), localeMatch));
                     paramDesc.setLabel(WSRPTypeFactory.createLocalizedString(id));
                     List<QName> names = paramDesc.getNames();
                     names.add(parameterInfo.getName());
                     Collection<QName> aliases = parameterInfo.getAliases();
                     if (ParameterValidation.existsAndIsNotEmpty(aliases))
                     {
                        names.addAll(aliases);
                     }

                     publicValueDescriptions.add(paramDesc);
                  }
               }
            }

            // security
            SecurityInfo secInfo = info.getSecurity();
            if (secInfo.containsTransportGuarantee(TransportGuarantee.INTEGRAL)
               || secInfo.containsTransportGuarantee(TransportGuarantee.CONFIDENTIAL))
            {
               desc.setOnlySecure(true);
            }

            // add the portlet description to the appropriate PortletDescriptionInfo
            descriptionInfo.addDescriptionFor(WSRPUtils.toString(localeMatch), desc);
         }
View Full Code Here

         org.gatein.pc.api.PortletContext pcContext = WSRPUtils.convertToPortalPortletContext(context);

         // does the specified registration allow access to the specified portlet?
         if (producer.getRegistrationManager().getPolicy().allowAccessTo(pcContext, registration, "getPortletDescription"))
         {
            PortletDescription description = getPortletDescription(context.getPortletHandle(), desiredLocales);

            // the producer doesn't know of the portlet so it's not a producer-offered portlet
            if (description == null)
            {
               // however, it might be a clone so check if the registration knows of a clone with that portlet context
View Full Code Here

       */
      public void removePortletDescription(org.gatein.pc.api.PortletContext pc)
      {
         String handle = WSRPUtils.convertToWSRPPortletContext(pc).getPortletHandle();

         PortletDescription description = getPortletDescription(handle, null);
         if (description != null)
         {
            // remove associated events
            for (QName event : description.getHandledEvents())
            {
               removeEvent(event);
            }
            for (QName event : description.getPublishedEvents())
            {
               removeEvent(event);
            }

            portletDescriptions.remove(handle);
View Full Code Here

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

      // RegistrationLocal.setRegistration is called further down the invocation in ServiceDescriptionHandler.getPortletDescription
      final List<String> desiredLocales = WSRPUtils.replaceByEmptyListIfNeeded(getPortletDescription.getDesiredLocales());
      PortletDescription description = producer.getPortletDescription(portletContext, desiredLocales, registration);
      return WSRPTypeFactory.createPortletDescriptionResponse(description);
   }
View Full Code Here

            WSRPConstants.getDefaultLocales(),
            modelDescription,
            resourceList,
            new Holder<List<Extension>>());

         PortletPropertyDescriptionResponse response = WSRPTypeFactory.createPortletPropertyDescriptionResponse(null);
         response.setModelDescription(modelDescription.value);
         response.setResourceList(resourceList.value);

         return response;
      }
      catch (InvalidHandle invalidHandleFault)
      {
View Full Code Here

    * @since 2.6
    */
   public static PropertyDescription convertToPropertyDescription(RegistrationPropertyDescription propertyDescription)
   {
      ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription, "RegistrationPropertyDescription");
      PropertyDescription propDesc = WSRPTypeFactory.createPropertyDescription(propertyDescription.getName().toString(),
         propertyDescription.getType());

      // todo: deal with languages properly!!
      LocalizedString hint = propertyDescription.getHint();
      if (hint != null)
      {
         propDesc.setHint(convertToWSRPLocalizedString(hint));
      }
      LocalizedString label = propertyDescription.getLabel();
      if (label != null)
      {
         propDesc.setLabel(convertToWSRPLocalizedString(label));
      }
      return propDesc;
   }
View Full Code Here

               {
                  //todo: check what we should use key
                  //todo: right now we only support String properties
                  List<String> desiredLocales = getPortletPropertyDescription.getDesiredLocales();
                  desiredLocales = WSRPUtils.replaceByEmptyListIfNeeded(desiredLocales);
                  PropertyDescription desc = WSRPTypeFactory.createPropertyDescription(prefInfo.getKey(), WSRPConstants.XSD_STRING);
                  desc.setLabel(Utils.convertToWSRPLocalizedString(prefInfo.getDisplayName(), desiredLocales));
                  desc.setHint(Utils.convertToWSRPLocalizedString(prefInfo.getDescription(), desiredLocales));
                  descs.add(desc);
               }
            }
         }
View Full Code Here

      WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(setPortletProperties, "SetPortletProperties");

      PortletContext portletContext = setPortletProperties.getPortletContext();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext, "PortletContext", "SetPortletProperties");

      PropertyList propertyList = setPortletProperties.getPropertyList();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(propertyList, "PropertyList", "SetPortletProperties");

      Registration registration = producer.getRegistrationOrFailIfInvalid(setPortletProperties.getRegistrationContext());

      checkUserAuthorization(setPortletProperties.getUserContext());

      List<Property> properties = propertyList.getProperties();
      properties = WSRPUtils.replaceByEmptyListIfNeeded(properties);
      List<ResetProperty> resetProperties = propertyList.getResetProperties();
      resetProperties = WSRPUtils.replaceByEmptyListIfNeeded(resetProperties);
      int changesCount = 0;
      if (ParameterValidation.existsAndIsNotEmpty(properties))
      {
         changesCount += properties.size();
View Full Code Here

         //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)
                  {
                     lang = WSRPUtils.toString(displayName.getDefaultLocale());
                  }
               }

               // todo: support multi-valued properties
               if (values.size() != 1)
               {
                  throw new UnsupportedOperationException("Currently doesn't support multi-valued properties!");
               }
               result.getProperties().add(WSRPTypeFactory.createProperty(key, lang, values.get(0))); //todo: check what we should use key
            }
         }

         return result;
      }
View Full Code Here

TOP

Related Classes of org.oasis.wsrp.v2.UploadContext

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.