1 32 33 package com.knowgate.lucene; 34 35 import java.util.Date ; 36 import java.util.Comparator ; 37 import java.text.SimpleDateFormat ; 38 39 43 public class BugRecord { 44 45 public static class CompareAuthor implements Comparator { 46 public int compare(Object o1, Object o2) { 47 if (((BugRecord)o1).getAuthor()==null) return -1; 48 return ((BugRecord)o1).getAuthor().compareTo(((BugRecord)o2).getAuthor()); 49 } 50 } 51 52 public static class CompareTitle implements Comparator { 53 public int compare(Object o1, Object o2) { 54 if (((BugRecord)o1).getTitle()==null) return -1; 55 return ((BugRecord)o1).getTitle().compareTo(((BugRecord)o2).getTitle()); 56 } 57 } 58 59 public static class CompareDate implements Comparator { 60 public int compare(Object o1, Object o2) { 61 if (((BugRecord)o1).getDate()==null) return -1; 62 return ((BugRecord)o1).getDate().compareTo(((BugRecord)o2).getDate()); 63 } 64 } 65 66 public static class ComparePriority implements Comparator { 67 public int compare(Object o1, Object o2) { 68 if (((BugRecord)o1).getPriority()==null) return -1; 69 return ((BugRecord)o1).getPriority().compareTo(((BugRecord)o2).getPriority()); 70 } 71 } 72 73 public static class CompareSeverity implements Comparator { 74 public int compare(Object o1, Object o2) { 75 if (((BugRecord)o1).getSeverity()==null) return -1; 76 return ((BugRecord)o1).getSeverity().compareTo(((BugRecord)o2).getSeverity()); 77 } 78 } 79 80 private static SimpleDateFormat fmt = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); 81 private int number; 82 private String guid; 83 private String project; 84 private String title; 85 private String author; 86 private Date created; 87 private String type; 88 private String status; 89 private Short priority; 90 private Short severity; 91 private String abstrct; 92 93 public BugRecord() { } 94 95 public BugRecord(int iNumber, String sGuid, String sProject, String sTitle, 96 String sReportedBy, String sDate, String sType, String sStatus, 97 String sPriority, String sSeverity, String sAbstract) { 98 number = iNumber; 99 guid = sGuid; 100 project = sProject; 101 title = sTitle; 102 author = sReportedBy; 103 try { created = fmt.parse(sDate); } catch (Exception ignore) {} 104 type = sType; 105 if (null!=sPriority) 106 priority = new Short (sPriority); 107 else 108 priority = null; 109 if (null!=sSeverity) 110 severity = new Short (sSeverity); 111 else 112 severity = null; 113 abstrct = sAbstract; 114 } 115 116 public String getProject() { 117 return project; 118 } 119 120 public int getNumber() throws NumberFormatException { 121 return number; 122 } 123 124 public String getGuid() { 125 return guid; 126 } 127 128 public String getTitle() { 129 return title; 130 } 131 132 public String getAuthor() { 133 return author; 134 } 135 136 public Date getDate() { 137 return created; 138 } 139 140 public String getDateAsString() { 141 return fmt.format(created); 142 } 143 144 public Short getPriority() { 145 return priority; 146 } 147 148 public Short getSeverity() { 149 return severity; 150 } 151 152 public String getStatus() { 153 return status; 154 } 155 156 public String getType() { 157 return type; 158 } 159 160 public void setProject(String sProjectGUID) { 161 project = sProjectGUID; 162 } 163 164 public void setGuid(String sGuid) { 165 guid = sGuid; 166 } 167 168 public void setTitle(String sTitle) { 169 title = sTitle; 170 } 171 172 public void setAuthor(String sAuthor) { 173 author = sAuthor; 174 } 175 176 public void setDate(Date oDtCreated) { 177 created = oDtCreated; 178 } 179 180 public void setPriority(Short oPriority) { 181 priority=oPriority; 182 } 183 184 public void setSeverity(Short oSeverity) { 185 severity=oSeverity; 186 } 187 188 public void setType(String sType) { 189 type=sType; 190 } 191 192 public void setStatus(String sStatus) { 193 status=sStatus; 194 } 195 196 } 197 | Popular Tags |