Class WidgetInstanceHolder


  • public class WidgetInstanceHolder
    extends 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 Detail

      • WidgetInstanceHolder

        public WidgetInstanceHolder​(String interfaceInstanceId,
                                    boolean temporary,
                                    String userId,
                                    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 String getId()
        Returns the identifier of this holder.
        Returns:
        the holder identifier.
        Since:
        10.2.0
      • getInterfaceInstanceId

        public 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 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 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 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​(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​(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​(String interfaceInstanceId,
                                                            boolean temporary,
                                                            String userId,
                                                            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