protected String doDeriveNonQuotedLiteralTypeFromTestValue(String testValue) { final String plainTypeName; if (Srl.contains(testValue, ".")) { BigDecimal decimalValue = null; try { decimalValue = DfTypeUtil.toBigDecimal(testValue); } catch (NumberFormatException ignored) { } if (decimalValue != null) { plainTypeName = "BigDecimal"; } else { // means unknown type plainTypeName = "String"; } } else { Long longValue = null; try { longValue = DfTypeUtil.toLong(testValue); } catch (NumberFormatException ignored) { } if (longValue != null) { if (longValue > Long.valueOf(Integer.MAX_VALUE)) { plainTypeName = "Long"; } else { plainTypeName = "Integer"; } } else { if (testValue.equalsIgnoreCase("true") || testValue.equalsIgnoreCase("false")) { plainTypeName = "Boolean"; } else { // means unknown type plainTypeName = "String"; } } } return plainTypeName; }
protected void setupDbType(Map<String, DfColumnMeta> metaMap, String columnName, Column column) { final DfColumnMeta columnMeta = metaMap.get(columnName); final String dbTypeName; final String plainName = columnMeta.getDbTypeName(); if (Srl.contains(plainName, ".")) { // basically for ARRAY and STRUCT type final String catalogSchema = Srl.substringLastFront(plainName, "."); final UnifiedSchema unifiedSchema = UnifiedSchema.createAsDynamicSchema(catalogSchema); if (unifiedSchema.isMainSchema()) { dbTypeName = Srl.substringLastRear(plainName, "."); } else { dbTypeName = plainName; } } else { dbTypeName = plainName; } column.setDbType(dbTypeName); }
protected StringKeyMap<String> getPrimaryKeyMap(DfCustomizeEntityInfo entityInfo) { final StringKeyMap<String> pkMap = StringKeyMap.createAsFlexibleOrdered(); final List<String> pkList = entityInfo.getPrimaryKeyList(); if (pkList == null || pkList.isEmpty()) { return pkMap; } for (String pk : pkList) { if (Srl.contains(pk, ".")) { final IndexOfInfo info = Srl.indexOfFirst(pk, "."); String tableName = info.substringFrontTrimmed(); String pkName = info.substringRearTrimmed(); pkMap.put(pkName, tableName); } else { pkMap.put(pk, null); // no specified related table } } return pkMap; }
protected void handleException() { final Map<String, String> exceptionInfoMap = _sql2entityMeta.getExceptionInfoMap(); if (exceptionInfoMap.isEmpty()) { return; } final Set<String> nameSet = exceptionInfoMap.keySet(); final StringBuilder sb = new StringBuilder(); for (String name : nameSet) { final String exceptionInfo = exceptionInfoMap.get(name); sb.append("[" + name + "]"); final boolean containsLn = Srl.contains(exceptionInfo, ln()); sb.append(containsLn ? ln() : " "); sb.append(exceptionInfo); sb.append(containsLn ? ln() : "").append(ln()); } _log.warn("/* * * * * * * * * * * * * * * * * {Warning Exception}"); _log.warn(ln() + sb.toString().trim()); _log.warn("* * * * * * * * * */"); _log.warn(" "); }