Hi Jobin,
I tried both the ways without much success, i am not sure what i am doing wrong, i guess i am missing something it shouldn't be that hard to create the form using jira frame work
package com.sensage.jira.plugin;
import com.atlassian.jira.plugin.versionpanel.BrowseVersionContext;
import com.atlassian.jira.plugin.versionpanel.VersionTabPanel;
import com.atlassian.jira.plugin.versionpanel.VersionTabPanelModuleDescriptor;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.jira.web.action.JiraWebActionSupport;
import com.atlassian.jira.web.action.ProjectActionSupport;
import com.atlassian.jira.action.JiraActionSupport;
import com.atlassian.jira.issue.search.SearchProvider;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.atlassian.jira.util.ParameterUtils;
import com.opensymphony.user.User;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import org.apache.log4j.Logger;
import org.apache.velocity.app.Velocity;
@SuppressWarnings("serial")
public class AddBuildComment extends JiraWebActionSupport {
public AddBuildComment() {
}
private static final Logger log = Logger.getLogger(AddBuildComment.class);
public String doAdd (Map params, Context context) {
String build_comment = ParameterUtils.getStringParam(params, "add_comment");
Long build_id = ParameterUtils.getLongParam(params, "build_id");
log.debug("build comment about to add for build "
build_id" comment "+build_comment);
String warningStr ="";
String exceptionStr ="";
String query = "update build set comment = "
build_comment" where build_id = "+build_id;
Connection conn = null;
try
{
Context initCtx = new InitialContext();
DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/JiraDS");
conn = ds.getConnection();
Statement st = conn.createStatement();
st.execute(query);
SQLWarning warning = st.getWarnings();
if (null != warning)
{
warningStr = "
Warning:" + warning.getMessage() + "
";
}
}
catch (Throwable t)
{
ByteArrayOutputStream stackTrace = new ByteArrayOutputStream();
t.printStackTrace(new PrintStream(stackTrace));
exceptionStr = "
Exception: " + t.getMessage() + "
" + stackTrace.toString() + "
";
}
finally
{
if (null != conn)
{
try
{
conn.close();
}
catch (SQLException ex)
{
// we don't care if it gets an exception closing the connection
// just eat the exception and continue
}
}
}
return SUCCESS;
}
@Override
public User getRemoteUser() {
// TODO Auto-generated method stub
return null;
}
protected String doExecute(Map params, Context context) throws Exception {
String build_comment = ParameterUtils.getStringParam(params, "add_comment");
Long build_id = ParameterUtils.getLongParam(params, "build_id");
log.debug("build comment about to add for build "
build_id" comment "+build_comment);
String warningStr ="";
String exceptionStr ="";
String query = "update build set comment = "
build_comment" where build_id = "+build_id;
Connection conn = null;
try
{
Context initCtx = new InitialContext();
DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/JiraDS");
conn = ds.getConnection();
Statement st = conn.createStatement();
st.execute(query);
SQLWarning warning = st.getWarnings();
if (null != warning)
{
warningStr = "
Warning:" + warning.getMessage() + "
";
}
}
catch (Throwable t)
{
ByteArrayOutputStream stackTrace = new ByteArrayOutputStream();
t.printStackTrace(new PrintStream(stackTrace));
exceptionStr = "
Exception: " + t.getMessage() + "
" + stackTrace.toString() + "
";
}
finally
{
if (null != conn)
{
try
{
conn.close();
}
catch (SQLException ex)
{
// we don't care if it gets an exception closing the connection
// just eat the exception and continue
}
}
}
return SUCCESS;
}
}
plugin.xml
<atlassian-plugin key="com.sensage.jira.plugin" name="SenSage" plugins-version="2">
<plugin-info>
<description>This is the SenSage plugin for Atlassian JIRA.</description>
<version>1.0</version>
<vendor name="SenSage" url="http://www.sensage.com/" />
</plugin-info>
<version-tabpanel key="listbuilds-versionpanel" name="List Builds Version Panel" class="com.sensage.jira.plugin.ListBuildsVersionPanel">
<description key="list.builds.version.panel.description"/>
<name key="list.builds.version.panel.name"/>
<label key="list.builds.version.panel.label"/>
<resource type="velocity" name="view" location="templates/builds/builds-view.vm" />
<resource type="i18n" name="i18n" location="com.sensage.jira.plugin.i18n"/>
</version-tabpanel>
<report key="test-results" name="Test Results" class="com.sensage.jira.plugin.report.TestResults">
<description key="report.testresults.description">Test results for a particular build.</description>
<label key="report.testresuts.label"/>
<resource type="i18n" name="i18n" location="com.sensage.jira.plugin.i18n"/>
<properties>
<property>
<key>buildId</key>
<name>report.testresults.buildid</name>
<description>report.testresults.buildid.description</description>
<type>long</type>
</property>
</properties>
</report>
<webwork1 key="add-comment" name="Add comment to build" class="java.lang.Object">
<actions>
<action name="com.sensage.jira.plugin.AddBuildComment" alias="CommentOnBuildResults">
<view name="input" type="velocity">/templates/builds/builds-view.vm</view>
<view name="success" type="velocity">/templates/builds/builds-comment-view.vm</view>
</action>
</actions>
</webwork1>
</atlassian-plugin>
Console output
etStatus()
2010-06-17 16:45:01,171 http-8080-2 DEBUG administrator 1005x51x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/2
http://org.objectweb.jotm.jta Current.g
etStatus()
2010-06-17 16:45:01,578 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,578 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,578 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,578 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,593 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,593 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,593 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,593 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,593 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,593 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,593 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,593 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,593 http-8080-5 DEBUG anonymous 1005x56x4 1lqulcu 127.0.0.1 /s/519/4/1.0/_/download/resources/jira.webresources:global-static
/global.css
http://org.objectweb.jotm.jta Current.getStatus()
2010-06-17 16:45:01,890 http-8080-6 DEBUG administrator 1005x77x4 1lqulcu 127.0.0.1 /secure/projectavatar
http://org.objectweb.jotm.jta Current.getSta
tus()
2010-06-17 16:45:01,890 http-8080-6 DEBUG administrator 1005x77x4 1lqulcu 127.0.0.1 /secure/projectavatar
http://org.objectweb.jotm.jta Current.getSta
tus()
2010-06-17 16:45:01,890 http-8080-6 DEBUG administrator 1005x77x4 1lqulcu 127.0.0.1 /secure/projectavatar
http://org.objectweb.jotm.jta Current.getSta
tus()
2010-06-17 16:45:05,515 http-8080-2 DEBUG administrator 1005x95x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/CommentOnBuildResults.jspa [org.obje
ctweb.jotm.jta] Current.getStatus()
2010-06-17 16:45:05,515 http-8080-2 DEBUG administrator 1005x95x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/CommentOnBuildResults.jspa [org.obje
ctweb.jotm.jta] Current.getStatus()
2010-06-17 16:45:05,531 http-8080-2 DEBUG administrator 1005x95x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/CommentOnBuildResults.jspa [org.obje
ctweb.jotm.jta] Current.getStatus()
2010-06-17 16:45:05,531 http-8080-2 DEBUG administrator 1005x95x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/CommentOnBuildResults.jspa [org.obje
ctweb.jotm.jta] Current.getStatus()
2010-06-17 16:45:05,546 http-8080-2 DEBUG administrator 1005x95x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/CommentOnBuildResults.jspa [org.obje
ctweb.jotm.jta] Current.getStatus()
2010-06-17 16:45:05,546 http-8080-2 DEBUG administrator 1005x95x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/CommentOnBuildResults.jspa [org.obje
ctweb.jotm.jta] Current.getStatus()
2010-06-17 16:45:05,546 http-8080-2 DEBUG administrator 1005x95x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/CommentOnBuildResults.jspa [org.obje
ctweb.jotm.jta] Current.getStatus()
2010-06-17 16:45:05,546 http-8080-2 DEBUG administrator 1005x95x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/CommentOnBuildResults.jspa [org.obje
ctweb.jotm.jta] Current.getStatus()
2010-06-17 16:45:05,546 http-8080-2 DEBUG administrator 1005x95x1 1lqulcu 127.0.0.1 /browse/SS/fixforversion/CommentOnBuildResults.jspa [org.obje
ctweb.jotm.jta] Current.getStatus()