Some progress toward implementing store(Analysis).
[cfb.git] / prod / net / jaekl / cfb / xml / messages / BugCategory.java
1 package net.jaekl.cfb.xml.messages;
2
3 import org.xml.sax.Attributes;
4
5 import net.jaekl.qd.xml.MissingAttributeException;
6 import net.jaekl.qd.xml.ParseResult;
7 import net.jaekl.qd.xml.XmlParseException;
8
9 public class BugCategory extends ParseResult {
10         static final String CATEGORY = "category";      // attribute name
11         static final String DESCRIPTION = "Description";
12         static final String ABBREVIATION = "Abbreviation";
13         static final String DETAILS = "Details";
14
15         static final String TAG = "BugCategory";
16         static final String[] INTERNAL = { DESCRIPTION, ABBREVIATION, DETAILS };
17         static final Object[][] EXTERNAL = { };
18
19         String m_category;
20         String m_descr;
21         String m_abbrev;
22         String m_details;
23         long m_id;
24         
25         public BugCategory() 
26         {
27                 super(TAG, INTERNAL, EXTERNAL);
28                 m_category = m_descr = m_abbrev = m_details = "";
29         }
30         
31         public String getCategory() { return m_category; }
32         public String getDescr() { return m_descr; }
33         public String getAbbrev() { return m_abbrev; }
34         public String getDetails() { return m_details; }
35
36         public void setId(long id) { m_id = id; }
37         public long getId() { return m_id; }
38
39         @Override
40         public void endContents(String uri, String localName, String qName, String chars) throws XmlParseException 
41         {
42                 if (DESCRIPTION.equals(localName)) {
43                         m_descr = chars;
44                 }
45                 else if (ABBREVIATION.equals(localName)) {
46                         m_abbrev = chars;
47                 }
48                 else if (DETAILS.equals(localName)) {
49                         m_details = chars;
50                 }
51         }
52
53         @Override
54         public void endExternal(String uri, String localName, String qName)
55                 throws XmlParseException 
56         {
57                 // nothing to do
58         }
59         
60         // Called once for this tag itself
61         @Override 
62         public void handleMainAttributes(Attributes attr) throws MissingAttributeException {
63                 m_category = this.getRequiredAttr(TAG, attr, CATEGORY);
64         }
65         
66 }