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