Interface IPropertyBagManager

  • All Known Subinterfaces:
    IPropertyBagManagerSPI

    @StableMinor(version="16.1",
                 sinceVersion="5.0")
    public interface IPropertyBagManager
    Manages property bag instances. All methods require a transactional context.
    Since:
    5.0.0
    Version:
    $Revision: 26156 $ $Date: 2024-01-13 10:26:46 -0300 (Sat, 13 Jan 2024) $
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(PropertyBag bag)
      Persists a property bag.
      void delete​(PropertyBag bag)
      Deletes the given property bag.
      PropertyBag get​(java.lang.String propertyBagId)
      Returns the property bag with the given identifier.
      java.lang.String getValue​(java.lang.String propertyBagId, java.lang.String propertyName, java.lang.String defaultValue)
      Returns the value of the property with the given name for the property bag with the given identifier and, if no value was found, return the given default value.
      The calculated value will be calculated considering the inherited values.
      When changing some property bag values, the new values will only be available in this method after the transaction that changed the property bag values is commited.
      This method is preferable to PropertyBag.getValue(String, String).
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getValueMap​(java.lang.String propertyBagId)
      Returns the value map for the property bag with the given identifier.
      The resulting map will be calculated considering the inherited values and will be an unmodifiable map.
      When changing some property bag values, the new values will only be available in this method after the transaction that changed the property bag values is commited.
      This method is preferable to PropertyBag.getValueMap().
      java.util.List<java.lang.String> getValues​(java.lang.String propertyBagId, java.lang.String propertyName, java.util.List<java.lang.String> defaultValues)
      Returns the values of the property with the given name for the property bag with the given identifier and, if no value was found, return the given default values.
      The calculated value will be calculated considering the inherited values.
      When changing some property bag values, the new values will only be available in this method after the transaction that changed the property bag values is commited.
      If the values could be calculated (and, thus, the default values are not used), the returned list will be immutable.
      If the values couldn't be found, the default values will be returned and, whether it is an immutable list is not defined.

      This method is preferable to PropertyBag.getValues(String, List).
    • Method Detail

      • get

        PropertyBag get​(java.lang.String propertyBagId)
                 throws PortalException
        Returns the property bag with the given identifier.
        Parameters:
        propertyBagId - identifier of the property bag.
        Returns:
        the property bag.
        Throws:
        PortalException
        Since:
        5.0.0
      • delete

        void delete​(PropertyBag bag)
             throws PortalException
        Deletes the given property bag.

        Delete is not done recursively. There must not be any child property bags that have the given property bag as its parent.

        Parameters:
        bag - the property bag to be deleted.
        Throws:
        PortalException
        Since:
        5.0.0
      • getValue

        java.lang.String getValue​(java.lang.String propertyBagId,
                                  java.lang.String propertyName,
                                  java.lang.String defaultValue)
                           throws PortalException
        Returns the value of the property with the given name for the property bag with the given identifier and, if no value was found, return the given default value.
        The calculated value will be calculated considering the inherited values.
        When changing some property bag values, the new values will only be available in this method after the transaction that changed the property bag values is commited.
        This method is preferable to PropertyBag.getValue(String, String).
        Parameters:
        propertyBagId - the property bag identifier.
        propertyName - the property name.
        defaultValue - the default value.
        Returns:
        the calculated value or the default value if no value was found.
        Throws:
        PortalObjectNotFoundException - if no property bag with the given identifier was found.
        PortalException
        Since:
        12.0.0
      • getValues

        java.util.List<java.lang.String> getValues​(java.lang.String propertyBagId,
                                                   java.lang.String propertyName,
                                                   java.util.List<java.lang.String> defaultValues)
                                            throws PortalException
        Returns the values of the property with the given name for the property bag with the given identifier and, if no value was found, return the given default values.
        The calculated value will be calculated considering the inherited values.
        When changing some property bag values, the new values will only be available in this method after the transaction that changed the property bag values is commited.
        If the values could be calculated (and, thus, the default values are not used), the returned list will be immutable.
        If the values couldn't be found, the default values will be returned and, whether it is an immutable list is not defined.

        This method is preferable to PropertyBag.getValues(String, List).
        Parameters:
        propertyBagId - the property bag identifier.
        propertyName - the property name.
        defaultValue - the default values.
        Returns:
        the calculated values or the default values if no value was found.
        Throws:
        PortalObjectNotFoundException - if no property bag with the given identifier was found.
        PortalException
        Since:
        12.0.0
      • getValueMap

        java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getValueMap​(java.lang.String propertyBagId)
                                                                                    throws PortalException
        Returns the value map for the property bag with the given identifier.
        The resulting map will be calculated considering the inherited values and will be an unmodifiable map.
        When changing some property bag values, the new values will only be available in this method after the transaction that changed the property bag values is commited.
        This method is preferable to PropertyBag.getValueMap().
        Parameters:
        propertyBagId - the property bag identifier.
        Returns:
        the value map for the property bag with the given identifier.
        Throws:
        PortalObjectNotFoundException - if no property bag with the given identifier was found.
        PortalException
        Since:
        12.0.0