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.dbmeta;
17  
18  import java.time.LocalDateTime;
19  import java.util.List;
20  import java.util.Map;
21  
22  import org.codelibs.fess.es.config.exentity.CrawlingInfo;
23  import org.dbflute.Entity;
24  import org.dbflute.dbmeta.AbstractDBMeta;
25  import org.dbflute.dbmeta.info.ColumnInfo;
26  import org.dbflute.dbmeta.info.UniqueInfo;
27  import org.dbflute.dbmeta.name.TableSqlName;
28  import org.dbflute.dbmeta.property.PropertyGateway;
29  import org.dbflute.dbway.DBDef;
30  import org.dbflute.util.DfTypeUtil;
31  
32  /**
33   * @author ESFlute (using FreeGen)
34   */
35  public class CrawlingInfoDbm extends AbstractDBMeta {
36  
37      protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
38  
39      // ===================================================================================
40      //                                                                           Singleton
41      //                                                                           =========
42      private static final CrawlingInfoDbm _instance = new CrawlingInfoDbm();
43  
44      private CrawlingInfoDbm() {
45      }
46  
47      public static CrawlingInfoDbm getInstance() {
48          return _instance;
49      }
50  
51      // ===================================================================================
52      //                                                                       Current DBDef
53      //                                                                       =============
54      @Override
55      public String getProjectName() {
56          return null;
57      }
58  
59      @Override
60      public String getProjectPrefix() {
61          return null;
62      }
63  
64      @Override
65      public String getGenerationGapBasePrefix() {
66          return null;
67      }
68  
69      @Override
70      public DBDef getCurrentDBDef() {
71          return null;
72      }
73  
74      // ===================================================================================
75      //                                                                    Property Gateway
76      //                                                                    ================
77      // -----------------------------------------------------
78      //                                       Column Property
79      //                                       ---------------
80      protected final Map<String, PropertyGateway> _epgMap = newHashMap();
81      {
82          setupEpg(_epgMap, et -> ((CrawlingInfo) et).getCreatedTime(), (et, vl) -> ((CrawlingInfo) et).setCreatedTime(DfTypeUtil.toLong(vl)),
83                  "createdTime");
84          setupEpg(_epgMap, et -> ((CrawlingInfo) et).getExpiredTime(), (et, vl) -> ((CrawlingInfo) et).setExpiredTime(DfTypeUtil.toLong(vl)),
85                  "expiredTime");
86          setupEpg(_epgMap, et -> ((CrawlingInfo) et).getName(), (et, vl) -> ((CrawlingInfo) et).setName(DfTypeUtil.toString(vl)), "name");
87          setupEpg(_epgMap, et -> ((CrawlingInfo) et).getSessionId(), (et, vl) -> ((CrawlingInfo) et).setSessionId(DfTypeUtil.toString(vl)),
88                  "sessionId");
89      }
90  
91      @Override
92      public PropertyGateway findPropertyGateway(final String prop) {
93          return doFindEpg(_epgMap, prop);
94      }
95  
96      // ===================================================================================
97      //                                                                          Table Info
98      //                                                                          ==========
99      protected final String _tableDbName = "crawling_info";
100     protected final String _tableDispName = "crawling_info";
101     protected final String _tablePropertyName = "CrawlingInfo";
102 
103     public String getTableDbName() {
104         return _tableDbName;
105     }
106 
107     @Override
108     public String getTableDispName() {
109         return _tableDispName;
110     }
111 
112     @Override
113     public String getTablePropertyName() {
114         return _tablePropertyName;
115     }
116 
117     @Override
118     public TableSqlName getTableSqlName() {
119         return null;
120     }
121 
122     // ===================================================================================
123     //                                                                         Column Info
124     //                                                                         ===========
125     protected final ColumnInfo _columnCreatedTime = cci("createdTime", "createdTime", null, null, Long.class, "createdTime", null, false,
126             false, false, "Long", 0, 0, null, null, false, null, null, null, null, null, false);
127     protected final ColumnInfo _columnExpiredTime = cci("expiredTime", "expiredTime", null, null, Long.class, "expiredTime", null, false,
128             false, false, "Long", 0, 0, null, null, false, null, null, null, null, null, false);
129     protected final ColumnInfo _columnName = cci("name", "name", null, null, String.class, "name", null, false, false, false, "keyword", 0,
130             0, null, null, false, null, null, null, null, null, false);
131     protected final ColumnInfo _columnSessionId = cci("sessionId", "sessionId", null, null, String.class, "sessionId", null, false, false,
132             false, "keyword", 0, 0, null, null, false, null, null, null, null, null, false);
133 
134     public ColumnInfo columnCreatedTime() {
135         return _columnCreatedTime;
136     }
137 
138     public ColumnInfo columnExpiredTime() {
139         return _columnExpiredTime;
140     }
141 
142     public ColumnInfo columnName() {
143         return _columnName;
144     }
145 
146     public ColumnInfo columnSessionId() {
147         return _columnSessionId;
148     }
149 
150     protected List<ColumnInfo> ccil() {
151         List<ColumnInfo> ls = newArrayList();
152         ls.add(columnCreatedTime());
153         ls.add(columnExpiredTime());
154         ls.add(columnName());
155         ls.add(columnSessionId());
156         return ls;
157     }
158 
159     // ===================================================================================
160     //                                                                         Unique Info
161     //                                                                         ===========
162     @Override
163     public boolean hasPrimaryKey() {
164         return false;
165     }
166 
167     @Override
168     public boolean hasCompoundPrimaryKey() {
169         return false;
170     }
171 
172     @Override
173     protected UniqueInfo cpui() {
174         return null;
175     }
176 
177     // ===================================================================================
178     //                                                                           Type Name
179     //                                                                           =========
180     @Override
181     public String getEntityTypeName() {
182         return "org.codelibs.fess.es.config.exentity.CrawlingInfo";
183     }
184 
185     @Override
186     public String getConditionBeanTypeName() {
187         return "org.codelibs.fess.es.config.cbean.CrawlingInfoCB";
188     }
189 
190     @Override
191     public String getBehaviorTypeName() {
192         return "org.codelibs.fess.es.config.exbhv.CrawlingInfoBhv";
193     }
194 
195     // ===================================================================================
196     //                                                                         Object Type
197     //                                                                         ===========
198     @Override
199     public Class<? extends Entity> getEntityType() {
200         return CrawlingInfo.class;
201     }
202 
203     // ===================================================================================
204     //                                                                     Object Instance
205     //                                                                     ===============
206     @Override
207     public Entity newEntity() {
208         return new CrawlingInfo();
209     }
210 
211     // ===================================================================================
212     //                                                                   Map Communication
213     //                                                                   =================
214     @Override
215     public void acceptPrimaryKeyMap(Entity entity, Map<String, ? extends Object> primaryKeyMap) {
216     }
217 
218     @Override
219     public void acceptAllColumnMap(Entity entity, Map<String, ? extends Object> allColumnMap) {
220     }
221 
222     @Override
223     public Map<String, Object> extractPrimaryKeyMap(Entity entity) {
224         return null;
225     }
226 
227     @Override
228     public Map<String, Object> extractAllColumnMap(Entity entity) {
229         return null;
230     }
231 }