Class NameUtils

java.lang.Object
org.forgerock.doc.maven.utils.NameUtils

public final class NameUtils extends Object
Utility methods to work with documents.
  • Field Details

  • Method Details

    • renameDoc

      public static String renameDoc(String projectName, String docName, String extension)
      Rename document to reflect project and document name. For example, index.pdf could be renamed OpenAM-Admin-Guide.pdf.
      Parameters:
      projectName - Short name of the project, such as OpenAM, OpenDJ, OpenIDM
      docName - Short name for the document, such as admin-guide, release-notes, reference
      extension - File name extension not including dot, e.g. pdf
      Returns:
      New name for document. Can be "" if rename failed.
    • renameDoc

      public static String renameDoc(String projectName, String docName, String version, String extension)
      Rename document to reflect project and document name. For example, index.pdf could be renamed OpenAM-10.0.0-Admin-Guide.pdf.
      Parameters:
      projectName - Short name of the project, such as OpenAM, OpenDJ, OpenIDM
      docName - Short name for the document, such as admin-guide, release-notes, reference
      version - Document version such as 10.0.0, 2.5.0, 2.0.2
      extension - File name extension not including dot, e.g. pdf
      Returns:
      New name for document. Can be "" if rename failed.
    • capitalize

      protected static String capitalize(String docName)
      Capitalize initial letters in a document name.
      Parameters:
      docName - Name of the document such as reference or admin-guide
      Returns:
      Capitalized name such as Reference or Admin-Guide
    • spacesToHyphens

      protected static String spacesToHyphens(String string)
      Replace spaces with hyphens.
      Parameters:
      string - String in which to replace spaces with hyphens
      Returns:
      String with spaces replaced by hyphens.
    • getDocumentNames

      public static Set<String> getDocumentNames(File srcDir, String docFile)
      Returns names of directories that mirror the document names and contain DocBook XML documents to build.
      Parameters:
      srcDir - Directory containing DocBook XML sources. Document directories like admin-guide or reference are one level below this directory.
      docFile - Name of a file common to all documents to build, such as index.xml.
      Returns:
      Document names, as in admin-guide or reference
    • renameDocument

      public static void renameDocument(File builtDocument, String docName, String projectName) throws IOException
      Rename a single built document. For example, rename index.pdf to OpenAM-Admin-Guide.pdf.
      Parameters:
      builtDocument - File to rename, such as index.pdf.
      docName - Simple document name such as admin-guide.
      projectName - Project name, such as OpenAM.
      Throws:
      IOException - Something went wrong renaming the file.