Class ResourceRefactorProcessor


  • public final class ResourceRefactorProcessor
    extends Object
    Helper methods for refactoring content in resource files.
    Since:
    7.0.0
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • ResourceRefactorProcessor

        public ResourceRefactorProcessor()
    • Method Detail

      • createWebResourceFormElementNameRefactorer

        public static ITextResourceRefactorer createWebResourceFormElementNameRefactorer​(String oldName,
                                                                                         String newName,
                                                                                         String... extensions)
        Creates a refactorer that replaces the references to the given form element in JavaScript files.
        Parameters:
        oldName - Old name of the form element to look for.
        newName - New name of the form element.
        extensions - Extensions in which to replace content. May be .js and .css.
        Returns:
        A refactorer that replaces the references to the given form element in CSS and JavaScript files.
      • createWebResourceFormElementNameRefactorer

        public static ITextResourceRefactorer createWebResourceFormElementNameRefactorer​(String oldName,
                                                                                         String newName,
                                                                                         Set<String> extensions)
        Creates a refactorer that replaces the references to the given form element in JavaScript files.
        Parameters:
        oldName - Old name of the form element to look for.
        newName - New name of the form element.
        extensions - Extensions in which to replace content. May be .js and .css.
        Returns:
        A refactorer that replaces the references to the given form element in CSS and JavaScript files.
      • refactorProjectResources

        public static void refactorProjectResources​(IEntityContext ec,
                                                    Projekt project,
                                                    ITextResourceRefactorer refactorer)
        Applies the given refactorer to all project resources of the given project. Reads the resources form the database, replaces their content, and writes them back to the database.
        Parameters:
        ec - Entity content for accessing the database.
        project - Project with resources to process.
        refactorer - Refactorer to apply.
      • refactorProjectResources

        public static void refactorProjectResources​(IEntityContext ec,
                                                    long projectId,
                                                    ITextResourceRefactorer refactorer)
        Applies the given refactorer to all project resources of the given project. The data is not saved to the database.
        Parameters:
        ec - Entity content for accessing the database.
        projectId - ID of the project with resources to process.
        refactorer - Refactorer to apply.
      • refactorProjectResource

        public static boolean refactorProjectResource​(IEntityContext ec,
                                                      ProjektRessource resource,
                                                      ITextResourceRefactorer refactorer)
        Applies the given refactorer to the given resource. Replaces the content and writes the resource back to the database.
        Parameters:
        ec - Entity content for accessing the database.
        resource - Resource with content to replace.
        refactorer - Refactorer to apply.
        Returns:
        Whether the resource was changed.