Class Migrator.Builder

    • Constructor Detail

      • Builder

        public Builder​(FogBugz fogBugz,
                       Iterable<FBCase> cases,
                       GHRepo ghRepo)
        Constructor.
        Parameters:
        fogBugz - The FogBugz instance
        cases - Cases to migrate
        ghRepo - The GitHub repository to migrate to
    • Method Detail

      • closeIf

        public Migrator.Builder closeIf​(Predicate<FBCase> closeIf)
        After migrating a FogBugz case, close the corresponding GitHub issue if the FBCase passes the given Predicate. By default, the GitHub issue will be closed if the FogBugz case is closed.
        Parameters:
        closeIf - The Predicate to use
        Returns:
        This object
      • usernameMap

        public Migrator.Builder usernameMap​(Map<String,​String> usernameMap)
        Map FogBugz names to GitHub usernames.
        Parameters:
        usernameMap - A Map where key is a FogBugz name and value is the corresponding GitHub username.
        Returns:
        This object
      • postDelay

        public Migrator.Builder postDelay​(long postDelay)
        Parameters:
        postDelay - Number of milliseconds to wait after posting an issue or comment, to avoid abuse detection.
        Returns:
        This object
        Throws:
        IllegalArgumentException - if postDelay is negative
      • afterMigrate

        public Migrator.Builder afterMigrate​(BiConsumer<FBCase,​GHIssue> afterMigrate)
        After migrating a case to GitHub, perform some action specified by the given BiConsumer.
        Parameters:
        afterMigrate - BiConsumer to use. The BiConsumer receives (1) the FogBugz case that was migrated, and (2) the GitHub issue that was posted.
        Returns:
        This object
      • exceptionHandler

        public Migrator.Builder exceptionHandler​(BiConsumer<FBCase,​Exception> exceptionHandler)
        If migrating a case causes an Exception to be thrown, catch and handle it using the given BiConsumer. If no further exceptions are thrown, the migration process will continue as normal after being handled in this way. By default, Exceptions are propagated upwards as is (thus ending the migration process).
        Parameters:
        exceptionHandler - BiConsumer to use. The BiConsumer receives (1) the FogBugz case that was attempted to be migrated, and (2) the exception thrown.
        Returns:
        This object
      • dateFormat

        public Migrator.Builder dateFormat​(DateFormat dateFormat)
        Format timestamps using the given DateFormat. By default, they will be formatted as follows: 4/18/2017 1:29 PM EDT. (The time zone will vary based on the JVM default.)

        Note: The default DateFormat is thread-safe. Should this method be invoked, the new DateFormat may no longer be thread-safe. If using this configuration option, it is recommended to avoid multithreaded access of the resulting Migrator.

        Parameters:
        dateFormat - DateFormat to use.
        Returns:
        This object