Package org.oasis.wsrp.v2

Examples of org.oasis.wsrp.v2.NamedString


                  UploadContext uploadContext = WSRPTypeFactory.createUploadContext(contentType, baos.toByteArray());

                  List<NamedString> mimeAttributes = new ArrayList<NamedString>(2);

                  NamedString mimeAttribute = new NamedString();
                  mimeAttribute.setName(FileUpload.CONTENT_DISPOSITION);
                  mimeAttribute.setValue(FileUpload.FORM_DATA + ";"
                     + " name=\"" + item.getFieldName() + "\";"
                     + " filename=\"" + item.getName() + "\"");
                  mimeAttributes.add(mimeAttribute);

                  mimeAttribute = new NamedString();
                  mimeAttribute.setName(FileUpload.CONTENT_TYPE);
                  mimeAttribute.setValue(item.getContentType());
                  mimeAttributes.add(mimeAttribute);

                  uploadContext.getMimeAttributes().addAll(mimeAttributes);

                  uploadContexts.add(uploadContext);
               }
               else
               {
                  NamedString formParameter = new NamedString();
                  formParameter.setName(item.getFieldName());
                  formParameter.setValue(Streams.asString(stream));
                  formParameters.add(formParameter);
               }
            }
            interactionParams.getUploadContexts().addAll(uploadContexts);
            interactionParams.getFormParameters().addAll(formParameters);
         }
         else
         {
            // if the content is not multipart, then check for form parameters
            Map<String, String[]> params = actionInvocation.getForm();
            if (params != null && !params.isEmpty())
            {
               int capacity = params.size();
               List<NamedString> formParameters = new ArrayList<NamedString>(capacity);
               for (Map.Entry param : params.entrySet())
               {
                  String name = (String)param.getKey();
                  String[] values = (String[])param.getValue();
                  NamedString formParameter = new NamedString();
                  for (String value : values)
                  {
                     formParameter.setName(name);
                     formParameter.setValue(value);
                     formParameters.add(formParameter);
                  }
               }
               interactionParams.getFormParameters().addAll(formParameters);
            }
View Full Code Here


               RegistrationLocal.setRegistration(toRegistration);
               org.gatein.pc.api.PortletContext copiedPortletContext = producer.getPortletInvoker().importPortlet(PortletStateType.OPAQUE, exportedPortletContext);

               PortletContext wsrpClonedPC = WSRPUtils.convertToWSRPPortletContext(copiedPortletContext);

               CopiedPortlet copiedPortlet = WSRPTypeFactory.createCopiedPortlet(wsrpClonedPC, portletContext.getPortletHandle());
               copiedPortlets.add(copiedPortlet);
            }
            catch (Exception e)
            {
               if (log.isWarnEnabled())
View Full Code Here

      {
         throw new NotYetImplemented("Need to support multiple events at once...");
      }

      // since we currently don't support sending multiple events to process at once, assume there's only one
      Event event = events.get(0);

      eventInvocation.setName(event.getName());
      eventInvocation.setPayload(PayloadUtils.getPayloadAsSerializable(event));

      // Extensions
      processExtensionsFrom(eventParams.getClass(), eventParams.getExtensions());
View Full Code Here

      }

      // events
      QName name = invocation.getName();
      Serializable payload = invocation.getPayload();
      Event event = WSRPTypeFactory.createEvent(name, payload);
      EventParams eventParams = WSRPTypeFactory.createEventParams(Collections.singletonList(event), WSRPUtils.getStateChangeFromAccessMode(accessMode));

      return WSRPTypeFactory.createHandleEvents(requestPrecursor.getRegistrationContext(), portletContext,
         requestPrecursor.getRuntimeContext(), requestPrecursor.getUserContext(), requestPrecursor.getMarkupParams(), eventParams);
   }
View Full Code Here

      private void addEventInfo(EventInfo info, Locale locale)
      {
         QName name = info.getName();
         if (!eventDescriptions.containsKey(name))
         {
            EventDescription desc = WSRPTypeFactory.createEventDescription(name);
            desc.setDescription(Utils.convertToWSRPLocalizedString(info.getDescription(), locale));
            desc.setLabel(Utils.convertToWSRPLocalizedString(info.getDisplayName(), locale));
            Collection<QName> aliases = info.getAliases();
            if (ParameterValidation.existsAndIsNotEmpty(aliases))
            {
               desc.getAliases().addAll(aliases);
            }
            // todo: deal with type info...
            eventDescriptions.put(name, desc);
            eventReferenceCount.put(name, 1);
         }
View Full Code Here

   }

   @Override
   protected void checkRequest(HandleEvents handleEvents) throws MissingParameters, OperationFailed, OperationNotSupported
   {
      EventParams eventParams = handleEvents.getEventParams();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(eventParams, "event params", "HandleEvents");
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(eventParams.getPortletStateChange(), "portletStateChange", "EventParams");
      List<Event> events = eventParams.getEvents();
      if (!ParameterValidation.existsAndIsNotEmpty(events))
      {
         throw WSRP2ExceptionFactory.createWSException(MissingParameters.class,
            "EventParams must provide at least one event to process", null);
      }
View Full Code Here

   @Override
   PortletInvocation initInvocation(WSRPPortletInvocationContext context)
   {
      EventInvocation eventInvocation = new EventInvocation(context);

      final EventParams eventParams = request.getEventParams();
      List<Event> events = eventParams.getEvents();

      if (events.size() > 1)
      {
         throw new NotYetImplemented("Need to support multiple events at once...");
      }

      // since we currently don't support sending multiple events to process at once, assume there's only one
      Event event = events.get(0);

      eventInvocation.setName(event.getName());
      eventInvocation.setPayload(PayloadUtils.getPayloadAsSerializable(event));

      // Extensions
      processExtensionsFrom(eventParams.getClass(), eventParams.getExtensions());

      return eventInvocation;
   }
View Full Code Here

      // events
      QName name = invocation.getName();
      Serializable payload = invocation.getPayload();
      Event event = WSRPTypeFactory.createEvent(name, payload);
      EventParams eventParams = WSRPTypeFactory.createEventParams(Collections.singletonList(event), WSRPUtils.getStateChangeFromAccessMode(accessMode));

      return WSRPTypeFactory.createHandleEvents(requestPrecursor.getRegistrationContext(), portletContext,
         requestPrecursor.getRuntimeContext(), requestPrecursor.getUserContext(), requestPrecursor.getMarkupParams(), eventParams);
   }
View Full Code Here

               //get the exportPortletData
               ExportPortletData exportPortletData = exportManager.createExportPortletData(exportContext, portletHandle, portletState);

               //Create the exportedPortlet
               byte[] exportPortletBytes = exportManager.encodeExportPortletData(exportContext, exportPortletData);
               ExportedPortlet exportedPortlet = WSRPTypeFactory.createExportedPortlet(portletHandle, exportPortletBytes);
               exportedPortlets.add(exportedPortlet);
            }

            catch (Exception e)
            {
View Full Code Here

               if (!failedPortletsMap.containsKey(errorCode.name()))
               {
                  List<String> portletHandles = new ArrayList<String>();
                  portletHandles.add(portletContext.getPortletHandle());

                  FailedPortlets failedPortlets = WSRPTypeFactory.createFailedPortlets(portletHandles, errorCode, reason);
                  failedPortletsMap.put(errorCode.name(), failedPortlets);
               }
               else
               {
                  FailedPortlets failedPortlets = failedPortletsMap.get(errorCode.name());
                  failedPortlets.getPortletHandles().add(portletContext.getPortletHandle());
               }
            }
         }

         List<FailedPortlets> failedPortlets = new ArrayList<FailedPortlets>(failedPortletsMap.values());
View Full Code Here

TOP

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

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.