Created
January 9, 2015 10:35
-
-
Save jechlin/617013bc27e49674d9f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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