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.CrawlingInfoDbm;
24
25 /**
26 * ${table.comment}
27 * @author ESFlute (using FreeGen)
28 */
29 public class BsCrawlingInfo 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 /** createdTime */
41 protected Long createdTime;
42
43 /** expiredTime */
44 protected Long expiredTime;
45
46 /** name */
47 protected String name;
48
49 /** sessionId */
50 protected String sessionId;
51
52 // [Referrers] *comment only
53
54 // ===================================================================================
55 // DB Meta
56 // =======
57 @Override
58 public CrawlingInfoDbm asDBMeta() {
59 return CrawlingInfoDbm.getInstance();
60 }
61
62 @Override
63 public String asTableDbName() {
64 return "crawling_info";
65 }
66
67 // ===================================================================================
68 // Source
69 // ======
70 @Override
71 public Map<String, Object> toSource() {
72 Map<String, Object> sourceMap = new HashMap<>();
73 if (createdTime != null) {
74 addFieldToSource(sourceMap, "createdTime", createdTime);
75 }
76 if (expiredTime != null) {
77 addFieldToSource(sourceMap, "expiredTime", expiredTime);
78 }
79 if (name != null) {
80 addFieldToSource(sourceMap, "name", name);
81 }
82 if (sessionId != null) {
83 addFieldToSource(sourceMap, "sessionId", sessionId);
84 }
85 return sourceMap;
86 }
87
88 protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
89 sourceMap.put(field, value);
90 }
91
92 // ===================================================================================
93 // Basic Override
94 // ==============
95 @Override
96 protected String doBuildColumnString(String dm) {
97 StringBuilder sb = new StringBuilder();
98 sb.append(dm).append(createdTime);
99 sb.append(dm).append(expiredTime);
100 sb.append(dm).append(name);
101 sb.append(dm).append(sessionId);
102 if (sb.length() > dm.length()) {
103 sb.delete(0, dm.length());
104 }
105 sb.insert(0, "{").append("}");
106 return sb.toString();
107 }
108
109 // ===================================================================================
110 // Accessor
111 // ========
112 public Long getCreatedTime() {
113 checkSpecifiedProperty("createdTime");
114 return createdTime;
115 }
116
117 public void setCreatedTime(Long value) {
118 registerModifiedProperty("createdTime");
119 this.createdTime = value;
120 }
121
122 public Long getExpiredTime() {
123 checkSpecifiedProperty("expiredTime");
124 return expiredTime;
125 }
126
127 public void setExpiredTime(Long value) {
128 registerModifiedProperty("expiredTime");
129 this.expiredTime = value;
130 }
131
132 public String getName() {
133 checkSpecifiedProperty("name");
134 return convertEmptyToNull(name);
135 }
136
137 public void setName(String value) {
138 registerModifiedProperty("name");
139 this.name = value;
140 }
141
142 public String getSessionId() {
143 checkSpecifiedProperty("sessionId");
144 return convertEmptyToNull(sessionId);
145 }
146
147 public void setSessionId(String value) {
148 registerModifiedProperty("sessionId");
149 this.sessionId = value;
150 }
151 }