Class StructureElement

  • Direct Known Subclasses:
    ChannelConfig, PageConfig, ServiceInstanceConfig

    public abstract class StructureElement
    extends Object
    The base class for portal structure elements.
    Since:
    5.6.0
    Version:
    $Revision: 24343 $ $Date: 2021-02-03 16:37:03 -0300 (Wed, 03 Feb 2021) $
    • Constructor Detail

      • StructureElement

        public StructureElement()
    • Method Detail

      • getPropertyBagId

        public abstract String getPropertyBagId()
        Returns the property bag identifier.
        Returns:
        The propertyBagId.
        Since:
        5.6.0
      • getManagedPropertiesPattern

        protected abstract Pattern getManagedPropertiesPattern()
        Returns the property name spaces. Used to decides if a property can be updated.
        Returns:
        property name spaces
        Since:
        5.6.0
      • isManagedProperty

        protected boolean isManagedProperty​(String propertyName)
        Returns whether a property can be edited in this element.

        This implementation is based on the getManagedPropertiesPattern().

        Parameters:
        propertyName - the property name.
        Returns:
        true if a property can be edited in this element, else returns false.
        Since:
        5.6.0
      • getPropertyValue

        protected String getPropertyValue​(String propertyName)
        Returns the property value for a given property name. The property value could be local or inherited.
        Parameters:
        propertyName - the property name.
        Returns:
        the property value.
        Since:
        5.6.0
      • getPropertyValues

        protected List<String> getPropertyValues​(String propertyName)
        Returns the property values for a given property name. The property values could be local or inherited.
        Parameters:
        propertyName - the property name.
        Returns:
        the property values.
        Since:
        8.1.0
      • getLocalPropertyValue

        protected String getLocalPropertyValue​(String propertyName)
        Gets the property for a given property name from local properties.
        Parameters:
        propertyName - the property name.
        Returns:
        the property value.
        Since:
        5.6.0
      • getLocalPropertyValues

        protected List<String> getLocalPropertyValues​(String propertyName)
        Gets the property values for a given property name from local properties.
        Parameters:
        propertyName - the property name.
        Returns:
        the property values.
        Since:
        8.1.0
      • setPropertyValue

        protected void setPropertyValue​(String propertyName,
                                        String propertyValue)
        Sets on the local property structure map a given propertyValue property value for a given propertyName property name.
        Parameters:
        propertyName - the property name.
        propertyValue - the property value.
        Since:
        5.6.0
      • setPropertyValues

        protected void setPropertyValues​(String propertyName,
                                         List<String> propertyValues)
        Sets on the local property structure map a given propertyValues property values for a given propertyName property name.
        Parameters:
        propertyName - the property name.
        propertyValues - the property values.
        Since:
        8.1.0
      • removeProperty

        protected void removeProperty​(String propertyName)
        Removes a property for a given property name from the local property structure map.
        Parameters:
        propertyName - the name of the property to be removed.
        Since:
        5.6.0
      • loadPropertyBagValues

        protected void loadPropertyBagValues()
                                      throws PortalException
        Loads the values of the property bag of this element.

        Only the properties that can be changed are actually loaded.

        Throws:
        PortalException
        Since:
        5.6.0
        See Also:
        isManagedProperty(String)
      • serializePropertyBag

        protected String serializePropertyBag()
                                       throws PortalException
        Serialize the property bags.

        Returns the serialized property bags in the following format:

        <propertyBag> <p> <n>propertyName</n> <pvt>isPrivate</pvt> <im>inheritedMode</im> <vs> <v>propertyValue 1</v> <v>propertyValue 2</v> ... </vs> </p> <p> ... </p> ... </propertyBag>
        Returns:
        Serialized property bags.
        Throws:
        PortalException
        Since:
        5.6.0
      • deserializePropertyBag

        protected void deserializePropertyBag​(Node propertyBagNode)
                                       throws PortalException
        Updates this element's property bag according to the given serialized property bag node.
        Parameters:
        propertyBagNode - the property bag serialized node, in the same syntax as generated by serializePropertyBag().
        Throws:
        PortalException - if an error occurred during deserialization.
        Since:
        7.0.0
      • getAutomaticFriendlyId

        protected String getAutomaticFriendlyId​(String value)
                                         throws PortalException
        Generates a friendly identifier for the element based on the given value.
        Parameters:
        value - the value to use to generate friendly identifier.
        Returns:
        the generated friendly identifier.
        Throws:
        PortalException
        Since:
        6.0.0
      • mayUseFriendlyId

        protected abstract boolean mayUseFriendlyId​(String friendlyId)
                                             throws PortalException
        Indicates if the element may use the given friendly identifier.
        Parameters:
        friendlyId - the friendly identifier.
        Returns:
        true if the element may use the given friendly identifier, false otherwise.
        Throws:
        PortalException
        Since:
        6.0.0
      • getFriendlyIdBaseValue

        protected String getFriendlyIdBaseValue​(String value)
                                         throws PortalException
        Returns the base value from the given value. The base value should replace the forbidden characters, truncate the value to the maximum length allowed and do any other necessary processing.
        Parameters:
        value - the original value.
        Returns:
        the processed base value.
        Throws:
        PortalException
        Since:
        6.0.0
      • stripAccents

        protected String stripAccents​(String value)
        Removes accents from characters.
        Parameters:
        value - the original value.
        Returns:
        the processed value.
        Since:
        6.0.0
      • getFriendlyIdValueForCounter

        protected String getFriendlyIdValueForCounter​(String baseValue,
                                                      Integer counter)
                                               throws PortalException
        Returns the result of base value inserting the given counter.

        If the counter is null then no counter should be used.

        Parameters:
        baseValue - the base value.
        counter - the counter.
        Returns:
        the base value with the given counter inserted.
        Throws:
        PortalException
        Since:
        6.0.0
      • getFriendlyIdMaxLength

        protected int getFriendlyIdMaxLength()
        Returns the maximum length of friendly identifier.
        Returns:
        the maximum length of friendly identifier.
        Since:
        6.0.0
      • normalizeFriendlyId

        protected String normalizeFriendlyId​(String friendlyId)
        Normalizes and return the friendly identifier for the given friendly identifier.
        Parameters:
        friendlyId - the friendly identifier.
        Returns:
        the normalized friendly identifier
        Throws:
        IllegalArgumentException - if friendly identifier is a reserved name.
        Since:
        11.0.0