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.PathMapping;
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 PathMappingDbm extends AbstractDBMeta {
36  
37      protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
38  
39      // ===================================================================================
40      //                                                                           Singleton
41      //                                                                           =========
42      private static final PathMappingDbm _instance = new PathMappingDbm();
43  
44      private PathMappingDbm() {
45      }
46  
47      public static PathMappingDbm 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 -> ((PathMapping) et).getCreatedBy(), (et, vl) -> ((PathMapping) et).setCreatedBy(DfTypeUtil.toString(vl)),
83                  "createdBy");
84          setupEpg(_epgMap, et -> ((PathMapping) et).getCreatedTime(), (et, vl) -> ((PathMapping) et).setCreatedTime(DfTypeUtil.toLong(vl)),
85                  "createdTime");
86          setupEpg(_epgMap, et -> ((PathMapping) et).getProcessType(), (et, vl) -> ((PathMapping) et).setProcessType(DfTypeUtil.toString(vl)),
87                  "processType");
88          setupEpg(_epgMap, et -> ((PathMapping) et).getRegex(), (et, vl) -> ((PathMapping) et).setRegex(DfTypeUtil.toString(vl)), "regex");
89          setupEpg(_epgMap, et -> ((PathMapping) et).getReplacement(), (et, vl) -> ((PathMapping) et).setReplacement(DfTypeUtil.toString(vl)),
90                  "replacement");
91          setupEpg(_epgMap, et -> ((PathMapping) et).getSortOrder(), (et, vl) -> ((PathMapping) et).setSortOrder(DfTypeUtil.toInteger(vl)),
92                  "sortOrder");
93          setupEpg(_epgMap, et -> ((PathMapping) et).getUpdatedBy(), (et, vl) -> ((PathMapping) et).setUpdatedBy(DfTypeUtil.toString(vl)),
94                  "updatedBy");
95          setupEpg(_epgMap, et -> ((PathMapping) et).getUpdatedTime(), (et, vl) -> ((PathMapping) et).setUpdatedTime(DfTypeUtil.toLong(vl)),
96                  "updatedTime");
97          setupEpg(_epgMap, et -> ((PathMapping) et).getUserAgent(), (et, vl) -> ((PathMapping) et).setUserAgent(DfTypeUtil.toString(vl)),
98                  "userAgent");
99      }
100 
101     @Override
102     public PropertyGateway findPropertyGateway(final String prop) {
103         return doFindEpg(_epgMap, prop);
104     }
105 
106     // ===================================================================================
107     //                                                                          Table Info
108     //                                                                          ==========
109     protected final String _tableDbName = "path_mapping";
110     protected final String _tableDispName = "path_mapping";
111     protected final String _tablePropertyName = "PathMapping";
112 
113     public String getTableDbName() {
114         return _tableDbName;
115     }
116 
117     @Override
118     public String getTableDispName() {
119         return _tableDispName;
120     }
121 
122     @Override
123     public String getTablePropertyName() {
124         return _tablePropertyName;
125     }
126 
127     @Override
128     public TableSqlName getTableSqlName() {
129         return null;
130     }
131 
132     // ===================================================================================
133     //                                                                         Column Info
134     //                                                                         ===========
135     protected final ColumnInfo _columnCreatedBy = cci("createdBy", "createdBy", null, null, String.class, "createdBy", null, false, false,
136             false, "keyword", 0, 0, null, null, false, null, null, null, null, null, false);
137     protected final ColumnInfo _columnCreatedTime = cci("createdTime", "createdTime", null, null, Long.class, "createdTime", null, false,
138             false, false, "Long", 0, 0, null, null, false, null, null, null, null, null, false);
139     protected final ColumnInfo _columnProcessType = cci("processType", "processType", null, null, String.class, "processType", null, false,
140             false, false, "keyword", 0, 0, null, null, false, null, null, null, null, null, false);
141     protected final ColumnInfo _columnRegex = cci("regex", "regex", null, null, String.class, "regex", null, false, false, false, "keyword",
142             0, 0, null, null, false, null, null, null, null, null, false);
143     protected final ColumnInfo _columnReplacement = cci("replacement", "replacement", null, null, String.class, "replacement", null, false,
144             false, false, "keyword", 0, 0, null, null, false, null, null, null, null, null, false);
145     protected final ColumnInfo _columnSortOrder = cci("sortOrder", "sortOrder", null, null, Integer.class, "sortOrder", null, false, false,
146             false, "Integer", 0, 0, null, null, false, null, null, null, null, null, false);
147     protected final ColumnInfo _columnUpdatedBy = cci("updatedBy", "updatedBy", null, null, String.class, "updatedBy", null, false, false,
148             false, "keyword", 0, 0, null, null, false, null, null, null, null, null, false);
149     protected final ColumnInfo _columnUpdatedTime = cci("updatedTime", "updatedTime", null, null, Long.class, "updatedTime", null, false,
150             false, false, "Long", 0, 0, null, null, false, null, null, null, null, null, false);
151     protected final ColumnInfo _columnUserAgent = cci("userAgent", "userAgent", null, null, String.class, "userAgent", null, false, false,
152             false, "keyword", 0, 0, null, null, false, null, null, null, null, null, false);
153 
154     public ColumnInfo columnCreatedBy() {
155         return _columnCreatedBy;
156     }
157 
158     public ColumnInfo columnCreatedTime() {
159         return _columnCreatedTime;
160     }
161 
162     public ColumnInfo columnProcessType() {
163         return _columnProcessType;
164     }
165 
166     public ColumnInfo columnRegex() {
167         return _columnRegex;
168     }
169 
170     public ColumnInfo columnReplacement() {
171         return _columnReplacement;
172     }
173 
174     public ColumnInfo columnSortOrder() {
175         return _columnSortOrder;
176     }
177 
178     public ColumnInfo columnUpdatedBy() {
179         return _columnUpdatedBy;
180     }
181 
182     public ColumnInfo columnUpdatedTime() {
183         return _columnUpdatedTime;
184     }
185 
186     public ColumnInfo columnUserAgent() {
187         return _columnUserAgent;
188     }
189 
190     protected List<ColumnInfo> ccil() {
191         List<ColumnInfo> ls = newArrayList();
192         ls.add(columnCreatedBy());
193         ls.add(columnCreatedTime());
194         ls.add(columnProcessType());
195         ls.add(columnRegex());
196         ls.add(columnReplacement());
197         ls.add(columnSortOrder());
198         ls.add(columnUpdatedBy());
199         ls.add(columnUpdatedTime());
200         ls.add(columnUserAgent());
201         return ls;
202     }
203 
204     // ===================================================================================
205     //                                                                         Unique Info
206     //                                                                         ===========
207     @Override
208     public boolean hasPrimaryKey() {
209         return false;
210     }
211 
212     @Override
213     public boolean hasCompoundPrimaryKey() {
214         return false;
215     }
216 
217     @Override
218     protected UniqueInfo cpui() {
219         return null;
220     }
221 
222     // ===================================================================================
223     //                                                                           Type Name
224     //                                                                           =========
225     @Override
226     public String getEntityTypeName() {
227         return "org.codelibs.fess.es.config.exentity.PathMapping";
228     }
229 
230     @Override
231     public String getConditionBeanTypeName() {
232         return "org.codelibs.fess.es.config.cbean.PathMappingCB";
233     }
234 
235     @Override
236     public String getBehaviorTypeName() {
237         return "org.codelibs.fess.es.config.exbhv.PathMappingBhv";
238     }
239 
240     // ===================================================================================
241     //                                                                         Object Type
242     //                                                                         ===========
243     @Override
244     public Class<? extends Entity> getEntityType() {
245         return PathMapping.class;
246     }
247 
248     // ===================================================================================
249     //                                                                     Object Instance
250     //                                                                     ===============
251     @Override
252     public Entity newEntity() {
253         return new PathMapping();
254     }
255 
256     // ===================================================================================
257     //                                                                   Map Communication
258     //                                                                   =================
259     @Override
260     public void acceptPrimaryKeyMap(Entity entity, Map<String, ? extends Object> primaryKeyMap) {
261     }
262 
263     @Override
264     public void acceptAllColumnMap(Entity entity, Map<String, ? extends Object> allColumnMap) {
265     }
266 
267     @Override
268     public Map<String, Object> extractPrimaryKeyMap(Entity entity) {
269         return null;
270     }
271 
272     @Override
273     public Map<String, Object> extractAllColumnMap(Entity entity) {
274         return null;
275     }
276 }