Hw do I create a hashmap from JRPrintHyperlink?

I have got most of my program working where I can drill down reports but I am unable to figure out how to convert the parameters from JRPrintHyperlink into a hashmap.  If I hardcode my values into a hashmap it works fine, but I really need to pass the parameters supplied by JRPrintHyperlink.

The most frustrating part is that I can see the values from the debugger and I can even add watches like these passedParameters.get(0).name passedParameters.get(0).value but cannot use that same notation in my java source.

What is the magic I am looking for???

 

Thanks,

Mel

Code:
        switch (hyperlink.getHyperlinkType()) {
            case JRHyperlink.HYPERLINK_TYPE_REFERENCE: {
                try {
                    Class.forName("net.sourceforge.jtds.jdbc.Driver");
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(YCWUAReportViewer.class.getName()).log(Level.SEVERE, null, ex);
                }
 
                Connection con = null;
                String url = "jdbc:jtds:sqlserver://mySQL/myDB";
                String user = "myUser";
                String pw = "xxXXXXXX";
                try {
                    con = DriverManager.getConnection(url, user, pw);
                } catch (SQLException ex) {
                    Logger.getLogger(YCWUAReportViewer.class.getName()).log(Level.SEVERE, null, ex);
                }
 
                try {
                    HashMap myParameters = new HashMap();
                    String myURL = hyperlink.getHyperlinkReference();
                    List passedParameters = hyperlink.getHyperlinkParameters().getParameters();
                    for(int I=0; I<passedParameters.size();I++){
                      //  What goes here to make a hashmap from a hyperlink!!!!!
                      //  String myName = passedParameters.get(I).name;
                      //  String myValue = passedParameters.get(I).value;
                    }
                    jasperPrint = JasperFillManager.fillReport(myURL, myParameters, con);
                    YCWUAReportViewer jasperviewer = new YCWUAReportViewer(jasperPrint);
                    jasperviewer.setVisible(true);
                    try {
                        con.close();
                    } catch (SQLException ex) {
                        Logger.getLogger(YCWUAReportViewer.class.getName()).log(Level.SEVERE, null, ex);
                    }
 
                } catch (JRException ex) {
                    Logger.getLogger(frmMaster.class.getName()).log(Level.SEVERE, null, ex);
                }
                //JOptionPane.showMessageDialog(this, "Hello " + hyperlink.getHyperlinkReference());
                try {
                    con.close();
                } catch (SQLException ex) {
                    Logger.getLogger(YCWUAReportViewer.class.getName()).log(Level.SEVERE, null, ex);
                }
                break;
            }
 </td></tr></tbody></table>
mirizarry's picture
Joined: Nov 15 2006 - 4:52am
Last seen: 4 months 4 weeks ago

0 Answers:

No answers yet
Feedback