View Javadoc
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.JobLogDbm;
24  
25  /**
26   * ${table.comment}
27   * @author ESFlute (using FreeGen)
28   */
29  public class BsJobLog 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      /** endTime */
41      protected Long endTime;
42  
43      /** jobName */
44      protected String jobName;
45  
46      /** jobStatus */
47      protected String jobStatus;
48  
49      /** lastUpdated */
50      protected Long lastUpdated;
51  
52      /** scriptData */
53      protected String scriptData;
54  
55      /** scriptResult */
56      protected String scriptResult;
57  
58      /** scriptType */
59      protected String scriptType;
60  
61      /** startTime */
62      protected Long startTime;
63  
64      /** target */
65      protected String target;
66  
67      // [Referrers] *comment only
68  
69      // ===================================================================================
70      //                                                                             DB Meta
71      //                                                                             =======
72      @Override
73      public JobLogDbm asDBMeta() {
74          return JobLogDbm.getInstance();
75      }
76  
77      @Override
78      public String asTableDbName() {
79          return "job_log";
80      }
81  
82      // ===================================================================================
83      //                                                                              Source
84      //                                                                              ======
85      @Override
86      public Map<String, Object> toSource() {
87          Map<String, Object> sourceMap = new HashMap<>();
88          if (endTime != null) {
89              addFieldToSource(sourceMap, "endTime", endTime);
90          }
91          if (jobName != null) {
92              addFieldToSource(sourceMap, "jobName", jobName);
93          }
94          if (jobStatus != null) {
95              addFieldToSource(sourceMap, "jobStatus", jobStatus);
96          }
97          if (lastUpdated != null) {
98              addFieldToSource(sourceMap, "lastUpdated", lastUpdated);
99          }
100         if (scriptData != null) {
101             addFieldToSource(sourceMap, "scriptData", scriptData);
102         }
103         if (scriptResult != null) {
104             addFieldToSource(sourceMap, "scriptResult", scriptResult);
105         }
106         if (scriptType != null) {
107             addFieldToSource(sourceMap, "scriptType", scriptType);
108         }
109         if (startTime != null) {
110             addFieldToSource(sourceMap, "startTime", startTime);
111         }
112         if (target != null) {
113             addFieldToSource(sourceMap, "target", target);
114         }
115         return sourceMap;
116     }
117 
118     protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
119         sourceMap.put(field, value);
120     }
121 
122     // ===================================================================================
123     //                                                                      Basic Override
124     //                                                                      ==============
125     @Override
126     protected String doBuildColumnString(String dm) {
127         StringBuilder sb = new StringBuilder();
128         sb.append(dm).append(endTime);
129         sb.append(dm).append(jobName);
130         sb.append(dm).append(jobStatus);
131         sb.append(dm).append(lastUpdated);
132         sb.append(dm).append(scriptData);
133         sb.append(dm).append(scriptResult);
134         sb.append(dm).append(scriptType);
135         sb.append(dm).append(startTime);
136         sb.append(dm).append(target);
137         if (sb.length() > dm.length()) {
138             sb.delete(0, dm.length());
139         }
140         sb.insert(0, "{").append("}");
141         return sb.toString();
142     }
143 
144     // ===================================================================================
145     //                                                                            Accessor
146     //                                                                            ========
147     public Long getEndTime() {
148         checkSpecifiedProperty("endTime");
149         return endTime;
150     }
151 
152     public void setEndTime(Long value) {
153         registerModifiedProperty("endTime");
154         this.endTime = value;
155     }
156 
157     public String getJobName() {
158         checkSpecifiedProperty("jobName");
159         return convertEmptyToNull(jobName);
160     }
161 
162     public void setJobName(String value) {
163         registerModifiedProperty("jobName");
164         this.jobName = value;
165     }
166 
167     public String getJobStatus() {
168         checkSpecifiedProperty("jobStatus");
169         return convertEmptyToNull(jobStatus);
170     }
171 
172     public void setJobStatus(String value) {
173         registerModifiedProperty("jobStatus");
174         this.jobStatus = value;
175     }
176 
177     public Long getLastUpdated() {
178         checkSpecifiedProperty("lastUpdated");
179         return lastUpdated;
180     }
181 
182     public void setLastUpdated(Long value) {
183         registerModifiedProperty("lastUpdated");
184         this.lastUpdated = value;
185     }
186 
187     public String getScriptData() {
188         checkSpecifiedProperty("scriptData");
189         return convertEmptyToNull(scriptData);
190     }
191 
192     public void setScriptData(String value) {
193         registerModifiedProperty("scriptData");
194         this.scriptData = value;
195     }
196 
197     public String getScriptResult() {
198         checkSpecifiedProperty("scriptResult");
199         return convertEmptyToNull(scriptResult);
200     }
201 
202     public void setScriptResult(String value) {
203         registerModifiedProperty("scriptResult");
204         this.scriptResult = value;
205     }
206 
207     public String getScriptType() {
208         checkSpecifiedProperty("scriptType");
209         return convertEmptyToNull(scriptType);
210     }
211 
212     public void setScriptType(String value) {
213         registerModifiedProperty("scriptType");
214         this.scriptType = value;
215     }
216 
217     public Long getStartTime() {
218         checkSpecifiedProperty("startTime");
219         return startTime;
220     }
221 
222     public void setStartTime(Long value) {
223         registerModifiedProperty("startTime");
224         this.startTime = value;
225     }
226 
227     public String getTarget() {
228         checkSpecifiedProperty("target");
229         return convertEmptyToNull(target);
230     }
231 
232     public void setTarget(String value) {
233         registerModifiedProperty("target");
234         this.target = value;
235     }
236 }