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.FavoriteLogDbm;
24  
25  /**
26   * ${table.comment}
27   * @author ESFlute (using FreeGen)
28   */
29  public class BsFavoriteLog 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      /** createdAt */
41      protected LocalDateTime createdAt;
42  
43      /** docId */
44      protected String docId;
45  
46      /** queryId */
47      protected String queryId;
48  
49      /** url */
50      protected String url;
51  
52      /** userInfoId */
53      protected String userInfoId;
54  
55      // [Referrers] *comment only
56  
57      // ===================================================================================
58      //                                                                             DB Meta
59      //                                                                             =======
60      @Override
61      public FavoriteLogDbm asDBMeta() {
62          return FavoriteLogDbm.getInstance();
63      }
64  
65      @Override
66      public String asTableDbName() {
67          return "favorite_log";
68      }
69  
70      // ===================================================================================
71      //                                                                              Source
72      //                                                                              ======
73      @Override
74      public Map<String, Object> toSource() {
75          Map<String, Object> sourceMap = new HashMap<>();
76          if (createdAt != null) {
77              addFieldToSource(sourceMap, "createdAt", createdAt);
78          }
79          if (docId != null) {
80              addFieldToSource(sourceMap, "docId", docId);
81          }
82          if (queryId != null) {
83              addFieldToSource(sourceMap, "queryId", queryId);
84          }
85          if (url != null) {
86              addFieldToSource(sourceMap, "url", url);
87          }
88          if (userInfoId != null) {
89              addFieldToSource(sourceMap, "userInfoId", userInfoId);
90          }
91          return sourceMap;
92      }
93  
94      protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
95          sourceMap.put(field, value);
96      }
97  
98      // ===================================================================================
99      //                                                                      Basic Override
100     //                                                                      ==============
101     @Override
102     protected String doBuildColumnString(String dm) {
103         StringBuilder sb = new StringBuilder();
104         sb.append(dm).append(createdAt);
105         sb.append(dm).append(docId);
106         sb.append(dm).append(queryId);
107         sb.append(dm).append(url);
108         sb.append(dm).append(userInfoId);
109         if (sb.length() > dm.length()) {
110             sb.delete(0, dm.length());
111         }
112         sb.insert(0, "{").append("}");
113         return sb.toString();
114     }
115 
116     // ===================================================================================
117     //                                                                            Accessor
118     //                                                                            ========
119     public LocalDateTime getCreatedAt() {
120         checkSpecifiedProperty("createdAt");
121         return createdAt;
122     }
123 
124     public void setCreatedAt(LocalDateTime value) {
125         registerModifiedProperty("createdAt");
126         this.createdAt = value;
127     }
128 
129     public String getDocId() {
130         checkSpecifiedProperty("docId");
131         return convertEmptyToNull(docId);
132     }
133 
134     public void setDocId(String value) {
135         registerModifiedProperty("docId");
136         this.docId = value;
137     }
138 
139     public String getQueryId() {
140         checkSpecifiedProperty("queryId");
141         return convertEmptyToNull(queryId);
142     }
143 
144     public void setQueryId(String value) {
145         registerModifiedProperty("queryId");
146         this.queryId = value;
147     }
148 
149     public String getUrl() {
150         checkSpecifiedProperty("url");
151         return convertEmptyToNull(url);
152     }
153 
154     public void setUrl(String value) {
155         registerModifiedProperty("url");
156         this.url = value;
157     }
158 
159     public String getUserInfoId() {
160         checkSpecifiedProperty("userInfoId");
161         return convertEmptyToNull(userInfoId);
162     }
163 
164     public void setUserInfoId(String value) {
165         registerModifiedProperty("userInfoId");
166         this.userInfoId = value;
167     }
168 }