|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.tasklist.bugs.bugzilla; import java.io.*; import java.net.URL; import java.util.*; import java.util.Date; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParser; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException; /** Represents on issue in issuezilla. * Created by {@link Issuezilla#getBug} * * * tor@netbeans.org: * This class is virtually identical to * nbbuild/antsrc/org/netbeans/nbbuild/Issue.java * At first, I inclouded its class file directly as part of * the build. However, treating Issuezilla as a black box * didn't work well because when connections fail (and are * retried), or even during a query, there is no feedback - and * since issuezilla is so slow, it's hard to know in the GUI * that things are working. Therefore, I've modified the java * file to give us a little bit more feedback. * In CVS I stored the original file as the first revision, * so you can easily diff to see what has changed - and generate * a patch which you can then apply to an updated version * of nbbuild/antsrc/ to keep the two in sync. * * serff@netbeans.org: * This class is almost exactally the same as issuezilla.Issue, but modified to * work with bugzilla. I didn't want to call this class Bug because of the * higher level Bug class. If you can think of a better name, please let me know * * @todo think of a better name. * * @author Ivan Bradac, refactored by Jaroslav Tulach */ public final class Issue extends Object implements Comparable { //static final String ENHANCEMENT = "ENHANCEMENT"; static final String ISSUE_TYPE = "bug_severity"; static final String SHORT_DESC = "short_desc"; static final String LONG_DESC = "long_desc"; static final String COMMENT = "comment"; static final String ISSUE_ID = "bug_id"; static final String ISSUE_STATUS = "bug_status"; static final String RESOLUTION = "resolution"; static final String COMPONENT = "product"; static final String REPORTER = "reporter"; static final String VERSION = "version"; static final String SUBCOMPONENT = "component"; static final String REP_PLATFORM = "rep_platform"; static final String OP_SYS = "op_sys"; static final String PRIORITY = "priority"; static final String ASSIGNED_TO = "assigned_to"; // static final String CC = "cc"; // static final String DEPENDS_ON = "dependson"; // static final String BLOCKS = "blocks"; static final String CREATED = "creation_ts"; // static final String VOTES = "votes"; // static final String KEYWORDS = "keywords"; /** The target milestone attribute name. */ static final String TARGET_MILESTONE = "target_milestone"; /** Name of the attribute containing the long_desc as a list */ static final String LONG_DESC_LIST = "long_desc_list"; private HashMap attributes = new HashMap (49); /** * Gets the id as an Integer. * * @return the issue_id as */ public int getId() { Object id = getAttribute(ISSUE_ID); try { return Integer.parseInt ((String) id); } catch (Exception ex) { return -1; } } /** Who is assigned to this bug. * @return name of person assigned to this bug */ public String getAssignedTo () { return string (ASSIGNED_TO); } /** Who reported the bug. * @return name of the reporter */ public String getReportedBy () { return string (REPORTER); } /** Everyone who is interested in the issue. * @return array of names or empty array if nobody is */ public String[] getObservedBy () { // java.util.List l = (java.util.List)getAttribute (CC); // if (l != null) { // return (String[])l.toArray (new String[0]); // } else { return new String[0]; // } } /** Status of the bug, verified, etc. * @return textual name of the status. */ public String getStatus () { return string (ISSUE_STATUS); } /** Resolution: Fixed, etc... * @return textual name of resolution. */ public String getResolution () { return string (RESOLUTION); } /** Type of the issue: Bug, Enhancement, Task, etc... * @return textual name of issue type */ public String getType () { return string (ISSUE_TYPE); } /** Priority of the issue. * @return integer describing priority, -1 if unknown */ public int getPriority () { String s = string (PRIORITY); if (s.length () == 2 && s.charAt (0) == 'P') { return s.charAt (1) - '0'; } else { return -1; } } /** A time when this issue has been created. * @return the date or begining of epoch if wrongly defined */ public Date getCreated () { Date d = (Date)getAttribute (CREATED); return d == null ? new Date (0) : d; } /** The summary or short description of the bug. * @return string */ public String getSummary () { return string (SHORT_DESC); } /** Getter of descriptions. * @return array of descriptions */ public Description[] getDescriptions () { Object obj = getAttribute(LONG_DESC_LIST); if (obj == null) { return new Description[0]; } return (Description[])((List)obj).toArray (new Description[0]); } /** A list of bugs that depends on this one. * @return array of integer numbers of those bugs or empty array */ // public int[] getDependsOn () { // return ints (DEPENDS_ON); // } /** A list of bugs that this issue blocks. * @return array of integer numbers of those bugs or empty array */ // public int[] getBlocks () { // return ints (BLOCKS); // } /** Name of the milestone this issue should be resolved in. * @return string name */ public String getTargetMilestone () { return string (TARGET_MILESTONE); } /** Name of the component this issue belongs to. * @return string name */ public String getComponent () { return string (COMPONENT); } /** Name of subcomponent this issue belongs to. * @return string name */ public String getSubcomponent () { return string (SUBCOMPONENT); } /** Number of votes for given component. * @return integer representing number of votes or 0 is no votes present */ // public int getVotes () { // try { // String s = string (VOTES); // return Integer.parseInt (s); // } catch (Exception ex) { // return 0; // } // } /** All keywords of the issue. * @return Keywords deliminated by comma or empty string */ // public String getKeywords () { // try { // return string (KEYWORDS); // } catch (Exception ex) { // return ""; // } // } /** Check if the this issue has the specified keyword * @return |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.