Class DefaultCustomLayoutManager

    • Constructor Detail

      • DefaultCustomLayoutManager

        public DefaultCustomLayoutManager​(PersistentDecoratorDao persistentDecoratorDao,
                                          com.atlassian.event.api.EventPublisher eventPublisher)
    • Method Detail

      • 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 interface CustomLayoutManager
        Parameters:
        spaceKey - null spaceKey indicates a global decorator
        decoratorName - the filename of the decorator
        content - 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 interface CustomLayoutManager
        Parameters:
        spaceKey - null spaceKey indicates a global decorator
        decoratorName - the filename of the decorator
        Returns:
        The decorator if it exists, null otherwise
      • 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 interface CustomLayoutManager
        Parameters:
        spaceKey - null spaceKey indicates global
        decoratorName - 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 interface CustomLayoutManager
        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 interface CustomLayoutManager
        Parameters:
        spaceKey - null spaceKey indicates a global decorator
        decoratorName - 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 interface CustomLayoutManager
        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 interface CustomLayoutManager
        Parameters:
        spaceKey - null spaceKey indicates a global decorator
        decoratorName - 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 interface CustomLayoutManager
        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 interface CustomLayoutManager
        Parameters:
        spaceKey - null spaceKey indicates global