Package org.jboss.portal.portlet.state

Examples of org.jboss.portal.portlet.state.PropertyMap


         //
         dos.writeInt(MAGIC_VALUE);
         dos.write(VERSION_ID);
         dos.writeUTF(state.getPortletId());
         PropertyMap map = state.getProperties();
         dos.writeInt(map.size());
         for (Map.Entry<String, List<String>> entry : map.entrySet())
         {
            String key = entry.getKey();
            List<String> value = entry.getValue();
            String[] strings = value.toArray(new String[value.size()]);
            dos.writeUTF(key);
View Full Code Here


         {
            throw new StateConversionException("Bad version id " + versionId);
         }
         String portletId = dis.readUTF();
         int size = dis.readInt();
         PropertyMap properties = new SimplePropertyMap(size);
         while (size-- > 0)
         {
            String key = dis.readUTF();
            int length = dis.readInt();
            String[] strings = new String[length];
            for (int i = 0; i < strings.length; i++)
            {
               boolean isNull = dis.readBoolean();
               if (isNull == false)
               {
                  String string = dis.readUTF();
                  strings[i] = string;
               }
            }
            List<String> value = Arrays.asList(strings.clone());
            properties.setProperty(key, value);
         }
         return new PortletState(portletId, properties);
      }
      catch (IOException e)
      {
View Full Code Here

      {
         throw new NoSuchPortletException(portletContext.getId());
      }
      ContainerPortletInfo info = (ContainerPortletInfo)portlet.getInfo();
      ContainerPreferencesInfo prefs = (ContainerPreferencesInfo)info.getPreferences();
      PropertyMap result = new SimplePropertyMap();
      for (String key : keys)
      {
         ContainerPreferenceInfo pref = prefs.getContainerPreference(key);
         if (pref != null)
         {
            result.put(key, pref.getDefaultValue());
         }
      }
      return result;
   }
View Full Code Here

      {
         throw new NoSuchPortletException(portletContext.getId());
      }
      ContainerPortletInfo info = (ContainerPortletInfo)portlet.getInfo();
      ContainerPreferencesInfo prefs = (ContainerPreferencesInfo)info.getPreferences();
      PropertyMap result = new SimplePropertyMap();
      for (String key : prefs.getKeys())
      {
         ContainerPreferenceInfo pref = prefs.getContainerPreference(key);
         if (pref != null)
         {
            result.put(key, pref.getDefaultValue());
         }
      }
      return result;
   }
View Full Code Here

      // Producer state management if the invocation was succesful
      if (invocation instanceof ActionInvocation && status == AbstractPropertyContext.UPDATE_SUCCESSFUL)
      {
         // Get the potentially updated prefs
         PropertyMap newPrefs = prefs.getPrefs();

         //
         switch(access)
         {
            case CLONE_BEFORE_WRITE:
View Full Code Here

            return marshall(statefulContext.getPortletId(), statefulContext.getProperties());
         }
      }
      else
      {
         PropertyMap newState = new SimplePropertyMap();
         getPropertiesFromMetaData(portletContext, newState);
         if (useStore)
         {
            String cloneId = persistenceManager.createState(portletId, newState);
            return PortletContext.createPortletContext(PRODUCER_CLONE_ID_PREFIX + cloneId);
View Full Code Here

   {
      if (keys == null)
      {
         throw new IllegalArgumentException("No keys provided");
      }
      PropertyMap props = getProperties(portletContext);
      props.keySet().retainAll(keys);
      return props;
   }
View Full Code Here

      if (context.isStateful())
      {
         StatefulContext statefulContext = (StatefulContext)context;

         // Get the content
         PropertyMap props = new SimplePropertyMap(statefulContext.getProperties());

         // Dereference the portlet
         PortletContext refPortletContext = context.getPortletContext();

         // Get the referenced portlet
         Portlet refPortlet = super.getPortlet(refPortletContext);

         // We need the referenced portlet
         if (refPortlet == null)
         {
            throw new PortletInvokerException("The portlet " + refPortletContext + " referenced by this clone " + portletId + " is not available");
         }

         //
         getPropertiesFromMetaData(refPortletContext, props);

         //
         return props;
      }
      else
      {
         // Get the container
         PropertyMap props = new SimplePropertyMap();
         getPropertiesFromMetaData(context.getPortletContext(), props);
         return props;
      }
   }
View Full Code Here

      //
      PreferencesInfo prefs = referencedPortletInfo.getPreferences();

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

      // Clone argument
      for (PropertyChange change : changes)
      {
         String key = change.getKey();
         int type = change.getType();

         // If the original value exist and is read only we perform a reset instead
         PreferenceInfo pref = prefs.getPreference(key);
         if (pref != null)
         {
            if (Boolean.TRUE.equals(pref.isReadOnly()))
            {
               type = PropertyChange.PREF_RESET;
            }
         }

         //
         if (type == PropertyChange.PREF_UPDATE)
         {
            properties.setProperty(key, change.getValue());
         }
         else
         {
            properties.remove(key);
         }
      }

      //
      if (statefulContext.isLocal())
View Full Code Here

         }
      }

      // Get the missing or read only properties from the referenced portlet properties
      // and add them to the actual state
      PropertyMap refPreferencesInfo = super.getProperties(portletContext, keys);
      for (Map.Entry<String, List<String>> entry : refPreferencesInfo.entrySet())
      {
         String key = entry.getKey();
         List<String> value = entry.getValue();
         props.setProperty(key, new ArrayList<String>(value));
      }
View Full Code Here

TOP

Related Classes of org.jboss.portal.portlet.state.PropertyMap

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.