use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfDocumentProperties method getLoadDataReverseCellLengthLimit.
public Integer getLoadDataReverseCellLengthLimit() {
final Map<String, Object> loadDataReverseMap = getLoadDataReverseMap();
String limitExp = null;
if (!loadDataReverseMap.isEmpty()) {
limitExp = (String) loadDataReverseMap.get("cellLengthLimit");
}
if (limitExp == null) {
// if null, default limit
return null;
}
try {
return Integer.valueOf(limitExp);
} catch (NumberFormatException e) {
String msg = "The property 'cellLengthLimit' of loadDataReverse in " + KEY_oldDocumentMap;
msg = msg + " should be number but: value=" + limitExp;
throw new DfIllegalPropertyTypeException(msg, e);
}
}
use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfIncludeQueryProperties method extractColumnDrivenInterfaceMap.
protected Map<String, Map<String, List<String>>> extractColumnDrivenInterfaceMap(Map<String, Object> targetMap) {
// ; $MEMBER = map:{
// ; BIRTHDATE(Date) = list:{ !GreaterThan ; !LessThan }
// ; MEMBER_NAME(String) = list:{}
// }
final Map<String, Map<String, List<String>>> interfaceMap = newLinkedHashMap();
for (Entry<String, Object> propEntry : targetMap.entrySet()) {
final String propType = propEntry.getKey();
final Object value = propEntry.getValue();
if (!(value instanceof Map)) {
String msg = "The key '" + KEY_conditionBeanMap + "' should have map value:";
msg = msg + " key=" + propType + " value=" + value + " targetMap=" + targetMap;
throw new DfIllegalPropertyTypeException(msg);
}
if (!propType.startsWith("$")) {
continue;
}
final String tableName = Srl.substringFirstRear(propType, "$");
@SuppressWarnings("unchecked") final Map<String, List<String>> columnCKeyMap = (Map<String, List<String>>) value;
Set<Entry<String, List<String>>> entrySet = columnCKeyMap.entrySet();
for (Entry<String, List<String>> entry : entrySet) {
final String columnExp = entry.getKey();
final List<String> ckeyList = entry.getValue();
if (!ckeyList.isEmpty()) {
columnCKeyMap.put(columnExp, ckeyList);
} else {
final ScopeInfo scopeFirst = Srl.extractScopeFirst(columnExp, "(", ")");
if (scopeFirst == null) {
String msg = "The column expression should be e.g. Member(Date) but: " + columnExp;
throw new DfIllegalPropertySettingException(msg);
}
final String currentPropType = scopeFirst.getContent().trim();
final Set<String> ckeySet = _ckeySetMap.get(currentPropType);
if (ckeySet == null) {
String msg = "Unknown condition-key: " + currentPropType + ", expected=" + _ckeySetMap.keySet();
throw new DfIllegalPropertySettingException(msg);
}
final List<String> allCKeyList = new ArrayList<String>();
for (String ckey : ckeySet) {
allCKeyList.add("!" + ckey);
}
columnCKeyMap.put(columnExp, allCKeyList);
}
}
interfaceMap.put(tableName, columnCKeyMap);
}
return interfaceMap;
}
use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfOutsideSqlProperties method getSqlLocationList.
public List<DfOutsideSqlLocation> getSqlLocationList() {
if (_outsideSqlLocationList != null) {
return _outsideSqlLocationList;
}
_outsideSqlLocationList = new ArrayList<DfOutsideSqlLocation>();
// basically unused
final String mainProjectName = "main";
final String mainDir = getMainSqlDirectory();
final String mainOutput = getSql2EntityOutputDirectory();
_outsideSqlLocationList.add(createOutsideSqlLocation(mainProjectName, mainDir, mainOutput, false, false));
final Object obj = getApplicationOutsideSqlMap();
if (!(obj instanceof Map<?, ?>)) {
String msg = "The property 'applicationOutsideSqlMap' should be Map: " + obj.getClass();
throw new DfIllegalPropertyTypeException(msg);
}
@SuppressWarnings("unchecked") final Map<String, Map<String, String>> sqlApMap = (Map<String, Map<String, String>>) obj;
if (sqlApMap.isEmpty()) {
return _outsideSqlLocationList;
}
final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
final String defaultSqlDirectory = lang.getOutsideSqlDirectory();
final String defaultMainProgramDirectory = lang.getMainProgramDirectory();
for (Entry<String, Map<String, String>> entry : sqlApMap.entrySet()) {
final String applicationDir = entry.getKey();
final Map<String, String> elementMap = entry.getValue();
// basically for display
final String projectName;
{
final String lastName = Srl.substringLastRear(applicationDir, "/");
if (Srl.is_Null_or_TrimmedEmpty(lastName) || Srl.equalsPlain(lastName, ".", "..")) {
projectName = applicationDir;
} else {
projectName = lastName;
}
}
final String sqlDirectory;
{
String plainDir = elementMap.get("sqlDirectory");
if (Srl.is_Null_or_TrimmedEmpty(plainDir)) {
plainDir = defaultSqlDirectory;
}
sqlDirectory = doGetSqlDirectory(applicationDir + "/" + plainDir);
}
final String sql2EntityOutputDirectory;
{
String plainDir = elementMap.get("sql2EntityOutputDirectory");
if (Srl.is_Null_or_TrimmedEmpty(plainDir)) {
plainDir = defaultMainProgramDirectory;
}
sql2EntityOutputDirectory = applicationDir + "/" + plainDir;
}
final boolean suppressDirectoryCheck;
{
String value = elementMap.get("isSuppressDirectoryCheck");
if (Srl.is_NotNull_and_NotTrimmedEmpty(value) && value.trim().equalsIgnoreCase("true")) {
suppressDirectoryCheck = true;
} else {
suppressDirectoryCheck = false;
}
}
final DfOutsideSqlLocation sqlApLocation = createOutsideSqlLocation(projectName, sqlDirectory, sql2EntityOutputDirectory, true, suppressDirectoryCheck);
_outsideSqlLocationList.add(sqlApLocation);
}
return _outsideSqlLocationList;
}
use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfDatabaseProperties method setupAdditionalSchemaTableTargetList.
protected void setupAdditionalSchemaTableTargetList(DfAdditionalSchemaInfo info, Map<String, Object> elementMap) {
final Object obj = elementMap.get("tableTargetList");
if (obj == null) {
final List<String> tableTargetList = DfCollectionUtil.emptyList();
final List<String> tableTargetGenOnlyList = DfCollectionUtil.emptyList();
info.setTableTargetList(tableTargetList);
info.setTableTargetGenOnlyList(tableTargetGenOnlyList);
} else if (!(obj instanceof List<?>)) {
String msg = "The type of tableTargetList in the property 'additionalSchemaMap' should be List:";
msg = msg + " type=" + DfTypeUtil.toClassTitle(obj) + " value=" + obj;
throw new DfIllegalPropertyTypeException(msg);
} else {
@SuppressWarnings("unchecked") final List<String> plainList = (List<String>) obj;
final List<String> tableTargetList = new ArrayList<String>();
final List<String> tableTargetGenOnlyList = new ArrayList<String>();
setupTableOrColumnTargetList(plainList, tableTargetList, tableTargetGenOnlyList);
info.setTableTargetList(tableTargetList);
info.setTableTargetGenOnlyList(tableTargetGenOnlyList);
}
}
use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfDatabaseProperties method setupAdditionalSchemaColumnExceptList.
protected void setupAdditionalSchemaColumnExceptList(DfAdditionalSchemaInfo info, Map<String, Object> elementMap) {
final Object obj = elementMap.get("columnExceptMap");
if (obj == null) {
final Map<String, List<String>> columnExceptMap = DfCollectionUtil.emptyMap();
final Map<String, List<String>> columnExceptGenOnlyMap = DfCollectionUtil.emptyMap();
info.setColumnExceptMap(columnExceptMap);
info.setColumnExceptGenOnlyMap(columnExceptGenOnlyMap);
} else if (!(obj instanceof Map<?, ?>)) {
String msg = "The type of columnExceptMap in the property 'additionalSchemaMap' should be Map:";
msg = msg + " type=" + DfTypeUtil.toClassTitle(obj) + " value=" + obj;
throw new DfIllegalPropertyTypeException(msg);
} else {
@SuppressWarnings("unchecked") final Map<String, List<String>> plainMap = (Map<String, List<String>>) obj;
final Map<String, List<String>> columnExceptMap = StringKeyMap.createAsFlexible();
final Map<String, List<String>> columnExceptGenOnlyMap = StringKeyMap.createAsFlexible();
for (Entry<String, List<String>> entry : plainMap.entrySet()) {
final String key = entry.getKey();
final List<String> plainList = entry.getValue();
final List<String> colummExceptList = new ArrayList<String>();
final List<String> columnExceptGenOnlyList = new ArrayList<String>();
setupTableOrColumnExceptList(plainList, colummExceptList, columnExceptGenOnlyList);
columnExceptMap.put(key, colummExceptList);
columnExceptGenOnlyMap.put(key, columnExceptGenOnlyList);
}
info.setColumnExceptMap(columnExceptMap);
info.setColumnExceptGenOnlyMap(columnExceptGenOnlyMap);
}
}
Aggregations