View Javadoc
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.config.bsentity;
17  
18  import java.time.LocalDateTime;
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import org.codelibs.fess.opensearch.config.allcommon.EsAbstractEntity;
23  import org.codelibs.fess.opensearch.config.bsentity.dbmeta.FailureUrlDbm;
24  
25  /**
26   * ${table.comment}
27   * @author ESFlute (using FreeGen)
28   */
29  public class BsFailureUrl 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      /** configId */
41      protected String configId;
42  
43      /** errorCount */
44      protected Integer errorCount;
45  
46      /** errorLog */
47      protected String errorLog;
48  
49      /** errorName */
50      protected String errorName;
51  
52      /** lastAccessTime */
53      protected Long lastAccessTime;
54  
55      /** threadName */
56      protected String threadName;
57  
58      /** url */
59      protected String url;
60  
61      // [Referrers] *comment only
62  
63      // ===================================================================================
64      //                                                                             DB Meta
65      //                                                                             =======
66      @Override
67      public FailureUrlDbm asDBMeta() {
68          return FailureUrlDbm.getInstance();
69      }
70  
71      @Override
72      public String asTableDbName() {
73          return "failure_url";
74      }
75  
76      // ===================================================================================
77      //                                                                              Source
78      //                                                                              ======
79      @Override
80      public Map<String, Object> toSource() {
81          Map<String, Object> sourceMap = new HashMap<>();
82          if (configId != null) {
83              addFieldToSource(sourceMap, "configId", configId);
84          }
85          if (errorCount != null) {
86              addFieldToSource(sourceMap, "errorCount", errorCount);
87          }
88          if (errorLog != null) {
89              addFieldToSource(sourceMap, "errorLog", errorLog);
90          }
91          if (errorName != null) {
92              addFieldToSource(sourceMap, "errorName", errorName);
93          }
94          if (lastAccessTime != null) {
95              addFieldToSource(sourceMap, "lastAccessTime", lastAccessTime);
96          }
97          if (threadName != null) {
98              addFieldToSource(sourceMap, "threadName", threadName);
99          }
100         if (url != null) {
101             addFieldToSource(sourceMap, "url", url);
102         }
103         return sourceMap;
104     }
105 
106     protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
107         sourceMap.put(field, value);
108     }
109 
110     // ===================================================================================
111     //                                                                      Basic Override
112     //                                                                      ==============
113     @Override
114     protected String doBuildColumnString(String dm) {
115         StringBuilder sb = new StringBuilder();
116         sb.append(dm).append(configId);
117         sb.append(dm).append(errorCount);
118         sb.append(dm).append(errorLog);
119         sb.append(dm).append(errorName);
120         sb.append(dm).append(lastAccessTime);
121         sb.append(dm).append(threadName);
122         sb.append(dm).append(url);
123         if (sb.length() > dm.length()) {
124             sb.delete(0, dm.length());
125         }
126         sb.insert(0, "{").append("}");
127         return sb.toString();
128     }
129 
130     // ===================================================================================
131     //                                                                            Accessor
132     //                                                                            ========
133     public String getConfigId() {
134         checkSpecifiedProperty("configId");
135         return convertEmptyToNull(configId);
136     }
137 
138     public void setConfigId(String value) {
139         registerModifiedProperty("configId");
140         this.configId = value;
141     }
142 
143     public Integer getErrorCount() {
144         checkSpecifiedProperty("errorCount");
145         return errorCount;
146     }
147 
148     public void setErrorCount(Integer value) {
149         registerModifiedProperty("errorCount");
150         this.errorCount = value;
151     }
152 
153     public String getErrorLog() {
154         checkSpecifiedProperty("errorLog");
155         return convertEmptyToNull(errorLog);
156     }
157 
158     public void setErrorLog(String value) {
159         registerModifiedProperty("errorLog");
160         this.errorLog = value;
161     }
162 
163     public String getErrorName() {
164         checkSpecifiedProperty("errorName");
165         return convertEmptyToNull(errorName);
166     }
167 
168     public void setErrorName(String value) {
169         registerModifiedProperty("errorName");
170         this.errorName = value;
171     }
172 
173     public Long getLastAccessTime() {
174         checkSpecifiedProperty("lastAccessTime");
175         return lastAccessTime;
176     }
177 
178     public void setLastAccessTime(Long value) {
179         registerModifiedProperty("lastAccessTime");
180         this.lastAccessTime = value;
181     }
182 
183     public String getThreadName() {
184         checkSpecifiedProperty("threadName");
185         return convertEmptyToNull(threadName);
186     }
187 
188     public void setThreadName(String value) {
189         registerModifiedProperty("threadName");
190         this.threadName = value;
191     }
192 
193     public String getUrl() {
194         checkSpecifiedProperty("url");
195         return convertEmptyToNull(url);
196     }
197 
198     public void setUrl(String value) {
199         registerModifiedProperty("url");
200         this.url = value;
201     }
202 }