Interface IPropertyBagManager

  • All Known Subinterfaces:
    IPropertyBagManagerSPI

    @StableMinor(version="14.0",
                 sinceVersion="5.0")
    public interface IPropertyBagManager
    Manages property bag instances. All methods require a transactional context.
    Since:
    5.0.0
    Version:
    $Revision: 24477 $ $Date: 2021-04-28 11:30:36 -0300 (Wed, 28 Apr 2021) $
    • 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​(String propertyBagId)
      Returns the property bag with the given identifier.
      String getValue​(String propertyBagId, String propertyName, 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).
      Map<String,​List<String>> getValueMap​(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().
      List<String> getValues​(String propertyBagId, String propertyName, List<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​(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

        String getValue​(String propertyBagId,
                        String propertyName,
                        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

        List<String> getValues​(String propertyBagId,
                               String propertyName,
                               List<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

        Map<String,​List<String>> getValueMap​(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