use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.
the class DfJsonFreeAgent method throwKeyPathExpectedStringListButNotStringException.
protected void throwKeyPathExpectedStringListButNotStringException(String requestName, DfFreeGenResource resource, String keyPath, String targetPath, List<Object> currentList, Object element) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The key path expects string type in list but not string. (FreeGen)");
br.addItem("Request Name");
br.addElement(requestName);
br.addItem("JSON File");
br.addElement(resource.getResourceFile());
br.addItem("keyPath");
br.addElement(keyPath);
br.addItem("Target Path Element");
br.addElement(targetPath);
br.addItem("List Object");
br.addElement(currentList != null ? currentList.getClass().getName() : null);
br.addElement(currentList);
br.addItem("Actual Element");
br.addElement(element != null ? element.getClass().getName() : null);
br.addElement(element);
final String msg = br.buildExceptionMessage();
throw new DfIllegalPropertySettingException(msg);
}
use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.
the class DfJsonFreeAgent method throwJsonMapKeyNotFoundException.
protected void throwJsonMapKeyNotFoundException(String requestName, DfFreeGenResource resource, String tracePath, Map<String, Object> currentMap, String pathElement) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Not found the key in the map. (FreeGen)");
br.addItem("Request Name");
br.addElement(requestName);
br.addItem("JSON File");
br.addElement(resource.getResourceFile());
br.addItem("Trace Path");
br.addElement(tracePath);
br.addItem("Current Map keySet()");
br.addElement(currentMap.keySet());
br.addItem("Path Element");
br.addElement(pathElement);
final String msg = br.buildExceptionMessage();
throw new DfIllegalPropertySettingException(msg);
}
use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.
the class DfFreeGenInitializer method throwFreeGenResourceTypeUnknownException.
// -----------------------------------------------------
// ResourceType Unknown
// --------------------
protected void throwFreeGenResourceTypeUnknownException(String requestName, DfFreeGenResource resource) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Unknown resource type for FreeGen.");
br.addItem("Request Name");
br.addElement(requestName);
br.addItem("Resource Type");
br.addElement(resource.getResourceType());
final String msg = br.buildExceptionMessage();
throw new DfIllegalPropertySettingException(msg);
}
use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.
the class DfAdditionalForeignKeyInitializer method processAllTableFK.
protected void processAllTableFK(String foreignKeyName, String foreignTableName, List<String> foreignColumnNameList, DfAdditionalForeignKeyOption option) {
if (option.isFixedOnlyJoin()) {
String msg = "Cannot use fixedOnlyJoin when all-table FK: " + foreignKeyName;
throw new DfIllegalPropertySettingException(msg);
}
// for check about same-column self reference
final Table foreignTable = getTable(foreignTableName);
final StringSet foreignColumnSet = StringSet.createAsFlexible();
foreignColumnSet.addAll(foreignColumnNameList);
for (Table table : getTableList()) {
final String localTableName = table.getTableDbName();
final List<String> localColumnNameList = getLocalColumnNameList(table, foreignKeyName, foreignTableName, foreignColumnNameList, localTableName, option, true, false);
if (!table.containsColumn(localColumnNameList)) {
continue;
}
// check same-column self reference
final StringSet localColumnSet = StringSet.createAsFlexible();
localColumnSet.addAll(localColumnNameList);
final boolean selfReference = table.getTableDbName().equals(foreignTable.getTableDbName());
if (selfReference && localColumnSet.equalsUnderCharOption(foreignColumnSet)) {
continue;
}
// check same foreign key existence
final String fixedSuffix = option.getFixedSuffix();
final ForeignKey existingFK = table.findExistingForeignKey(foreignTableName, localColumnNameList, foreignColumnNameList, fixedSuffix);
if (existingFK != null) {
_log.info("The foreign key has already set up: " + foreignKeyName + "(" + fixedSuffix + ")");
reflectOptionToExistingFKIfNeeds(foreignKeyName, option, existingFK);
continue;
}
final String currentForeignKeyName = foreignKeyName + "_" + toConstraintPart(localTableName);
setupForeignKeyToTable(currentForeignKeyName, foreignTableName, foreignColumnNameList, table, localColumnNameList, option);
showResult(foreignTableName, foreignColumnNameList, table, localColumnNameList, option);
}
}
use of org.dbflute.exception.DfIllegalPropertySettingException in project dbflute-core by dbflute.
the class DfAdditionalForeignKeyInitializer method assertLocalTableColumn.
protected void assertLocalTableColumn(final String foreignKeyName, final String localTableName, List<String> localColumnNameList, DfAdditionalForeignKeyOption resource) {
if (resource.isFixedOnlyJoin()) {
if (!localColumnNameList.isEmpty()) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The localColumn should be omitted when fixedOnlyJoin is true.");
br.addItem("Additional FK");
br.addElement(foreignKeyName);
br.addItem("Local Table");
br.addElement(localTableName);
br.addItem("Column List");
br.addElement(localColumnNameList);
final String msg = br.buildExceptionMessage();
throw new DfIllegalPropertySettingException(msg);
}
} else {
if (!getTable(localTableName).containsColumn(localColumnNameList)) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("Not found column by the localColumnName of additionalForeignKey.");
br.addElement("Make sure your additionalForeignKeyMap.dfprop");
br.addElement("For example:");
br.addElement(" (x):");
br.addElement(" ; FK_MEMBER_MEMBER_ADDRESS_VALID = map:{");
br.addElement(" ; localTableName = ... ; foreignTableName = ...");
br.addElement(" ; localColumnName = NOEXISTING_ID ; foreignColumnName = MEMBER_ID // *NG");
br.addElement(" ...");
br.addElement(" }");
br.addElement(" (o):");
br.addElement(" ; FK_MEMBER_MEMBER_ADDRESS_VALID = map:{");
br.addElement(" ; localTableName = ... ; foreignTableName = MEMBER_ADDRESS");
br.addElement(" ; localColumnName = MEMBER_ID ; foreignColumnName = MEMBER_ID // OK");
br.addElement(" ...");
br.addElement(" }");
br.addItem("Additional FK");
br.addElement(foreignKeyName);
br.addItem("Local Table");
br.addElement(localTableName);
br.addItem("NotFound Column");
br.addElement(localColumnNameList);
final String msg = br.buildExceptionMessage();
throw new DfPropertySettingColumnNotFoundException(msg);
}
}
}
Aggregations