Created
September 12, 2023 05:26
-
-
Save vikrantyadav11/01394247d635c639fabb622e9ecbe798 to your computer and use it in GitHub Desktop.
This file contains 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 delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface) | |
String helperName = delegator.getGroupHelperName("default") | |
def sqlStmt = """ | |
select pe.property_key,p.* from propertyentry pe join project p on pe.entity_id=p.id where property_key = 'jira.archiving.projects'; | |
""" | |
Connection conn = ConnectionFactory.getConnection(helperName) | |
Sql sql = new Sql(conn) | |
String result = """ | |
<table> | |
<tr> | |
<th>Project ID</th> | |
<th>Project Name</th> | |
</tr> | |
""" | |
sql.eachRow(sqlStmt){ it -> | |
result += """ | |
<tr> | |
<td>${it.getAt("pname")}</td> | |
<td>${it.getAt("ID")}</td> | |
</tr> | |
""" | |
} | |
return result+"</table>" | |
sql.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment