How can I determine all the structure boards that are using a particular type of synchronizer?

We have 100's of structure boards and many of them have synchronizers installed. We have built two custom synchronizers and are interested in determining which structure boards are using them. I'm happy to write a script or DB query but can't figure out which API to exploit. I've looked through your REST endpoints to no avail and recall you saying that your derby DB isn't query-able. Am I out of luck?

Thanks!

1 answer

1 accepted

1 vote
Accepted answer

Hello Thomas, thanks for the question! You can get the result by using Structure's Java API. You'll need to install the Script Runner plugin (if you don't have it yet) and use a Groovy script like the following:

// get the services we need
import com.atlassian.jira.component.ComponentAccessor
def plugin = ComponentAccessor.getPluginAccessor().getPlugin('com.almworks.jira.structure')
def structureManager = plugin.getModuleDescriptor('structure-manager').getModule()
def syncManager = plugin.getModuleDescriptor('sync-manager').getModule()


// get all structures (except archived)
def structures = structureManager.getAllStructures(null, null, true)
// find structures having the synchronizers you need
def result = structures.findAll { str ->
  // get all synchronizers for the structure
  def syncs = syncManager.getInstalledSynchronizersForStructure(str.id)
  // check if any of the syncs satisfies the condition
  syncs.any { sync ->
    // in this case, the sync must be enabled and be a FilterSynchronizer
    // adjust the condition as needed
    syncManager.isAutosyncEnabled(sync.instanceId) && sync.synchronizer.class.simpleName == 'FilterSynchronizer'
  }
}


// format the result -- you may need to use <br> as separator for ScriptRunner 3
result.join('\n')

This example script finds all enabled filter synchronzers, so you'll need to adjust the it to find the ones you're interested in.

We also have an online developer guide with a Java API reference, which could be helpful.

I hope this helps. Please write if you have any questions.

Worked like a champ! Thanks!!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 31, 2018 in Marketplace Apps

Marketplace Spotlight: Zephyr

Hello Atlassian Community! Each month, we run a series of Spotlights to highlight Marketplace vendors and apps that our team thinks this Community would find valuable. In last month's Spotlig...

344 views 0 1
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you