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