Package com.atlassian.confluence.themes
Class DefaultCustomLayoutManager
- java.lang.Object
-
- com.atlassian.confluence.themes.DefaultCustomLayoutManager
-
- All Implemented Interfaces:
CustomLayoutManager
public class DefaultCustomLayoutManager extends Object implements CustomLayoutManager
-
-
Constructor Summary
Constructors Constructor Description DefaultCustomLayoutManager(PersistentDecoratorDao persistentDecoratorDao, com.atlassian.event.api.EventPublisher eventPublisher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<DefaultDecorator>
getAllDefaultDecorators()
Retrieves a collection of all default decorators without customizationCollection<PersistentDecorator>
getApplicableCustomDecoratorsForSpace(String spaceKey)
Returns allcustom decorators that apply to a space, whether they are space level or global level.Collection<PersistentDecorator>
getCustomGlobalDecorators()
Returns all global custom decorators (does not retrieve space level decorators)Collection<PersistentDecorator>
getCustomSpaceDecorators(String spaceKey)
Returns all custom decorators defined for a specific space only (does not retrieve global decorators)DefaultDecorator
getDefaultDecorator(String decoratorName)
Retrieves the default decorator for a given decorator name without customizationPersistentDecorator
getPersistentDecorator(String spaceKey, String decoratorName)
Retrieves a custom decorator for the (spaceKey, name) combination.boolean
hasCustomDecorator(String spaceKey, String decoratorName)
Determines if a given space overrides a default decorator with a custom one.boolean
hasCustomGlobalDecorator(String decoratorName)
Determines if a given default decorator is overridden globallyboolean
hasCustomSpaceDecorator(String spaceKey, String decoratorName)
Determines if a given space overrides a default decorator with a custom one at the space levelvoid
remove(PersistentDecorator persistentDecorator)
Removes the given custom decorator, and flushes it from the velocity cachevoid
remove(String spaceKey, String decoratorName)
Removes the custom decorator with the given (spaceKey, name) pair, and flushes it from the velocity cachevoid
removeAllCustomGlobalDecorators()
Removes all globally defines custom decorators (does not remove space level custom decorators)void
removeAllCustomSpaceDecorators(String spaceKey)
Removes all custom decorators defined for a given space (does not remove global ones)void
saveOrUpdate(PersistentDecorator persistentDecorator)
Saves the given decorator (or updates it if it already exists), and updates the velocity cachevoid
saveOrUpdate(String spaceKey, String decoratorName, String content)
Creates a decorator for the given spaceKey with the given name, and saves it.boolean
usesCustomLayout(String spaceKey)
Determines if a space has any custom layout decorators defined.
-
-
-
Constructor Detail
-
DefaultCustomLayoutManager
public DefaultCustomLayoutManager(PersistentDecoratorDao persistentDecoratorDao, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Detail
-
saveOrUpdate
public void saveOrUpdate(PersistentDecorator persistentDecorator)
Description copied from interface:CustomLayoutManager
Saves the given decorator (or updates it if it already exists), and updates the velocity cache- Specified by:
saveOrUpdate
in interfaceCustomLayoutManager
-
saveOrUpdate
public void saveOrUpdate(String spaceKey, String decoratorName, String content)
Description copied from interface:CustomLayoutManager
Creates a decorator for the given spaceKey with the given name, and saves it. Will update an already existing decorator with the same (spaceKey, name) pair. Also updates the velocity cache- Specified by:
saveOrUpdate
in interfaceCustomLayoutManager
- Parameters:
spaceKey
- null spaceKey indicates a global decoratordecoratorName
- the filename of the decoratorcontent
- the decorator body
-
getPersistentDecorator
public PersistentDecorator getPersistentDecorator(String spaceKey, String decoratorName)
Description copied from interface:CustomLayoutManager
Retrieves a custom decorator for the (spaceKey, name) combination.- Specified by:
getPersistentDecorator
in interfaceCustomLayoutManager
- Parameters:
spaceKey
- null spaceKey indicates a global decoratordecoratorName
- the filename of the decorator- Returns:
- The decorator if it exists, null otherwise
-
getCustomSpaceDecorators
public Collection<PersistentDecorator> getCustomSpaceDecorators(String spaceKey)
Description copied from interface:CustomLayoutManager
Returns all custom decorators defined for a specific space only (does not retrieve global decorators)- Specified by:
getCustomSpaceDecorators
in interfaceCustomLayoutManager
- Parameters:
spaceKey
- null spaceKey indicates a global decorator- Returns:
- Collection of custom decorators
-
getApplicableCustomDecoratorsForSpace
public Collection<PersistentDecorator> getApplicableCustomDecoratorsForSpace(String spaceKey)
Description copied from interface:CustomLayoutManager
Returns allcustom decorators that apply to a space, whether they are space level or global level. If a particular decorator is overridden at both levels, the space level one is returned- Specified by:
getApplicableCustomDecoratorsForSpace
in interfaceCustomLayoutManager
- Returns:
- Collection of custom decorators
-
getCustomGlobalDecorators
public Collection<PersistentDecorator> getCustomGlobalDecorators()
Description copied from interface:CustomLayoutManager
Returns all global custom decorators (does not retrieve space level decorators)- Specified by:
getCustomGlobalDecorators
in interfaceCustomLayoutManager
- Returns:
- Collection of custom decorators
-
hasCustomSpaceDecorator
public boolean hasCustomSpaceDecorator(String spaceKey, String decoratorName)
Description copied from interface:CustomLayoutManager
Determines if a given space overrides a default decorator with a custom one at the space level- Specified by:
hasCustomSpaceDecorator
in interfaceCustomLayoutManager
- Parameters:
spaceKey
- null spaceKey indicates globaldecoratorName
- the filename of the decorator- Returns:
- True if the decorator is overridden at the space level, false otherwise
-
hasCustomGlobalDecorator
public boolean hasCustomGlobalDecorator(String decoratorName)
Description copied from interface:CustomLayoutManager
Determines if a given default decorator is overridden globally- Specified by:
hasCustomGlobalDecorator
in interfaceCustomLayoutManager
- Parameters:
decoratorName
- the filename of the decorator- Returns:
- True if the decorator is overridden at the global level, false otherwise
-
hasCustomDecorator
public boolean hasCustomDecorator(String spaceKey, String decoratorName)
Description copied from interface:CustomLayoutManager
Determines if a given space overrides a default decorator with a custom one.- Specified by:
hasCustomDecorator
in interfaceCustomLayoutManager
- Parameters:
spaceKey
- null spaceKey indicates a global decoratordecoratorName
- the filename of the decorator- Returns:
- True if the decorator is overridden at either the space or global level, false otherwise
-
usesCustomLayout
public boolean usesCustomLayout(String spaceKey)
Description copied from interface:CustomLayoutManager
Determines if a space has any custom layout decorators defined.- Specified by:
usesCustomLayout
in interfaceCustomLayoutManager
- Parameters:
spaceKey
- null spaceKey indicates global- Returns:
- True if any default decorator is overridden for this space or globally, false otherwise
-
remove
public void remove(String spaceKey, String decoratorName)
Description copied from interface:CustomLayoutManager
Removes the custom decorator with the given (spaceKey, name) pair, and flushes it from the velocity cache- Specified by:
remove
in interfaceCustomLayoutManager
- Parameters:
spaceKey
- null spaceKey indicates a global decoratordecoratorName
- the filename of the decorator
-
remove
public void remove(PersistentDecorator persistentDecorator)
Description copied from interface:CustomLayoutManager
Removes the given custom decorator, and flushes it from the velocity cache- Specified by:
remove
in interfaceCustomLayoutManager
- Parameters:
persistentDecorator
- the custom decorator to delete
-
removeAllCustomSpaceDecorators
public void removeAllCustomSpaceDecorators(String spaceKey)
Description copied from interface:CustomLayoutManager
Removes all custom decorators defined for a given space (does not remove global ones)- Specified by:
removeAllCustomSpaceDecorators
in interfaceCustomLayoutManager
- Parameters:
spaceKey
- null spaceKey indicates global
-
removeAllCustomGlobalDecorators
public void removeAllCustomGlobalDecorators()
Description copied from interface:CustomLayoutManager
Removes all globally defines custom decorators (does not remove space level custom decorators)- Specified by:
removeAllCustomGlobalDecorators
in interfaceCustomLayoutManager
-
getDefaultDecorator
public DefaultDecorator getDefaultDecorator(String decoratorName)
Description copied from interface:CustomLayoutManager
Retrieves the default decorator for a given decorator name without customization- Specified by:
getDefaultDecorator
in interfaceCustomLayoutManager
- Parameters:
decoratorName
- The filename of the default decorator
-
getAllDefaultDecorators
public Collection<DefaultDecorator> getAllDefaultDecorators()
Description copied from interface:CustomLayoutManager
Retrieves a collection of all default decorators without customization- Specified by:
getAllDefaultDecorators
in interfaceCustomLayoutManager
-
-