Package lumis.portal.structure
Class StructureElement
- java.lang.Object
-
- lumis.portal.structure.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 Summary
Constructors Constructor Description StructureElement()
-
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(Node propertyBagNode)
Updates this element's property bag according to the given serialized property bag node.protected String
getAutomaticFriendlyId(String value)
Generates a friendly identifier for the element based on the given value.protected String
getFriendlyIdBaseValue(String value)
Returns the base value from the given value.protected int
getFriendlyIdMaxLength()
Returns the maximum length of friendly identifier.protected String
getFriendlyIdValueForCounter(String baseValue, Integer counter)
Returns the result of base value inserting the given counter.protected String
getLocalPropertyValue(String propertyName)
Gets the property for a given property name from local properties.protected List<String>
getLocalPropertyValues(String propertyName)
Gets the property values for a given property name from local properties.protected abstract Pattern
getManagedPropertiesPattern()
Returns the property name spaces.abstract String
getPropertyBagId()
Returns the property bag identifier.protected String
getPropertyValue(String propertyName)
Returns the property value for a given property name.protected List<String>
getPropertyValues(String propertyName)
Returns the property values for a given property name.protected boolean
isManagedProperty(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(String friendlyId)
Indicates if the element may use the given friendly identifier.protected String
normalizeFriendlyId(String friendlyId)
Normalizes and return the friendly identifier for the given friendly identifier.protected void
removeProperty(String propertyName)
Removes a property for a given property name from the local property structure map.protected String
serializePropertyBag()
Serialize the property bags.protected void
setPropertyValue(String propertyName, String propertyValue)
Sets on the local property structure map a givenpropertyValue
property value for a givenpropertyName
property name.protected void
setPropertyValues(String propertyName, List<String> propertyValues)
Sets on the local property structure map a givenpropertyValues
property values for a givenpropertyName
property name.protected String
stripAccents(String value)
Removes accents from characters.
-
-
-
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 returnsfalse
.- 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 givenpropertyValue
property value for a givenpropertyName
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 givenpropertyValues
property values for a givenpropertyName
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)
-
applyPropertyBagChanges
protected void applyPropertyBagChanges() throws PortalException
Apply the changes made to the properties managed by this element to the property bag persistence entities.- 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:
propertyName isPrivate inheritedMode propertyValue 1 propertyValue 2 ......
...- 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 byserializePropertyBag()
.- 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
-
-