Skip to content

Instantly share code, notes, and snippets.

@jechlin
Created January 9, 2015 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jechlin/617013bc27e49674d9f7 to your computer and use it in GitHub Desktop.
Save jechlin/617013bc27e49674d9f7 to your computer and use it in GitHub Desktop.
import com.atlassian.jira.component.ComponentAccessor
import groovy.sql.Sql
import org.ofbiz.core.entity.ConnectionFactory
import org.ofbiz.core.entity.DelegatorInterface
import java.sql.Connection
def projectManager = ComponentAccessor.getProjectManager()
delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface.class)
String helperName = delegator.getGroupHelperName("default");
Connection conn = ConnectionFactory.getConnection(helperName);
Sql sql = new Sql(conn)
def sb = new StringBuffer()
try {
sql.eachRow("select id from project") {
if (! projectManager.getProjectObj(it.id as Long)) {
sb << "project with id ${it.id} seems broken<br>\n"
}
}
}
finally {
sql.close()
}
sb.toString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment