View Javadoc
1   /*
2    * Copyright 2012-2025 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.opensearch.config.bsentity;
17  
18  import java.time.LocalDateTime;
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import org.codelibs.fess.opensearch.config.allcommon.EsAbstractEntity;
23  import org.codelibs.fess.opensearch.config.bsentity.dbmeta.KeyMatchDbm;
24  
25  /**
26   * ${table.comment}
27   * @author ESFlute (using FreeGen)
28   */
29  public class BsKeyMatch 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      /** boost */
41      protected Float boost;
42  
43      /** createdBy */
44      protected String createdBy;
45  
46      /** createdTime */
47      protected Long createdTime;
48  
49      /** maxSize */
50      protected Integer maxSize;
51  
52      /** query */
53      protected String query;
54  
55      /** term */
56      protected String term;
57  
58      /** updatedBy */
59      protected String updatedBy;
60  
61      /** updatedTime */
62      protected Long updatedTime;
63  
64      /** virtualHost */
65      protected String virtualHost;
66  
67      // [Referrers] *comment only
68  
69      // ===================================================================================
70      //                                                                             DB Meta
71      //                                                                             =======
72      @Override
73      public KeyMatchDbm asDBMeta() {
74          return KeyMatchDbm.getInstance();
75      }
76  
77      @Override
78      public String asTableDbName() {
79          return "key_match";
80      }
81  
82      // ===================================================================================
83      //                                                                              Source
84      //                                                                              ======
85      @Override
86      public Map<String, Object> toSource() {
87          Map<String, Object> sourceMap = new HashMap<>();
88          if (boost != null) {
89              addFieldToSource(sourceMap, "boost", boost);
90          }
91          if (createdBy != null) {
92              addFieldToSource(sourceMap, "createdBy", createdBy);
93          }
94          if (createdTime != null) {
95              addFieldToSource(sourceMap, "createdTime", createdTime);
96          }
97          if (maxSize != null) {
98              addFieldToSource(sourceMap, "maxSize", maxSize);
99          }
100         if (query != null) {
101             addFieldToSource(sourceMap, "query", query);
102         }
103         if (term != null) {
104             addFieldToSource(sourceMap, "term", term);
105         }
106         if (updatedBy != null) {
107             addFieldToSource(sourceMap, "updatedBy", updatedBy);
108         }
109         if (updatedTime != null) {
110             addFieldToSource(sourceMap, "updatedTime", updatedTime);
111         }
112         if (virtualHost != null) {
113             addFieldToSource(sourceMap, "virtualHost", virtualHost);
114         }
115         return sourceMap;
116     }
117 
118     protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
119         sourceMap.put(field, value);
120     }
121 
122     // ===================================================================================
123     //                                                                      Basic Override
124     //                                                                      ==============
125     @Override
126     protected String doBuildColumnString(String dm) {
127         StringBuilder sb = new StringBuilder();
128         sb.append(dm).append(boost);
129         sb.append(dm).append(createdBy);
130         sb.append(dm).append(createdTime);
131         sb.append(dm).append(maxSize);
132         sb.append(dm).append(query);
133         sb.append(dm).append(term);
134         sb.append(dm).append(updatedBy);
135         sb.append(dm).append(updatedTime);
136         sb.append(dm).append(virtualHost);
137         if (sb.length() > dm.length()) {
138             sb.delete(0, dm.length());
139         }
140         sb.insert(0, "{").append("}");
141         return sb.toString();
142     }
143 
144     // ===================================================================================
145     //                                                                            Accessor
146     //                                                                            ========
147     public Float getBoost() {
148         checkSpecifiedProperty("boost");
149         return boost;
150     }
151 
152     public void setBoost(Float value) {
153         registerModifiedProperty("boost");
154         this.boost = value;
155     }
156 
157     public String getCreatedBy() {
158         checkSpecifiedProperty("createdBy");
159         return convertEmptyToNull(createdBy);
160     }
161 
162     public void setCreatedBy(String value) {
163         registerModifiedProperty("createdBy");
164         this.createdBy = value;
165     }
166 
167     public Long getCreatedTime() {
168         checkSpecifiedProperty("createdTime");
169         return createdTime;
170     }
171 
172     public void setCreatedTime(Long value) {
173         registerModifiedProperty("createdTime");
174         this.createdTime = value;
175     }
176 
177     public Integer getMaxSize() {
178         checkSpecifiedProperty("maxSize");
179         return maxSize;
180     }
181 
182     public void setMaxSize(Integer value) {
183         registerModifiedProperty("maxSize");
184         this.maxSize = value;
185     }
186 
187     public String getQuery() {
188         checkSpecifiedProperty("query");
189         return convertEmptyToNull(query);
190     }
191 
192     public void setQuery(String value) {
193         registerModifiedProperty("query");
194         this.query = value;
195     }
196 
197     public String getTerm() {
198         checkSpecifiedProperty("term");
199         return convertEmptyToNull(term);
200     }
201 
202     public void setTerm(String value) {
203         registerModifiedProperty("term");
204         this.term = value;
205     }
206 
207     public String getUpdatedBy() {
208         checkSpecifiedProperty("updatedBy");
209         return convertEmptyToNull(updatedBy);
210     }
211 
212     public void setUpdatedBy(String value) {
213         registerModifiedProperty("updatedBy");
214         this.updatedBy = value;
215     }
216 
217     public Long getUpdatedTime() {
218         checkSpecifiedProperty("updatedTime");
219         return updatedTime;
220     }
221 
222     public void setUpdatedTime(Long value) {
223         registerModifiedProperty("updatedTime");
224         this.updatedTime = value;
225     }
226 
227     public String getVirtualHost() {
228         checkSpecifiedProperty("virtualHost");
229         return convertEmptyToNull(virtualHost);
230     }
231 
232     public void setVirtualHost(String value) {
233         registerModifiedProperty("virtualHost");
234         this.virtualHost = value;
235     }
236 }