1 /*
2 * Copyright 2012-2017 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.WebConfigToRoleDbm;
24
25 /**
26 * ${table.comment}
27 * @author ESFlute (using FreeGen)
28 */
29 public class BsWebConfigToRole 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 /** roleTypeId */
41 protected String roleTypeId;
42
43 /** webConfigId */
44 protected String webConfigId;
45
46 // [Referrers] *comment only
47
48 // ===================================================================================
49 // DB Meta
50 // =======
51 @Override
52 public WebConfigToRoleDbm asDBMeta() {
53 return WebConfigToRoleDbm.getInstance();
54 }
55
56 @Override
57 public String asTableDbName() {
58 return "web_config_to_role";
59 }
60
61 // ===================================================================================
62 // Source
63 // ======
64 @Override
65 public Map<String, Object> toSource() {
66 Map<String, Object> sourceMap = new HashMap<>();
67 if (roleTypeId != null) {
68 addFieldToSource(sourceMap, "roleTypeId", roleTypeId);
69 }
70 if (webConfigId != null) {
71 addFieldToSource(sourceMap, "webConfigId", webConfigId);
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(roleTypeId);
87 sb.append(dm).append(webConfigId);
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 getRoleTypeId() {
99 checkSpecifiedProperty("roleTypeId");
100 return convertEmptyToNull(roleTypeId);
101 }
102
103 public void setRoleTypeId(String value) {
104 registerModifiedProperty("roleTypeId");
105 this.roleTypeId = value;
106 }
107
108 public String getWebConfigId() {
109 checkSpecifiedProperty("webConfigId");
110 return convertEmptyToNull(webConfigId);
111 }
112
113 public void setWebConfigId(String value) {
114 registerModifiedProperty("webConfigId");
115 this.webConfigId = value;
116 }
117 }