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.LabelTypeDbm;
24  
25  /**
26   * ${table.comment}
27   * @author ESFlute (using FreeGen)
28   */
29  public class BsLabelType 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      /** createdBy */
41      protected String createdBy;
42  
43      /** createdTime */
44      protected Long createdTime;
45  
46      /** excludedPaths */
47      protected String excludedPaths;
48  
49      /** includedPaths */
50      protected String includedPaths;
51  
52      /** name */
53      protected String name;
54  
55      /** permissions */
56      protected String[] permissions;
57  
58      /** sortOrder */
59      protected Integer sortOrder;
60  
61      /** updatedBy */
62      protected String updatedBy;
63  
64      /** updatedTime */
65      protected Long updatedTime;
66  
67      /** value */
68      protected String value;
69  
70      /** virtualHost */
71      protected String virtualHost;
72  
73      // [Referrers] *comment only
74  
75      // ===================================================================================
76      //                                                                             DB Meta
77      //                                                                             =======
78      @Override
79      public LabelTypeDbm asDBMeta() {
80          return LabelTypeDbm.getInstance();
81      }
82  
83      @Override
84      public String asTableDbName() {
85          return "label_type";
86      }
87  
88      // ===================================================================================
89      //                                                                              Source
90      //                                                                              ======
91      @Override
92      public Map<String, Object> toSource() {
93          Map<String, Object> sourceMap = new HashMap<>();
94          if (createdBy != null) {
95              addFieldToSource(sourceMap, "createdBy", createdBy);
96          }
97          if (createdTime != null) {
98              addFieldToSource(sourceMap, "createdTime", createdTime);
99          }
100         if (excludedPaths != null) {
101             addFieldToSource(sourceMap, "excludedPaths", excludedPaths);
102         }
103         if (includedPaths != null) {
104             addFieldToSource(sourceMap, "includedPaths", includedPaths);
105         }
106         if (name != null) {
107             addFieldToSource(sourceMap, "name", name);
108         }
109         if (permissions != null) {
110             addFieldToSource(sourceMap, "permissions", permissions);
111         }
112         if (sortOrder != null) {
113             addFieldToSource(sourceMap, "sortOrder", sortOrder);
114         }
115         if (updatedBy != null) {
116             addFieldToSource(sourceMap, "updatedBy", updatedBy);
117         }
118         if (updatedTime != null) {
119             addFieldToSource(sourceMap, "updatedTime", updatedTime);
120         }
121         if (value != null) {
122             addFieldToSource(sourceMap, "value", value);
123         }
124         if (virtualHost != null) {
125             addFieldToSource(sourceMap, "virtualHost", virtualHost);
126         }
127         return sourceMap;
128     }
129 
130     protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
131         sourceMap.put(field, value);
132     }
133 
134     // ===================================================================================
135     //                                                                      Basic Override
136     //                                                                      ==============
137     @Override
138     protected String doBuildColumnString(String dm) {
139         StringBuilder sb = new StringBuilder();
140         sb.append(dm).append(createdBy);
141         sb.append(dm).append(createdTime);
142         sb.append(dm).append(excludedPaths);
143         sb.append(dm).append(includedPaths);
144         sb.append(dm).append(name);
145         sb.append(dm).append(permissions);
146         sb.append(dm).append(sortOrder);
147         sb.append(dm).append(updatedBy);
148         sb.append(dm).append(updatedTime);
149         sb.append(dm).append(value);
150         sb.append(dm).append(virtualHost);
151         if (sb.length() > dm.length()) {
152             sb.delete(0, dm.length());
153         }
154         sb.insert(0, "{").append("}");
155         return sb.toString();
156     }
157 
158     // ===================================================================================
159     //                                                                            Accessor
160     //                                                                            ========
161     public String getCreatedBy() {
162         checkSpecifiedProperty("createdBy");
163         return convertEmptyToNull(createdBy);
164     }
165 
166     public void setCreatedBy(String value) {
167         registerModifiedProperty("createdBy");
168         this.createdBy = value;
169     }
170 
171     public Long getCreatedTime() {
172         checkSpecifiedProperty("createdTime");
173         return createdTime;
174     }
175 
176     public void setCreatedTime(Long value) {
177         registerModifiedProperty("createdTime");
178         this.createdTime = value;
179     }
180 
181     public String getExcludedPaths() {
182         checkSpecifiedProperty("excludedPaths");
183         return convertEmptyToNull(excludedPaths);
184     }
185 
186     public void setExcludedPaths(String value) {
187         registerModifiedProperty("excludedPaths");
188         this.excludedPaths = value;
189     }
190 
191     public String getIncludedPaths() {
192         checkSpecifiedProperty("includedPaths");
193         return convertEmptyToNull(includedPaths);
194     }
195 
196     public void setIncludedPaths(String value) {
197         registerModifiedProperty("includedPaths");
198         this.includedPaths = value;
199     }
200 
201     public String getName() {
202         checkSpecifiedProperty("name");
203         return convertEmptyToNull(name);
204     }
205 
206     public void setName(String value) {
207         registerModifiedProperty("name");
208         this.name = value;
209     }
210 
211     public String[] getPermissions() {
212         checkSpecifiedProperty("permissions");
213         return permissions;
214     }
215 
216     public void setPermissions(String[] value) {
217         registerModifiedProperty("permissions");
218         this.permissions = value;
219     }
220 
221     public Integer getSortOrder() {
222         checkSpecifiedProperty("sortOrder");
223         return sortOrder;
224     }
225 
226     public void setSortOrder(Integer value) {
227         registerModifiedProperty("sortOrder");
228         this.sortOrder = value;
229     }
230 
231     public String getUpdatedBy() {
232         checkSpecifiedProperty("updatedBy");
233         return convertEmptyToNull(updatedBy);
234     }
235 
236     public void setUpdatedBy(String value) {
237         registerModifiedProperty("updatedBy");
238         this.updatedBy = value;
239     }
240 
241     public Long getUpdatedTime() {
242         checkSpecifiedProperty("updatedTime");
243         return updatedTime;
244     }
245 
246     public void setUpdatedTime(Long value) {
247         registerModifiedProperty("updatedTime");
248         this.updatedTime = value;
249     }
250 
251     public String getValue() {
252         checkSpecifiedProperty("value");
253         return convertEmptyToNull(value);
254     }
255 
256     public void setValue(String value) {
257         registerModifiedProperty("value");
258         this.value = value;
259     }
260 
261     public String getVirtualHost() {
262         checkSpecifiedProperty("virtualHost");
263         return convertEmptyToNull(virtualHost);
264     }
265 
266     public void setVirtualHost(String value) {
267         registerModifiedProperty("virtualHost");
268         this.virtualHost = value;
269     }
270 }