View Javadoc
1   package org.exoplatform.wiki.service.search;
2   
3   import java.util.Calendar;
4   
5   import org.exoplatform.commons.utils.HTMLSanitizer;
6   import org.exoplatform.services.log.ExoLogger;
7   import org.exoplatform.services.log.Log;
8   
9   public class SearchResult {
10    private static Log         log = ExoLogger.getLogger(SearchResult.class);
11  
12    protected String           wikiType;
13  
14    protected String           wikiOwner;
15  
16    protected String           pageName;
17  
18    protected String           attachmentName;
19  
20    protected String           excerpt;
21  
22    protected String           title;
23  
24    protected SearchResultType type;
25  
26    protected String           url;
27  
28    protected long             score;
29  
30    protected Calendar         updatedDate;
31  
32    protected Calendar         createdDate;
33  
34    public SearchResult() {
35    }
36  
37    public SearchResult(String wikiType,
38                        String wikiOwner,
39                        String pageName,
40                        String attachmentName,
41                        String excerpt,
42                        String title,
43                        SearchResultType type,
44                        Calendar updatedDate,
45                        Calendar createdDate) {
46      this.wikiType = wikiType;
47      this.wikiOwner = wikiOwner;
48      this.pageName = pageName;
49      this.attachmentName = attachmentName;
50      this.excerpt = excerpt;
51      this.title = title;
52      this.type = type;
53      this.updatedDate = updatedDate;
54      this.createdDate = createdDate;
55    }
56  
57    public String getWikiType() {
58      return wikiType;
59    }
60  
61    public void setWikiType(String wikiType) {
62      this.wikiType = wikiType;
63    }
64  
65    public String getWikiOwner() {
66      return wikiOwner;
67    }
68  
69    public void setWikiOwner(String wikiOwner) {
70      this.wikiOwner = wikiOwner;
71    }
72  
73    public String getPageName() {
74      return pageName;
75    }
76  
77    public void setPageName(String pageName) {
78      this.pageName = pageName;
79    }
80  
81    public String getAttachmentName() {
82      return attachmentName;
83    }
84  
85    public void setAttachmentName(String attachmentName) {
86      this.attachmentName = attachmentName;
87    }
88  
89    public String getTitle() {
90      return title;
91    }
92  
93    public void setTitle(String title) {
94      this.title = title;
95    }
96  
97    public String getExcerpt() {
98      try {
99        return HTMLSanitizer.sanitize(excerpt);
100     } catch (Exception e) {
101 
102       log.error("Fail to sanitize input [" + excerpt + "], " + e.getMessage(), e);
103 
104     }
105     return "";
106   }
107 
108   public void setExcerpt(String text) {
109     this.excerpt = text;
110   }
111 
112   public SearchResultType getType() {
113     return type;
114   }
115 
116   public void setType(SearchResultType type) {
117     this.type = type;
118   }
119 
120   public String getUrl() {
121     return url;
122   }
123 
124   public void setUrl(String url) {
125     this.url = url;
126   }
127 
128   public long getScore() {
129     return score;
130   }
131 
132   public void setScore(long score) {
133     this.score = score;
134   }
135 
136   public Calendar getUpdatedDate() {
137     return updatedDate;
138   }
139 
140   public void setUpdatedDate(Calendar updatedDate) {
141     this.updatedDate = updatedDate;
142   }
143 
144   /**
145    * @return the createdDate
146    */
147   public Calendar getCreatedDate() {
148     return createdDate;
149   }
150 
151   /**
152    * @param createdDate the createdDate to set
153    */
154   public void setCreatedDate(Calendar createdDate) {
155     this.createdDate = createdDate;
156   }
157 }