1 package org.robsite.extension.rss.model;
2 import java.util.Date;
3 import oracle.ide.model.DefaultElement;
4 import oracle.ide.model.Element;
5
6 public class Item extends DefaultElement
7 {
8 private String _title;
9 private String _link;
10 private String _description;
11 private boolean _read;
12 private Date _pubDate;
13 private String _guid;
14
15
16 public Item()
17 {
18 }
19
20 public String getGuid()
21 {
22 if ( _guid == null )
23 {
24 return getLink();
25 }
26 return _guid;
27 }
28
29 public void setGuid( String guid )
30 {
31 _guid = guid;
32 }
33
34 public void setPublishDate( Date date )
35 {
36 _pubDate = date;
37 }
38
39 public Date getPublishDate()
40 {
41 return _pubDate;
42 }
43
44 public void setTitle( String title )
45 {
46 _title = title;
47 }
48
49
50 public String getTitle()
51 {
52 return _title;
53 }
54
55
56 public void setLink( String link )
57 {
58 _link = link;
59 }
60
61
62 public String getLink()
63 {
64 return _link;
65 }
66
67
68 public void setDescription( String description )
69 {
70 _description = description;
71 }
72
73
74 public String getDescription()
75 {
76 return _description;
77 }
78
79
80 public void setRead( boolean read )
81 {
82 _read = read;
83 }
84
85
86 public boolean isRead()
87 {
88 return _read;
89 }
90
91
92 public String dumpString()
93 {
94 return "[Item] {PubDate: " + String.valueOf( _pubDate ) + "} {Title: " + _title + "} {Link: " + _link + "} {Description: " + _description + "}\n";
95 }
96
97
98 public String toString()
99 {
100 if ( _title == null || _title.length() == 0 )
101 {
102 if ( _description == null || _description.length() == 0 )
103 {
104 return "(none)";
105 }
106 return _description.substring( 0, 60 );
107 }
108 return _title;
109 }
110
111
112 public int hashCode()
113 {
114 if ( _link != null )
115 {
116 return _link.hashCode();
117 }
118 if ( _title != null )
119 {
120 return _title.hashCode();
121 }
122 return super.hashCode();
123 }
124
125
126 public boolean equals( Object obj )
127 {
128 if ( obj instanceof Item )
129 {
130 Item other = ( Item ) obj;
131 if ( _link != null && other._link != null )
132 {
133 return _link.equals( other._link );
134 }
135 else if ( _title != null && other._title != null )
136 {
137 return _title.equals( other._title );
138 }
139 }
140 return false;
141 }
142
143 }