mergeWorkLogs - with custom handling

    Signature

    HelperworkLogHelper
    Signature
     issue.workLogs = workLogHelper.mergeWorkLogs(issue, replica, workLogChangeFn )
    Description

    Merges the worklogs from two sides and allows adjusting details of every synced workLog. 

    Use a closure function to define how the workLogs should behave. 

    Introduced in2.4.0

    Example use

    • Set the workLog author depending on the previously defined user mapping
    //specify workLog author user mapping with the help of a groovy closure 
    // SETTINGS
    def userMapping = [
            "fooey@mycompany.com" : "barry@mycompany.net"
    ]
    def defaultUser = nodeHelper.getUserByEmail("bazzy@mycompany.net")
    // END: SETTINGS
    
    issue.workLogs = workLogHelper.mergeWorkLogs(issue,replica, { w ->
        w.author = nodeHelper.getUserByEmail(userMapping[w.author?.email]) ?: defaultUser
        w.updateAuthor = nodeHelper.getUserByEmail(userMapping[w.updateAuthor.email]) ?: defaultUser
    })
    • Map the workLog author/updateAuthor by the username

      Use it when source and destination Instances use the same Active Directory

    //use the local user with the username as the source worklog author/updateAuthor
    issue.workLogs = workLogHelper.mergeWorkLogs(issue,replica, { w ->
        w.author = nodeHelper.getUserByUsername(w.author?.username)
        w.updateAuthor = nodeHelper.getUserByUsername(w.updateAuthor.username)
    })