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.ElevateWordToLabelDbm;
24
25 /**
26 * ${table.comment}
27 * @author ESFlute (using FreeGen)
28 */
29 public class BsElevateWordToLabel 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 /** elevateWordId */
41 protected String elevateWordId;
42
43 /** labelTypeId */
44 protected String labelTypeId;
45
46 // [Referrers] *comment only
47
48 // ===================================================================================
49 // DB Meta
50 // =======
51 @Override
52 public ElevateWordToLabelDbm asDBMeta() {
53 return ElevateWordToLabelDbm.getInstance();
54 }
55
56 @Override
57 public String asTableDbName() {
58 return "elevate_word_to_label";
59 }
60
61 // ===================================================================================
62 // Source
63 // ======
64 @Override
65 public Map<String, Object> toSource() {
66 Map<String, Object> sourceMap = new HashMap<>();
67 if (elevateWordId != null) {
68 addFieldToSource(sourceMap, "elevateWordId", elevateWordId);
69 }
70 if (labelTypeId != null) {
71 addFieldToSource(sourceMap, "labelTypeId", labelTypeId);
72 }
73 return sourceMap;
74 }
75
76 protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
77 sourceMap.put(field, value);
78 }
79
80 // ===================================================================================
81 // Basic Override
82 // ==============
83 @Override
84 protected String doBuildColumnString(String dm) {
85 StringBuilder sb = new StringBuilder();
86 sb.append(dm).append(elevateWordId);
87 sb.append(dm).append(labelTypeId);
88 if (sb.length() > dm.length()) {
89 sb.delete(0, dm.length());
90 }
91 sb.insert(0, "{").append("}");
92 return sb.toString();
93 }
94
95 // ===================================================================================
96 // Accessor
97 // ========
98 public String getElevateWordId() {
99 checkSpecifiedProperty("elevateWordId");
100 return convertEmptyToNull(elevateWordId);
101 }
102
103 public void setElevateWordId(String value) {
104 registerModifiedProperty("elevateWordId");
105 this.elevateWordId = value;
106 }
107
108 public String getLabelTypeId() {
109 checkSpecifiedProperty("labelTypeId");
110 return convertEmptyToNull(labelTypeId);
111 }
112
113 public void setLabelTypeId(String value) {
114 registerModifiedProperty("labelTypeId");
115 this.labelTypeId = value;
116 }
117 }