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.user.bsentity;
17
18 import java.time.LocalDateTime;
19 import java.util.HashMap;
20 import java.util.Map;
21
22 import org.codelibs.fess.opensearch.user.allcommon.EsAbstractEntity;
23 import org.codelibs.fess.opensearch.user.bsentity.dbmeta.GroupDbm;
24
25 /**
26 * ${table.comment}
27 * @author ESFlute (using FreeGen)
28 */
29 public class BsGroup 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 /** gidNumber */
41 protected Long gidNumber;
42
43 /** name */
44 protected String name;
45
46 // [Referrers] *comment only
47
48 // ===================================================================================
49 // DB Meta
50 // =======
51 @Override
52 public GroupDbm asDBMeta() {
53 return GroupDbm.getInstance();
54 }
55
56 @Override
57 public String asTableDbName() {
58 return "group";
59 }
60
61 // ===================================================================================
62 // Source
63 // ======
64 @Override
65 public Map<String, Object> toSource() {
66 Map<String, Object> sourceMap = new HashMap<>();
67 if (gidNumber != null) {
68 addFieldToSource(sourceMap, "gidNumber", gidNumber);
69 }
70 if (name != null) {
71 addFieldToSource(sourceMap, "name", name);
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(gidNumber);
87 sb.append(dm).append(name);
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 Long getGidNumber() {
99 checkSpecifiedProperty("gidNumber");
100 return gidNumber;
101 }
102
103 public void setGidNumber(Long value) {
104 registerModifiedProperty("gidNumber");
105 this.gidNumber = value;
106 }
107
108 public String getName() {
109 checkSpecifiedProperty("name");
110 return convertEmptyToNull(name);
111 }
112
113 public void setName(String value) {
114 registerModifiedProperty("name");
115 this.name = value;
116 }
117 }