use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfReplaceSchemaProperties method getAdditionalDropPropertiesMap.
@SuppressWarnings("unchecked")
public Properties getAdditionalDropPropertiesMap(Map<String, Object> additionalDropMap) {
Object obj = additionalDropMap.get("propertiesMap");
if (obj == null) {
return new Properties();
}
if (!(obj instanceof Map)) {
String msg = "The schema should be Map<String, String>:";
msg = msg + " propertiesMap=" + obj + " type=" + obj.getClass();
throw new DfIllegalPropertyTypeException(msg);
}
final Properties prop = new Properties();
prop.putAll((Map<String, String>) obj);
return prop;
}
use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfDatabaseProperties method getAdditionalSchemaMap.
protected Map<String, DfAdditionalSchemaInfo> getAdditionalSchemaMap() {
if (_additionalSchemaMap != null) {
return _additionalSchemaMap;
}
assertOldStyleAdditionalSchema();
_additionalSchemaMap = StringKeyMap.createAsCaseInsensitive();
final Map<String, Object> additionalSchemaMap = getVairousStringKeyMap("additionalSchemaMap");
if (additionalSchemaMap.isEmpty()) {
return _additionalSchemaMap;
}
final Set<Entry<String, Object>> entrySet = additionalSchemaMap.entrySet();
for (Entry<String, Object> entry : entrySet) {
final String identifiedSchema = entry.getKey();
final Object obj = entry.getValue();
if (obj == null) {
String msg = "The value of schema in the property 'additionalSchemaMap' should be required:";
msg = msg + " identifiedSchema=" + identifiedSchema;
msg = msg + " additionalSchemaMap=" + additionalSchemaMap;
throw new DfRequiredPropertyNotFoundException(msg);
}
if (!(obj instanceof Map<?, ?>)) {
String msg = "The type of schema value in the property 'additionalSchemaMap' should be Map:";
msg = msg + " type=" + DfTypeUtil.toClassTitle(obj) + " value=" + obj;
throw new DfIllegalPropertyTypeException(msg);
}
@SuppressWarnings("unchecked") final Map<String, Object> elementMap = (Map<String, Object>) obj;
final DfAdditionalSchemaInfo info = new DfAdditionalSchemaInfo();
final String catalog;
final boolean explicitCatalog;
if (identifiedSchema.contains(".")) {
catalog = Srl.substringFirstFront(identifiedSchema, ".");
explicitCatalog = true;
} else {
// as main catalog
catalog = getDatabaseCatalog();
explicitCatalog = false;
}
final String schema = filterDatabaseSchema(Srl.substringFirstRear(identifiedSchema, "."));
final UnifiedSchema unifiedSchema = createAsAdditionalSchema(catalog, schema, explicitCatalog);
info.setUnifiedSchema(unifiedSchema);
setupAdditionalSchemaObjectTypeTargetList(info, elementMap);
setupAdditionalSchemaTableExceptList(info, elementMap);
setupAdditionalSchemaTableTargetList(info, elementMap);
setupAdditionalSchemaColumnExceptList(info, elementMap);
info.setSuppressCommonColumn(isProperty("isSuppressCommonColumn", false, elementMap));
info.setSuppressProcedure(isProperty("isSuppressProcedure", false, elementMap));
_additionalSchemaMap.put(unifiedSchema.getIdentifiedSchema(), info);
}
return _additionalSchemaMap;
}
use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfDatabaseProperties method setupAdditionalSchemaTableExceptList.
protected void setupAdditionalSchemaTableExceptList(DfAdditionalSchemaInfo info, Map<String, Object> elementMap) {
final Object obj = elementMap.get("tableExceptList");
if (obj == null) {
final List<String> tableExceptList = DfCollectionUtil.emptyList();
final List<String> tableExceptGenOnlyList = DfCollectionUtil.emptyList();
info.setTableExceptList(tableExceptList);
info.setTableExceptGenOnlyList(tableExceptGenOnlyList);
} else if (!(obj instanceof List<?>)) {
String msg = "The type of tableExceptList 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> tableExceptList = new ArrayList<String>();
final List<String> tableExceptGenOnlyList = new ArrayList<String>();
setupTableOrColumnExceptList(plainList, tableExceptList, tableExceptGenOnlyList);
info.setTableExceptList(tableExceptList);
info.setTableExceptGenOnlyList(tableExceptGenOnlyList);
}
}
use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfDatabaseProperties method setupAdditionalSchemaObjectTypeTargetList.
// -----------------------------------------------------
// Additional Schema Option
// ------------------------
protected void setupAdditionalSchemaObjectTypeTargetList(DfAdditionalSchemaInfo info, Map<String, Object> elementMap) {
final Object obj = elementMap.get("objectTypeTargetList");
if (obj == null) {
@SuppressWarnings("unchecked") final List<String> objectTypeTargetList = Collections.EMPTY_LIST;
info.setObjectTypeTargetList(objectTypeTargetList);
} else if (!(obj instanceof List<?>)) {
String msg = "The type of objectTypeTargetList 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> objectTypeTargetList = (List<String>) obj;
info.setObjectTypeTargetList(objectTypeTargetList);
}
}
use of org.dbflute.exception.DfIllegalPropertyTypeException in project dbflute-core by dbflute.
the class DfDocumentProperties method getLoadDataReverseXlsLimit.
// -----------------------------------------------------
// XLS Limit
// ---------
public Integer getLoadDataReverseXlsLimit() {
final Map<String, Object> loadDataReverseMap = getLoadDataReverseMap();
String limitExp = null;
if (!loadDataReverseMap.isEmpty()) {
limitExp = (String) loadDataReverseMap.get("xlsLimit");
}
if (limitExp == null) {
// if null, default limit
return null;
}
final Integer limit;
try {
limit = Integer.valueOf(limitExp);
} catch (NumberFormatException e) {
String msg = "The property 'xlsLimit' of loadDataReverse in " + KEY_oldDocumentMap;
msg = msg + " should be number but: value=" + limitExp;
throw new DfIllegalPropertyTypeException(msg, e);
}
if (limit < 0) {
String msg = "The property 'xlsLimit' of loadDataReverse in " + KEY_oldDocumentMap;
msg = msg + " should be zero or plus number but minus: value=" + limit;
throw new DfIllegalPropertySettingException(msg);
}
return limit;
}
Aggregations