Source Code Cross Referenced for AbstractItem.java in  » Issue-Tracking » jTrac » info » jtrac » domain » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Issue Tracking » jTrac » info.jtrac.domain 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2005 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package info.jtrac.domain;
018:
019:        import java.io.Serializable;
020:        import java.util.Date;
021:
022:        import static info.jtrac.domain.Field.Name.*;
023:        import info.jtrac.util.DateUtils;
024:        import java.util.Set;
025:        import org.springmodules.lucene.index.core.DocumentCreator;
026:
027:        /**
028:         * Abstract class that serves as base for both Item and History
029:         * this contains the fields that are common to both and persisted
030:         */
031:        public abstract class AbstractItem implements  Serializable,
032:                DocumentCreator {
033:
034:            private long id;
035:            private int version;
036:            private Item parent; // slightly different meaning for Item and History
037:            private String summary;
038:            private String detail;
039:            private User loggedBy;
040:            private User assignedTo;
041:            private Date timeStamp;
042:            private Double plannedEffort;
043:            //===========================
044:            private Integer status;
045:            private Integer severity;
046:            private Integer priority;
047:            private Integer cusInt01;
048:            private Integer cusInt02;
049:            private Integer cusInt03;
050:            private Integer cusInt04;
051:            private Integer cusInt05;
052:            private Integer cusInt06;
053:            private Integer cusInt07;
054:            private Integer cusInt08;
055:            private Integer cusInt09;
056:            private Integer cusInt10;
057:            private Double cusDbl01;
058:            private Double cusDbl02;
059:            private Double cusDbl03;
060:            private String cusStr01;
061:            private String cusStr02;
062:            private String cusStr03;
063:            private String cusStr04;
064:            private String cusStr05;
065:            private Date cusTim01;
066:            private Date cusTim02;
067:            private Date cusTim03;
068:
069:            // probably belong to Item not AbstractItem, but convenient for item_view_form binding
070:            private Set<ItemUser> itemUsers;
071:            private Set<ItemItem> relatedItems;
072:            private Set<ItemItem> relatingItems;
073:            private Set<ItemTag> itemTags;
074:
075:            // mvc form binding convenience not really domain, TODO refactor
076:            private boolean sendNotifications = true;
077:
078:            // we could have used reflection or a Map but doing this way for performance
079:            public Object getValue(Field.Name fieldName) {
080:                switch (fieldName) {
081:                case SEVERITY:
082:                    return severity;
083:                case PRIORITY:
084:                    return priority;
085:                case CUS_INT_01:
086:                    return cusInt01;
087:                case CUS_INT_02:
088:                    return cusInt02;
089:                case CUS_INT_03:
090:                    return cusInt03;
091:                case CUS_INT_04:
092:                    return cusInt04;
093:                case CUS_INT_05:
094:                    return cusInt05;
095:                case CUS_INT_06:
096:                    return cusInt06;
097:                case CUS_INT_07:
098:                    return cusInt07;
099:                case CUS_INT_08:
100:                    return cusInt08;
101:                case CUS_INT_09:
102:                    return cusInt09;
103:                case CUS_INT_10:
104:                    return cusInt10;
105:                case CUS_DBL_01:
106:                    return cusDbl01;
107:                case CUS_DBL_02:
108:                    return cusDbl02;
109:                case CUS_DBL_03:
110:                    return cusDbl03;
111:                case CUS_STR_01:
112:                    return cusStr01;
113:                case CUS_STR_02:
114:                    return cusStr02;
115:                case CUS_STR_03:
116:                    return cusStr03;
117:                case CUS_STR_04:
118:                    return cusStr04;
119:                case CUS_STR_05:
120:                    return cusStr05;
121:                case CUS_TIM_01:
122:                    return cusTim01;
123:                case CUS_TIM_02:
124:                    return cusTim02;
125:                case CUS_TIM_03:
126:                    return cusTim03;
127:                default:
128:                    return null; // this should never happen
129:                }
130:            }
131:
132:            // we could have used reflection or a Map but doing this way for performance
133:            public void setValue(Field.Name fieldName, Object value) {
134:                switch (fieldName) {
135:                case SEVERITY:
136:                    severity = (Integer) value;
137:                    break;
138:                case PRIORITY:
139:                    priority = (Integer) value;
140:                    break;
141:                case CUS_INT_01:
142:                    cusInt01 = (Integer) value;
143:                    break;
144:                case CUS_INT_02:
145:                    cusInt02 = (Integer) value;
146:                    break;
147:                case CUS_INT_03:
148:                    cusInt03 = (Integer) value;
149:                    break;
150:                case CUS_INT_04:
151:                    cusInt04 = (Integer) value;
152:                    break;
153:                case CUS_INT_05:
154:                    cusInt05 = (Integer) value;
155:                    break;
156:                case CUS_INT_06:
157:                    cusInt06 = (Integer) value;
158:                    break;
159:                case CUS_INT_07:
160:                    cusInt07 = (Integer) value;
161:                    break;
162:                case CUS_INT_08:
163:                    cusInt08 = (Integer) value;
164:                    break;
165:                case CUS_INT_09:
166:                    cusInt09 = (Integer) value;
167:                    break;
168:                case CUS_INT_10:
169:                    cusInt10 = (Integer) value;
170:                    break;
171:                case CUS_DBL_01:
172:                    cusDbl01 = (Double) value;
173:                    break;
174:                case CUS_DBL_02:
175:                    cusDbl02 = (Double) value;
176:                    break;
177:                case CUS_DBL_03:
178:                    cusDbl03 = (Double) value;
179:                    break;
180:                case CUS_STR_01:
181:                    cusStr01 = (String) value;
182:                    break;
183:                case CUS_STR_02:
184:                    cusStr02 = (String) value;
185:                    break;
186:                case CUS_STR_03:
187:                    cusStr03 = (String) value;
188:                    break;
189:                case CUS_STR_04:
190:                    cusStr04 = (String) value;
191:                    break;
192:                case CUS_STR_05:
193:                    cusStr05 = (String) value;
194:                    break;
195:                case CUS_TIM_01:
196:                    cusTim01 = (Date) value;
197:                    break;
198:                case CUS_TIM_02:
199:                    cusTim02 = (Date) value;
200:                    break;
201:                case CUS_TIM_03:
202:                    cusTim03 = (Date) value;
203:                default: // this should never happen
204:                }
205:            }
206:
207:            // must override, History behaves differently from Item
208:            public abstract Space getSpace();
209:
210:            public abstract String getRefId();
211:
212:            public String getCustomValue(Field.Name fieldName) {
213:                // using accessor for space, getSpace() is overridden in subclass History
214:                if (fieldName.getType() <= 3) {
215:                    return getSpace().getMetadata().getCustomValue(fieldName,
216:                            (Integer) getValue(fieldName));
217:                } else {
218:                    Object o = getValue(fieldName);
219:                    if (o == null) {
220:                        return "";
221:                    }
222:                    if (o instanceof  Date) {
223:                        return DateUtils.format((Date) o);
224:                    }
225:                    return o.toString();
226:                }
227:            }
228:
229:            public String getStatusValue() {
230:                // using accessor for space, getSpace() is overridden in subclass History
231:                return getSpace().getMetadata().getStatusValue(status);
232:            }
233:
234:            //===================================================
235:
236:            public Integer getStatus() {
237:                return status;
238:            }
239:
240:            public Integer getSeverity() {
241:                return severity;
242:            }
243:
244:            public Integer getPriority() {
245:                return priority;
246:            }
247:
248:            public Integer getCusInt01() {
249:                return cusInt01;
250:            }
251:
252:            public Integer getCusInt02() {
253:                return cusInt02;
254:            }
255:
256:            public Integer getCusInt03() {
257:                return cusInt03;
258:            }
259:
260:            public Integer getCusInt04() {
261:                return cusInt04;
262:            }
263:
264:            public Integer getCusInt05() {
265:                return cusInt05;
266:            }
267:
268:            public Integer getCusInt06() {
269:                return cusInt06;
270:            }
271:
272:            public Integer getCusInt07() {
273:                return cusInt07;
274:            }
275:
276:            public Integer getCusInt08() {
277:                return cusInt08;
278:            }
279:
280:            public Integer getCusInt09() {
281:                return cusInt09;
282:            }
283:
284:            public Integer getCusInt10() {
285:                return cusInt10;
286:            }
287:
288:            public Double getCusDbl01() {
289:                return cusDbl01;
290:            }
291:
292:            public Double getCusDbl02() {
293:                return cusDbl02;
294:            }
295:
296:            public Double getCusDbl03() {
297:                return cusDbl03;
298:            }
299:
300:            public String getCusStr01() {
301:                return cusStr01;
302:            }
303:
304:            public String getCusStr02() {
305:                return cusStr02;
306:            }
307:
308:            public String getCusStr03() {
309:                return cusStr03;
310:            }
311:
312:            public String getCusStr04() {
313:                return cusStr04;
314:            }
315:
316:            public String getCusStr05() {
317:                return cusStr05;
318:            }
319:
320:            public Date getCusTim01() {
321:                return cusTim01;
322:            }
323:
324:            public Date getCusTim02() {
325:                return cusTim02;
326:            }
327:
328:            public Date getCusTim03() {
329:                return cusTim03;
330:            }
331:
332:            //===============================================================
333:
334:            public void setStatus(Integer status) {
335:                this .status = status;
336:            }
337:
338:            public void setSeverity(Integer severity) {
339:                this .severity = severity;
340:            }
341:
342:            public void setPriority(Integer priority) {
343:                this .priority = priority;
344:            }
345:
346:            public void setCusInt01(Integer cusInt01) {
347:                this .cusInt01 = cusInt01;
348:            }
349:
350:            public void setCusInt02(Integer cusInt02) {
351:                this .cusInt02 = cusInt02;
352:            }
353:
354:            public void setCusInt03(Integer cusInt03) {
355:                this .cusInt03 = cusInt03;
356:            }
357:
358:            public void setCusInt04(Integer cusInt04) {
359:                this .cusInt04 = cusInt04;
360:            }
361:
362:            public void setCusInt05(Integer cusInt05) {
363:                this .cusInt05 = cusInt05;
364:            }
365:
366:            public void setCusInt06(Integer cusInt06) {
367:                this .cusInt06 = cusInt06;
368:            }
369:
370:            public void setCusInt07(Integer cusInt07) {
371:                this .cusInt07 = cusInt07;
372:            }
373:
374:            public void setCusInt08(Integer cusInt08) {
375:                this .cusInt08 = cusInt08;
376:            }
377:
378:            public void setCusInt09(Integer cusInt09) {
379:                this .cusInt09 = cusInt09;
380:            }
381:
382:            public void setCusInt10(Integer cusInt10) {
383:                this .cusInt10 = cusInt10;
384:            }
385:
386:            public void setCusDbl01(Double cusDbl01) {
387:                this .cusDbl01 = cusDbl01;
388:            }
389:
390:            public void setCusDbl02(Double cusDbl02) {
391:                this .cusDbl02 = cusDbl02;
392:            }
393:
394:            public void setCusDbl03(Double cusDbl03) {
395:                this .cusDbl03 = cusDbl03;
396:            }
397:
398:            public void setCusStr01(String cusStr01) {
399:                this .cusStr01 = cusStr01;
400:            }
401:
402:            public void setCusStr02(String cusStr02) {
403:                this .cusStr02 = cusStr02;
404:            }
405:
406:            public void setCusStr03(String cusStr03) {
407:                this .cusStr03 = cusStr03;
408:            }
409:
410:            public void setCusStr04(String cusStr04) {
411:                this .cusStr04 = cusStr04;
412:            }
413:
414:            public void setCusStr05(String cusStr05) {
415:                this .cusStr05 = cusStr05;
416:            }
417:
418:            public void setCusTim01(Date cusTim01) {
419:                this .cusTim01 = cusTim01;
420:            }
421:
422:            public void setCusTim02(Date cusTim02) {
423:                this .cusTim02 = cusTim02;
424:            }
425:
426:            public void setCusTim03(Date cusTim03) {
427:                this .cusTim03 = cusTim03;
428:            }
429:
430:            //=======================================================================
431:
432:            public long getId() {
433:                return id;
434:            }
435:
436:            public void setId(long id) {
437:                this .id = id;
438:            }
439:
440:            public int getVersion() {
441:                return version;
442:            }
443:
444:            public void setVersion(int version) {
445:                this .version = version;
446:            }
447:
448:            public Item getParent() {
449:                return parent;
450:            }
451:
452:            public void setParent(Item parent) {
453:                this .parent = parent;
454:            }
455:
456:            public String getSummary() {
457:                return summary;
458:            }
459:
460:            public void setSummary(String summary) {
461:                this .summary = summary;
462:            }
463:
464:            public String getDetail() {
465:                return detail;
466:            }
467:
468:            public void setDetail(String detail) {
469:                this .detail = detail;
470:            }
471:
472:            public User getLoggedBy() {
473:                return loggedBy;
474:            }
475:
476:            public void setLoggedBy(User loggedBy) {
477:                this .loggedBy = loggedBy;
478:            }
479:
480:            public User getAssignedTo() {
481:                return assignedTo;
482:            }
483:
484:            public void setAssignedTo(User assignedTo) {
485:                this .assignedTo = assignedTo;
486:            }
487:
488:            public Date getTimeStamp() {
489:                return timeStamp;
490:            }
491:
492:            public void setTimeStamp(Date timeStamp) {
493:                this .timeStamp = timeStamp;
494:            }
495:
496:            public Double getPlannedEffort() {
497:                return plannedEffort;
498:            }
499:
500:            public void setPlannedEffort(Double plannedEffort) {
501:                this .plannedEffort = plannedEffort;
502:            }
503:
504:            public boolean isSendNotifications() {
505:                return sendNotifications;
506:            }
507:
508:            public void setSendNotifications(boolean sendNotifications) {
509:                this .sendNotifications = sendNotifications;
510:            }
511:
512:            public Set<ItemUser> getItemUsers() {
513:                return itemUsers;
514:            }
515:
516:            public void setItemUsers(Set<ItemUser> itemUsers) {
517:                this .itemUsers = itemUsers;
518:            }
519:
520:            public Set<ItemItem> getRelatedItems() {
521:                return relatedItems;
522:            }
523:
524:            public void setRelatedItems(Set<ItemItem> relatedItems) {
525:                this .relatedItems = relatedItems;
526:            }
527:
528:            public Set<ItemItem> getRelatingItems() {
529:                return relatingItems;
530:            }
531:
532:            public void setRelatingItems(Set<ItemItem> relatingItems) {
533:                this .relatingItems = relatingItems;
534:            }
535:
536:            public Set<ItemTag> getItemTags() {
537:                return itemTags;
538:            }
539:
540:            public void setItemTags(Set<ItemTag> itemTags) {
541:                this .itemTags = itemTags;
542:            }
543:
544:            @Override
545:            public String toString() {
546:                StringBuffer sb = new StringBuffer();
547:                sb.append("id [").append(id);
548:                sb.append("]; parent [").append(
549:                        parent == null ? "" : parent.getId());
550:                sb.append("]; summary [").append(summary);
551:                sb.append("]; detail [").append(detail);
552:                sb.append("]; loggedBy [").append(loggedBy);
553:                sb.append("]; status [").append(status);
554:                sb.append("]; assignedTo [").append(assignedTo);
555:                sb.append("]; timeStamp [").append(timeStamp);
556:                sb.append("]; severity [").append(severity);
557:                sb.append("]; priority [").append(priority);
558:                sb.append("]; cusInt01 [").append(cusInt01);
559:                sb.append("]; cusInt02 [").append(cusInt02);
560:                sb.append("]; cusInt03 [").append(cusInt03);
561:                sb.append("]; cusInt04 [").append(cusInt04);
562:                sb.append("]; cusInt05 [").append(cusInt05);
563:                sb.append("]; cusInt06 [").append(cusInt06);
564:                sb.append("]; cusInt07 [").append(cusInt07);
565:                sb.append("]; cusInt08 [").append(cusInt08);
566:                sb.append("]; cusInt09 [").append(cusInt09);
567:                sb.append("]; cusInt10 [").append(cusInt10);
568:                sb.append("]; cusDbl01 [").append(cusDbl01);
569:                sb.append("]; cusDbl02 [").append(cusDbl02);
570:                sb.append("]; cusDbl03 [").append(cusDbl03);
571:                sb.append("]; cusStr01 [").append(cusStr01);
572:                sb.append("]; cusStr02 [").append(cusStr02);
573:                sb.append("]; cusStr03 [").append(cusStr03);
574:                sb.append("]; cusStr04 [").append(cusStr04);
575:                sb.append("]; cusStr05 [").append(cusStr05);
576:                sb.append("]; cusTim01 [").append(cusTim01);
577:                sb.append("]; cusTim02 [").append(cusTim02);
578:                sb.append("]; cusTim03 [").append(cusTim03);
579:                sb.append("]");
580:                return sb.toString();
581:            }
582:
583:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.