setting up parameters

How to set the velocity macro file values like $firstPassYield etc when action is passed from java class:

<form>
<div>
<table cellpadding="5">
<b>Management Review Data</b>
<tr><td>
1. First Pass Yield:</td>
<td>$firstPassYield
</tr>
<tr><td>
</form>

In my java class:

public class UpdateDataAction extends JiraWebActionSupport{

Connection conn;
private String dbLocation = "jdbc:jtds:sqlserver://10.91.3.210:1433/jiradb_new";
//private String dbLocation = "jdbc:jtds:sqlserver://10.91.3.210:1433/jiradb_dev";
private String dbuser = "jiraadmin";
//private String dbuser = "sa";
private String dbpassword = "jiraadmin";

MonthlyDataBean mdb = new MonthlyDataBean();

public String getFromDt() {
return fromDt;
}

public void setFromDt(String fromDt) {
this.fromDt = fromDt;
}

public String getToDt() {
return toDt;
}

public void setToDt(String toDt) {
this.toDt = toDt;
}

private String fromDt;
private String toDt;


public String getKeyHolder() {
return keyHolder;
}

public void setKeyHolder(String keyHolder) {
this.keyHolder = keyHolder;
}

private String keyHolder;

public String doUpload() throws Exception{
System.out.println("In DODEFAULT");
String fromdate = getFromDt();
String todate = getToDt();
String ikey = getKeyHolder();
connect();

System.out.println(fromdate + " #$#$#$#$#$# " + todate + " " + ikey);
setValueForEffortEstimation(ikey);
mdb.setpEffortEstimation("-");
System.out.println(mdb.getpEffortEstimation() + " ###");
setValueForTCEC(ikey);
setValueForTPEC(ikey);
setValueForTREC(ikey);

setValueForFirstYield(ikey);
setValueForTCFirstYield(ikey);
setValueForTPFirstYield(ikey);
setValueForTRFirstYield(ikey);

setValueForDefectDensity(ikey);
setValueForTCDefectDensity(ikey);
setValueForTPDefectDensity(ikey);
setValueForTRDefectDensity(ikey);

return SUCCESS;
}

/**
* Method which handles database connection
*/
public Connection connect()
{
try
{
Class.forName("net.sourceforge.jtds.jdbc.Driver");
DriverManager.registerDriver(new Driver());
conn = DriverManager.getConnection(dbLocation, dbuser, dbpassword);
}
catch (Exception e)
{
e.printStackTrace();
}
return conn;
}

public void setValueForFirstYield(String key){
Statement st = null;
ResultSet rs = null;
ResultSet rs1 = null;
conn = null;
try{
conn = connect();
st = conn.createStatement();
rs = st.executeQuery("select sum(NUMBERVALUE) from customfieldvalue where (customfield = 10225 or "+
"customfield = 10250 or customfield = 10251) and issue in (select ID from jiraissue "+
"where pkey like '%" + key + "%' and "+
"created between dateadd(month, -1, CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),101)) and CAST(CONVERT(CHAR(8)," +
"CURRENT_TIMESTAMP - DAY(CURRENT_TIMESTAMP),112) AS DATETIME))");
st = null;
st = conn.createStatement();
rs1 = st.executeQuery("select sum(NUMBERVALUE) from customfieldvalue where (customfield = 10314 or customfield = 10313) "+
"and issue in (select ID from jiraissue where pkey like '%" + key + "%' and "+
"created between dateadd(month, -1, CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),101)) and CAST(CONVERT(CHAR(8)," +
"CURRENT_TIMESTAMP - DAY(CURRENT_TIMESTAMP),112) AS DATETIME))");
//rs.next();
//rs1.next();
Float f= new Float(0.0D);
if (rs.next() && rs1.next())
{
f = new Float(((double)rs1.getLong(1)/(double)rs.getLong(1)));
mdb.setFirstPassYield(Math.round(f.doubleValue() * 100)+"%");
}else{
mdb.setFirstPassYield(Math.round(f)+"%");
}
}catch (Exception e) {
e.printStackTrace();
}
finally{
try {
rs.close();
rs1.close();
st.close();
conn.close();
} catch (SQLException ex) {
}
}
}

}

Let me know what has gone wrong here. very urgent

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

67 views 0 11
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