View Javadoc
1   /*
2    * Copyright 2012-2021 CodeLibs Project and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.codelibs.fess.es.log.bsentity;
17  
18  import java.time.LocalDateTime;
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import org.codelibs.fess.es.log.allcommon.EsAbstractEntity;
23  import org.codelibs.fess.es.log.bsentity.dbmeta.SearchLogDbm;
24  
25  /**
26   * ${table.comment}
27   * @author ESFlute (using FreeGen)
28   */
29  public class BsSearchLog extends EsAbstractEntity {
30  
31      // ===================================================================================
32      //                                                                          Definition
33      //                                                                          ==========
34      private static final long serialVersionUID = 1L;
35      protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
36  
37      // ===================================================================================
38      //                                                                           Attribute
39      //                                                                           =========
40      /** accessType */
41      protected String accessType;
42  
43      /** clientIp */
44      protected String clientIp;
45  
46      /** hitCount */
47      protected Long hitCount;
48  
49      /** hitCountRelation */
50      protected String hitCountRelation;
51  
52      /** languages */
53      protected String languages;
54  
55      /** queryId */
56      protected String queryId;
57  
58      /** queryOffset */
59      protected Integer queryOffset;
60  
61      /** queryPageSize */
62      protected Integer queryPageSize;
63  
64      /** queryTime */
65      protected Long queryTime;
66  
67      /** referer */
68      protected String referer;
69  
70      /** requestedAt */
71      protected LocalDateTime requestedAt;
72  
73      /** responseTime */
74      protected Long responseTime;
75  
76      /** roles */
77      protected String[] roles;
78  
79      /** searchWord */
80      protected String searchWord;
81  
82      /** user */
83      protected String user;
84  
85      /** userAgent */
86      protected String userAgent;
87  
88      /** userInfoId */
89      protected String userInfoId;
90  
91      /** userSessionId */
92      protected String userSessionId;
93  
94      /** virtualHost */
95      protected String virtualHost;
96  
97      // [Referrers] *comment only
98  
99      // ===================================================================================
100     //                                                                             DB Meta
101     //                                                                             =======
102     @Override
103     public SearchLogDbm asDBMeta() {
104         return SearchLogDbm.getInstance();
105     }
106 
107     @Override
108     public String asTableDbName() {
109         return "search_log";
110     }
111 
112     // ===================================================================================
113     //                                                                              Source
114     //                                                                              ======
115     @Override
116     public Map<String, Object> toSource() {
117         Map<String, Object> sourceMap = new HashMap<>();
118         if (accessType != null) {
119             addFieldToSource(sourceMap, "accessType", accessType);
120         }
121         if (clientIp != null) {
122             addFieldToSource(sourceMap, "clientIp", clientIp);
123         }
124         if (hitCount != null) {
125             addFieldToSource(sourceMap, "hitCount", hitCount);
126         }
127         if (hitCountRelation != null) {
128             addFieldToSource(sourceMap, "hitCountRelation", hitCountRelation);
129         }
130         if (languages != null) {
131             addFieldToSource(sourceMap, "languages", languages);
132         }
133         if (queryId != null) {
134             addFieldToSource(sourceMap, "queryId", queryId);
135         }
136         if (queryOffset != null) {
137             addFieldToSource(sourceMap, "queryOffset", queryOffset);
138         }
139         if (queryPageSize != null) {
140             addFieldToSource(sourceMap, "queryPageSize", queryPageSize);
141         }
142         if (queryTime != null) {
143             addFieldToSource(sourceMap, "queryTime", queryTime);
144         }
145         if (referer != null) {
146             addFieldToSource(sourceMap, "referer", referer);
147         }
148         if (requestedAt != null) {
149             addFieldToSource(sourceMap, "requestedAt", requestedAt);
150         }
151         if (responseTime != null) {
152             addFieldToSource(sourceMap, "responseTime", responseTime);
153         }
154         if (roles != null) {
155             addFieldToSource(sourceMap, "roles", roles);
156         }
157         if (searchWord != null) {
158             addFieldToSource(sourceMap, "searchWord", searchWord);
159         }
160         if (user != null) {
161             addFieldToSource(sourceMap, "user", user);
162         }
163         if (userAgent != null) {
164             addFieldToSource(sourceMap, "userAgent", userAgent);
165         }
166         if (userInfoId != null) {
167             addFieldToSource(sourceMap, "userInfoId", userInfoId);
168         }
169         if (userSessionId != null) {
170             addFieldToSource(sourceMap, "userSessionId", userSessionId);
171         }
172         if (virtualHost != null) {
173             addFieldToSource(sourceMap, "virtualHost", virtualHost);
174         }
175         return sourceMap;
176     }
177 
178     protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
179         sourceMap.put(field, value);
180     }
181 
182     // ===================================================================================
183     //                                                                      Basic Override
184     //                                                                      ==============
185     @Override
186     protected String doBuildColumnString(String dm) {
187         StringBuilder sb = new StringBuilder();
188         sb.append(dm).append(accessType);
189         sb.append(dm).append(clientIp);
190         sb.append(dm).append(hitCount);
191         sb.append(dm).append(hitCountRelation);
192         sb.append(dm).append(languages);
193         sb.append(dm).append(queryId);
194         sb.append(dm).append(queryOffset);
195         sb.append(dm).append(queryPageSize);
196         sb.append(dm).append(queryTime);
197         sb.append(dm).append(referer);
198         sb.append(dm).append(requestedAt);
199         sb.append(dm).append(responseTime);
200         sb.append(dm).append(roles);
201         sb.append(dm).append(searchWord);
202         sb.append(dm).append(user);
203         sb.append(dm).append(userAgent);
204         sb.append(dm).append(userInfoId);
205         sb.append(dm).append(userSessionId);
206         sb.append(dm).append(virtualHost);
207         if (sb.length() > dm.length()) {
208             sb.delete(0, dm.length());
209         }
210         sb.insert(0, "{").append("}");
211         return sb.toString();
212     }
213 
214     // ===================================================================================
215     //                                                                            Accessor
216     //                                                                            ========
217     public String getAccessType() {
218         checkSpecifiedProperty("accessType");
219         return convertEmptyToNull(accessType);
220     }
221 
222     public void setAccessType(String value) {
223         registerModifiedProperty("accessType");
224         this.accessType = value;
225     }
226 
227     public String getClientIp() {
228         checkSpecifiedProperty("clientIp");
229         return convertEmptyToNull(clientIp);
230     }
231 
232     public void setClientIp(String value) {
233         registerModifiedProperty("clientIp");
234         this.clientIp = value;
235     }
236 
237     public Long getHitCount() {
238         checkSpecifiedProperty("hitCount");
239         return hitCount;
240     }
241 
242     public void setHitCount(Long value) {
243         registerModifiedProperty("hitCount");
244         this.hitCount = value;
245     }
246 
247     public String getHitCountRelation() {
248         checkSpecifiedProperty("hitCountRelation");
249         return convertEmptyToNull(hitCountRelation);
250     }
251 
252     public void setHitCountRelation(String value) {
253         registerModifiedProperty("hitCountRelation");
254         this.hitCountRelation = value;
255     }
256 
257     public String getLanguages() {
258         checkSpecifiedProperty("languages");
259         return convertEmptyToNull(languages);
260     }
261 
262     public void setLanguages(String value) {
263         registerModifiedProperty("languages");
264         this.languages = value;
265     }
266 
267     public String getQueryId() {
268         checkSpecifiedProperty("queryId");
269         return convertEmptyToNull(queryId);
270     }
271 
272     public void setQueryId(String value) {
273         registerModifiedProperty("queryId");
274         this.queryId = value;
275     }
276 
277     public Integer getQueryOffset() {
278         checkSpecifiedProperty("queryOffset");
279         return queryOffset;
280     }
281 
282     public void setQueryOffset(Integer value) {
283         registerModifiedProperty("queryOffset");
284         this.queryOffset = value;
285     }
286 
287     public Integer getQueryPageSize() {
288         checkSpecifiedProperty("queryPageSize");
289         return queryPageSize;
290     }
291 
292     public void setQueryPageSize(Integer value) {
293         registerModifiedProperty("queryPageSize");
294         this.queryPageSize = value;
295     }
296 
297     public Long getQueryTime() {
298         checkSpecifiedProperty("queryTime");
299         return queryTime;
300     }
301 
302     public void setQueryTime(Long value) {
303         registerModifiedProperty("queryTime");
304         this.queryTime = value;
305     }
306 
307     public String getReferer() {
308         checkSpecifiedProperty("referer");
309         return convertEmptyToNull(referer);
310     }
311 
312     public void setReferer(String value) {
313         registerModifiedProperty("referer");
314         this.referer = value;
315     }
316 
317     public LocalDateTime getRequestedAt() {
318         checkSpecifiedProperty("requestedAt");
319         return requestedAt;
320     }
321 
322     public void setRequestedAt(LocalDateTime value) {
323         registerModifiedProperty("requestedAt");
324         this.requestedAt = value;
325     }
326 
327     public Long getResponseTime() {
328         checkSpecifiedProperty("responseTime");
329         return responseTime;
330     }
331 
332     public void setResponseTime(Long value) {
333         registerModifiedProperty("responseTime");
334         this.responseTime = value;
335     }
336 
337     public String[] getRoles() {
338         checkSpecifiedProperty("roles");
339         return roles;
340     }
341 
342     public void setRoles(String[] value) {
343         registerModifiedProperty("roles");
344         this.roles = value;
345     }
346 
347     public String getSearchWord() {
348         checkSpecifiedProperty("searchWord");
349         return convertEmptyToNull(searchWord);
350     }
351 
352     public void setSearchWord(String value) {
353         registerModifiedProperty("searchWord");
354         this.searchWord = value;
355     }
356 
357     public String getUser() {
358         checkSpecifiedProperty("user");
359         return convertEmptyToNull(user);
360     }
361 
362     public void setUser(String value) {
363         registerModifiedProperty("user");
364         this.user = value;
365     }
366 
367     public String getUserAgent() {
368         checkSpecifiedProperty("userAgent");
369         return convertEmptyToNull(userAgent);
370     }
371 
372     public void setUserAgent(String value) {
373         registerModifiedProperty("userAgent");
374         this.userAgent = value;
375     }
376 
377     public String getUserInfoId() {
378         checkSpecifiedProperty("userInfoId");
379         return convertEmptyToNull(userInfoId);
380     }
381 
382     public void setUserInfoId(String value) {
383         registerModifiedProperty("userInfoId");
384         this.userInfoId = value;
385     }
386 
387     public String getUserSessionId() {
388         checkSpecifiedProperty("userSessionId");
389         return convertEmptyToNull(userSessionId);
390     }
391 
392     public void setUserSessionId(String value) {
393         registerModifiedProperty("userSessionId");
394         this.userSessionId = value;
395     }
396 
397     public String getVirtualHost() {
398         checkSpecifiedProperty("virtualHost");
399         return convertEmptyToNull(virtualHost);
400     }
401 
402     public void setVirtualHost(String value) {
403         registerModifiedProperty("virtualHost");
404         this.virtualHost = value;
405     }
406 }