KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > exceptions > web > IssuezillaHandler


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.exceptions.web;
20
21 import java.net.URLEncoder JavaDoc;
22 import javax.persistence.EntityManagerFactory;
23 import javax.persistence.Persistence;
24 import javax.servlet.jsp.tagext.*;
25 import javax.servlet.jsp.JspWriter JavaDoc;
26 import javax.servlet.jsp.JspException JavaDoc;
27 import org.netbeans.modules.exceptions.entity.Issue;
28
29 /**
30  *
31  * @author Jan Horvath
32  * @version
33  */

34
35 public class IssuezillaHandler extends SimpleTagSupport {
36     
37     public static final String JavaDoc ISSUEZILLA_DETAIL = "http://www.netbeans.org/issues/show_bug.cgi?id=";
38     public static final String JavaDoc ISSUEZILLA_ENTER_BUG = "izredirect?";
39     //public static final String ISSUEZILLA_ENTER_BUG = "http://www.netbeans.org/issues/enter_bug.cgi?";
40
public static final String JavaDoc EXCEPTION_DETAIL = "http://anna.nbextras.org/exceptions/detail.do?id=";
41     
42     private String JavaDoc id;
43     private Issue issue;
44     
45     public void doTag() throws JspException JavaDoc {
46         
47         JspWriter JavaDoc out=getJspContext().getOut();
48         
49         try {
50             if (issue != null) {
51                 Integer JavaDoc issuezillaId = issue.getIssuezillaid();
52                 if (issuezillaId.intValue() == 0) {
53                     out.print("<A HREF='");
54                     
55                     out.print(ISSUEZILLA_ENTER_BUG + "component=" + URLEncoder.encode(issue.getComponent()));
56                     out.print("&subcomponent=" + URLEncoder.encode(issue.getSubcomponent()));
57                     out.print("&comment=" + URLEncoder.encode("\n\nDON'T DELETE THIS TEXT:\n"
58                             + EXCEPTION_DETAIL + issue.getId() +
59                             "\nBuild: " + issue.getProductversion() +
60                             "\nVM: " + issue.getVm() +
61                             "\nOS: " + issue.getOperatingsystem()));
62                     out.print("&short_desc=" + URLEncoder.encode(issue.getSummary()));
63                     out.print("&version=6.0");
64                     out.print("&exceptionsid=" + issue.getId());
65                     out.println("'>enter</A>");
66                     
67                 } else {
68                     out.print("<A HREF='");
69                     out.print(ISSUEZILLA_DETAIL + issuezillaId);
70                     out.println("'>" + issue.getIssuezillaid() + "</A>");
71                 }
72             }
73             
74             JspFragment f=getJspBody();
75             if (f != null) f.invoke(out);
76             
77         } catch (java.io.IOException JavaDoc ex) {
78             throw new JspException JavaDoc(ex.getMessage());
79         }
80         
81     }
82     
83     public void setId(String JavaDoc id) {
84         this.id = id;
85     }
86     
87     public void setIssue(Issue issue) {
88         this.issue = issue;
89     }
90     
91 }
92
Popular Tags