Class ConverterUtil


  • public final class ConverterUtil
    extends Object
    Author:
    Pavel.Sher Date: 18.10.2007
    • Constructor Detail

      • ConverterUtil

        public ConverterUtil()
    • Method Detail

      • createTableIfNotExists

        public static void createTableIfNotExists​(DBFunctions dbf,
                                                  TableDef tableDefinition)
        Creates the given table if such table doesn't exists.

        This method checks a table with the same name to exist, anmd if no - creates a table by the given definition. If a table with such name already exists, it does nothing. It doesn't compare the existent table with the given definition.

        Parameters:
        dbf - database session.
        tableDefinition - table to create.
      • createSchema

        public static void createSchema​(DBFunctions dbf,
                                        SchemaDef schemaDefinition)
        Creates all tables and additional necessary objects of the given schema.

        This method doesn't check for tables and constraints existence.

        Parameters:
        dbf - database session.
        schemaDefinition - schema to create.
      • dropTables

        public static void dropTables​(@NotNull
                                      DBFunctions dbf,
                                      String... tableNames)
        Drops tables with the specified names, if they exist.
        Parameters:
        dbf - database session.
        tableName - names of tables to drop.
      • dropTable

        public static void dropTable​(@NotNull
                                     DBFunctions dbf,
                                     @NotNull
                                     String tableName)
        Drops a table with the specified name, if it exists.
        Parameters:
        dbf - database session.
        tableName - name of the table to drop.
      • findMaxFeatureId

        protected static long findMaxFeatureId​(File configDir)
      • replaceInFile

        public static void replaceInFile​(@NotNull
                                         String replace,
                                         @NotNull
                                         String replacement,
                                         @NotNull
                                         File file,
                                         @NotNull
                                         String encoding)
                                  throws IOException
        Replaces strings in the provided file, writes new file content instead of old.
        Parameters:
        replace - string to replace
        replacement - replacement string
        file - file where to replace
        Throws:
        IOException
      • getChildren

        @NotNull
        public static List<org.jdom.Element> getChildren​(@NotNull
                                                         org.jdom.Element element,
                                                         @NotNull
                                                         String name)
      • getBuildTemplateIntExtIdMap

        @NotNull
        public static Map<String,​String> getBuildTemplateIntExtIdMap​(@NotNull
                                                                           DBFunctions dbf)
      • findProjectDirs

        public static File[] findProjectDirs​(File projectsDir)
      • findBuildTypeAndTemplateConfigs

        @NotNull
        public static List<File> findBuildTypeAndTemplateConfigs​(@NotNull
                                                                 File configDir)
      • findMetaRunners

        @NotNull
        public static List<File> findMetaRunners​(@NotNull
                                                 File configDir)
      • findConfigs

        @NotNull
        public static List<File> findConfigs​(@NotNull
                                             File configDir,
                                             @NotNull
                                             String configsDirName)
      • findProjectConfigs

        @NotNull
        public static File[] findProjectConfigs​(@NotNull
                                                File teamCityDataDir)
        Finds all project-config.xml files under the data directory.
        Parameters:
        teamCityDataDir -
        Returns:
      • findProjectConfigsInProjectsDir

        @NotNull
        public static File[] findProjectConfigsInProjectsDir​(@NotNull
                                                             File projectsDir)
      • getProjectsDir

        @NotNull
        public static File getProjectsDir​(@NotNull
                                          File teamCityDataDir)
      • getConfigDir

        public static File getConfigDir​(File teamCityDataDir)
      • generateExternalIdByName

        @NotNull
        public static String generateExternalIdByName​(@NotNull
                                                      String name,
                                                      @NotNull
                                                      String defaultPrefix,
                                                      boolean requireFirstLetter,
                                                      int limiLength)
      • info

        public static void info​(@NotNull
                                String message)
      • warn

        public static void warn​(@NotNull
                                String message)
      • error

        public static void error​(@NotNull
                                 String message)
      • error

        public static void error​(@NotNull
                                 String message,
                                 Exception e)
      • isDebugEnabled

        public static boolean isDebugEnabled()
      • createParamNode

        public static org.jdom.Element createParamNode​(@NotNull
                                                       String name,
                                                       @NotNull
                                                       String value)