Class AdrToolsDecisionImporter

  • All Implemented Interfaces:
    DocumentationImporter

    public class AdrToolsDecisionImporter
    extends java.lang.Object
    implements DocumentationImporter
    Imports architecture decision records created/managed by adr-tools (https://github.com/npryce/adr-tools). The format for ADRs is as follows: Filename: {DECISION_ID:0000}-*.md Content: # {DECISION_ID}. {DECISION_TITLE} Date: {DECISION_DATE:YYYY-MM-DD} ## Status {DECISION_STATUS and links} ## Context ...
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String calculateUrl​(com.structurizr.documentation.Decision decision)  
      protected java.util.Date extractDate​(java.lang.String[] lines)  
      protected java.lang.String extractIntegerIDFromFileName​(java.io.File file)  
      protected void extractLinks​(com.structurizr.documentation.Decision decision, java.util.Map<java.lang.String,​com.structurizr.documentation.Decision> decisionsByFilename)  
      protected java.lang.String extractStatus​(java.lang.String[] lines)  
      protected java.lang.String extractTitle​(java.lang.String[] lines)  
      protected com.structurizr.documentation.Decision importDecision​(java.io.File file)  
      void importDocumentation​(com.structurizr.documentation.Documentable documentable, java.io.File path)
      Imports Markdown files from the specified path, one per decision.
      void setDateFormat​(java.lang.String dateFormat)
      Sets the date format to use when parsing dates (the default is "yyyy-MM-dd").
      void setTimeZone​(java.lang.String timeZone)
      Sets the time zone to use when parsing dates (the default is UTC)
      void setTimeZone​(java.util.TimeZone timeZone)
      Sets the time zone to use when parsing dates.
      protected java.lang.String urlEncode​(java.lang.String value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AdrToolsDecisionImporter

        public AdrToolsDecisionImporter()
    • Method Detail

      • setDateFormat

        public void setDateFormat​(java.lang.String dateFormat)
        Sets the date format to use when parsing dates (the default is "yyyy-MM-dd").
        Parameters:
        dateFormat - a date format, as a String
      • setTimeZone

        public void setTimeZone​(java.lang.String timeZone)
        Sets the time zone to use when parsing dates (the default is UTC)
        Parameters:
        timeZone - a time zone as a String (e.g. "Europe/London" or "UTC")
      • setTimeZone

        public void setTimeZone​(java.util.TimeZone timeZone)
        Sets the time zone to use when parsing dates.
        Parameters:
        timeZone - a TimeZone instance
      • importDocumentation

        public void importDocumentation​(com.structurizr.documentation.Documentable documentable,
                                        java.io.File path)
        Imports Markdown files from the specified path, one per decision.
        Specified by:
        importDocumentation in interface DocumentationImporter
        Parameters:
        documentable - the item that documentation should be associated with
        path - the path to import documentation from
      • importDecision

        protected com.structurizr.documentation.Decision importDecision​(java.io.File file)
                                                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • extractIntegerIDFromFileName

        protected java.lang.String extractIntegerIDFromFileName​(java.io.File file)
      • extractTitle

        protected java.lang.String extractTitle​(java.lang.String[] lines)
      • extractDate

        protected java.util.Date extractDate​(java.lang.String[] lines)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • extractStatus

        protected java.lang.String extractStatus​(java.lang.String[] lines)
      • extractLinks

        protected void extractLinks​(com.structurizr.documentation.Decision decision,
                                    java.util.Map<java.lang.String,​com.structurizr.documentation.Decision> decisionsByFilename)
      • calculateUrl

        protected java.lang.String calculateUrl​(com.structurizr.documentation.Decision decision)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • urlEncode

        protected java.lang.String urlEncode​(java.lang.String value)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception