Class WidgetInstanceHolder


  • public class WidgetInstanceHolder
    extends java.lang.Object
    A holder for widget instances .
    Since:
    10.2.0
    Version:
    $Revision: 21230 $ $Date: 2018-04-24 19:07:57 -0300 (Tue, 24 Apr 2018) $
    • Constructor Summary

      Constructors 
      Constructor Description
      WidgetInstanceHolder​(java.lang.String interfaceInstanceId, boolean temporary, java.lang.String userId, java.lang.String contentId)
      Creates a new widget instance holder.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      WidgetInstance addWidgetInstance​(java.lang.String widgetContentId)
      Appends a new widget instance in this holder.
      WidgetInstance addWidgetInstance​(java.lang.String widgetContentId, int position)
      Adds a new widget instance in this holder in the specified position.
      static WidgetInstanceHolder findByProperties​(java.lang.String interfaceInstanceId, boolean temporary, java.lang.String userId, java.lang.String contentId)
      Returns the widget instance holder for the specified properties.
      java.lang.String getContentId()
      Returns the identifier of the content this holder is personalized for.
      java.lang.String getId()
      Returns the identifier of this holder.
      java.lang.String getInterfaceInstanceId()
      Returns the identifier of the service interface instance this holder belongs to.
      java.lang.String getUserId()
      Returns the identifier of the user this holder is personalized for.
      java.util.List<HolderWidgetInstance> getWidgetInstances()
      Returns the persistent list with the widget instances in this holder.
      boolean isTemporary()
      Returns whether this holder is temporary.
      void remove()  
      void setTemporary​(boolean temporary)
      Sets whether this holder is temporary.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WidgetInstanceHolder

        public WidgetInstanceHolder​(java.lang.String interfaceInstanceId,
                                    boolean temporary,
                                    java.lang.String userId,
                                    java.lang.String contentId)
        Creates a new widget instance holder.
        Parameters:
        interfaceInstanceId - the holder interface instance identifier.
        temporary - if this holder is temporary.
        userId - the related user identifier if this holder is personalized for him, null otherwise.
        contentId - the related content identifier this holder is related for, null otherwise.
        Since:
        10.2.0
    • Method Detail

      • getId

        public java.lang.String getId()
        Returns the identifier of this holder.
        Returns:
        the holder identifier.
        Since:
        10.2.0
      • getInterfaceInstanceId

        public java.lang.String getInterfaceInstanceId()
        Returns the identifier of the service interface instance this holder belongs to.
        Returns:
        the service interface instance identifier.
        Since:
        10.2.0
      • isTemporary

        public boolean isTemporary()
        Returns whether this holder is temporary.
        Returns:
        true if it is temporary, false otherwise.
        Since:
        10.2.0
      • setTemporary

        public void setTemporary​(boolean temporary)
        Sets whether this holder is temporary.
        Parameters:
        temporary - true if it is temporary, false otherwise.
        Since:
        10.2.0
      • getUserId

        public java.lang.String getUserId()
        Returns the identifier of the user this holder is personalized for.
        Returns:
        the user identifier, or null if it is not personalized for a user.
        Since:
        10.2.0
      • getContentId

        public java.lang.String getContentId()
        Returns the identifier of the content this holder is personalized for.
        Returns:
        the content identifier, or null if it is not personalized for a content.
        Since:
        10.2.0
      • getWidgetInstances

        public java.util.List<HolderWidgetInstance> getWidgetInstances()
        Returns the persistent list with the widget instances in this holder.

        Caution must be taken when modifying this list to prevent inconsistency. When add/move/remove methods in WidgetInstanceHolder instead.

        Returns:
        the persistent list with the widget instances in this holder.
        Since:
        10.2.0
      • addWidgetInstance

        public WidgetInstance addWidgetInstance​(java.lang.String widgetContentId)
        Appends a new widget instance in this holder.
        Parameters:
        widgetContentId - the widget content identifier use to create the widget instance.
        Returns:
        the new persistent widget instance.
        Since:
        10.2.0
      • addWidgetInstance

        public WidgetInstance addWidgetInstance​(java.lang.String widgetContentId,
                                                int position)
        Adds a new widget instance in this holder in the specified position.
        Parameters:
        widgetContentId - the widget content identifier use to create the widget instance.
        position - the position, zero-based.
        Returns:
        the new persistent widget instance.
        Since:
        10.2.0
      • findByProperties

        public static WidgetInstanceHolder findByProperties​(java.lang.String interfaceInstanceId,
                                                            boolean temporary,
                                                            java.lang.String userId,
                                                            java.lang.String contentId)
        Returns the widget instance holder for the specified properties.
        Parameters:
        interfaceInstanceId - the value for getInterfaceInstanceId().
        temporary - the value for isTemporary().
        userId - the value for getUserId().
        contentId - the value for contentId.
        Returns:
        the widget instance holder, or null if not found.
        Since:
        10.2.0