Class StructureElement

  • Direct Known Subclasses:
    ChannelConfig, PageConfig, ServiceInstanceConfig

    public abstract class StructureElement
    extends java.lang.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) $
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void applyPropertyBagChanges()
      Apply the changes made to the properties managed by this element to the property bag persistence entities.
      protected void deserializePropertyBag​(org.w3c.dom.Node propertyBagNode)
      Updates this element's property bag according to the given serialized property bag node.
      protected java.lang.String getAutomaticFriendlyId​(java.lang.String value)
      Generates a friendly identifier for the element based on the given value.
      protected java.lang.String getFriendlyIdBaseValue​(java.lang.String value)
      Returns the base value from the given value.
      protected int getFriendlyIdMaxLength()
      Returns the maximum length of friendly identifier.
      protected java.lang.String getFriendlyIdValueForCounter​(java.lang.String baseValue, java.lang.Integer counter)
      Returns the result of base value inserting the given counter.
      protected java.lang.String getLocalPropertyValue​(java.lang.String propertyName)
      Gets the property for a given property name from local properties.
      protected java.util.List<java.lang.String> getLocalPropertyValues​(java.lang.String propertyName)
      Gets the property values for a given property name from local properties.
      protected abstract java.util.regex.Pattern getManagedPropertiesPattern()
      Returns the property name spaces.
      abstract java.lang.String getPropertyBagId()
      Returns the property bag identifier.
      protected java.lang.String getPropertyValue​(java.lang.String propertyName)
      Returns the property value for a given property name.
      protected java.util.List<java.lang.String> getPropertyValues​(java.lang.String propertyName)
      Returns the property values for a given property name.
      protected boolean isManagedProperty​(java.lang.String propertyName)
      Returns whether a property can be edited in this element.
      protected void loadPropertyBagValues()
      Loads the values of the property bag of this element.
      protected abstract boolean mayUseFriendlyId​(java.lang.String friendlyId)
      Indicates if the element may use the given friendly identifier.
      protected java.lang.String normalizeFriendlyId​(java.lang.String friendlyId)
      Normalizes and return the friendly identifier for the given friendly identifier.
      protected void removeProperty​(java.lang.String propertyName)
      Removes a property for a given property name from the local property structure map.
      protected java.lang.String serializePropertyBag()
      Serialize the property bags.
      protected void setPropertyValue​(java.lang.String propertyName, java.lang.String propertyValue)
      Sets on the local property structure map a given propertyValue property value for a given propertyName property name.
      protected void setPropertyValues​(java.lang.String propertyName, java.util.List<java.lang.String> propertyValues)
      Sets on the local property structure map a given propertyValues property values for a given propertyName property name.
      protected java.lang.String stripAccents​(java.lang.String value)
      Removes accents from characters.
      • Methods inherited from class java.lang.Object

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

      • StructureElement

        public StructureElement()
    • Method Detail

      • getPropertyBagId

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

        protected abstract java.util.regex.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​(java.lang.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 java.lang.String getPropertyValue​(java.lang.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 java.util.List<java.lang.String> getPropertyValues​(java.lang.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 java.lang.String getLocalPropertyValue​(java.lang.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 java.util.List<java.lang.String> getLocalPropertyValues​(java.lang.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​(java.lang.String propertyName,
                                        java.lang.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​(java.lang.String propertyName,
                                         java.util.List<java.lang.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​(java.lang.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 java.lang.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​(org.w3c.dom.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 java.lang.String getAutomaticFriendlyId​(java.lang.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​(java.lang.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 java.lang.String getFriendlyIdBaseValue​(java.lang.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 java.lang.String stripAccents​(java.lang.String value)
        Removes accents from characters.
        Parameters:
        value - the original value.
        Returns:
        the processed value.
        Since:
        6.0.0
      • getFriendlyIdValueForCounter

        protected java.lang.String getFriendlyIdValueForCounter​(java.lang.String baseValue,
                                                                java.lang.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 java.lang.String normalizeFriendlyId​(java.lang.String friendlyId)
        Normalizes and return the friendly identifier for the given friendly identifier.
        Parameters:
        friendlyId - the friendly identifier.
        Returns:
        the normalized friendly identifier
        Throws:
        java.lang.IllegalArgumentException - if friendly identifier is a reserved name.
        Since:
        11.0.0