use of org.dbflute.properties.assistant.database.DfAdditionalSchemaInfo in project dbflute-core by dbflute.
the class Table method doHasAllCommonColumn.
protected boolean doHasAllCommonColumn() {
if (isAdditionalSchema()) {
final DfDatabaseProperties prop = getDatabaseProperties();
final DfAdditionalSchemaInfo schemaInfo = prop.getAdditionalSchemaInfo(_unifiedSchema);
if (schemaInfo.isSuppressCommonColumn()) {
return false;
}
}
final List<String> commonColumnNameList = getCommonColumnProperties().getCommonColumnNameList();
if (commonColumnNameList.isEmpty()) {
return false;
}
for (String commonColumnName : commonColumnNameList) {
if (getCommonColumnProperties().isCommonColumnConversion(commonColumnName)) {
final Column col = findMyCommonColumn(commonColumnName);
if (col == null) {
return false;
}
} else {
if (!_columnMap.containsKey(commonColumnName)) {
return false;
}
}
}
return true;
}
use of org.dbflute.properties.assistant.database.DfAdditionalSchemaInfo in project dbflute-core by dbflute.
the class UnifiedSchema method judgeSchema.
protected UnifiedSchema judgeSchema() {
final DfDatabaseProperties databaseProp = getDatabaseProperties();
final UnifiedSchema mainSchema = databaseProp.getDatabaseSchema();
if (equals(mainSchema)) {
asMainSchema();
} else {
final DfAdditionalSchemaInfo info = databaseProp.getAdditionalSchemaInfo(this);
if (info != null) {
asAdditionalSchema();
if (info.getUnifiedSchema().isCatalogAdditionalSchema()) {
asCatalogAdditionalSchema();
}
} else {
asUnknownSchema();
}
}
return this;
}
use of org.dbflute.properties.assistant.database.DfAdditionalSchemaInfo in project dbflute-core by dbflute.
the class DfProcedureExtractor method setupAdditionalSchemaProcedure.
// -----------------------------------------------------
// Additional Schema
// -----------------
protected void setupAdditionalSchemaProcedure(DfSchemaSource dataSource, List<DfProcedureMeta> procedureList) throws SQLException {
if (_suppressAdditionalSchema) {
return;
}
final DfDatabaseProperties databaseProp = getProperties().getDatabaseProperties();
final List<UnifiedSchema> additionalSchemaList = databaseProp.getAdditionalSchemaList();
for (UnifiedSchema additionalSchema : additionalSchemaList) {
final DfAdditionalSchemaInfo schemaInfo = databaseProp.getAdditionalSchemaInfo(additionalSchema);
if (schemaInfo.isSuppressProcedure()) {
continue;
}
final List<DfProcedureMeta> additionalProcedureList = getPlainProcedureList(dataSource, additionalSchema);
procedureList.addAll(additionalProcedureList);
}
}
use of org.dbflute.properties.assistant.database.DfAdditionalSchemaInfo in project dbflute-core by dbflute.
the class DfProcedureExtractor method isSynonymAllowedSchema.
protected boolean isSynonymAllowedSchema(DfProcedureSynonymMeta procedureSynonymMetaInfo) {
final DfSynonymMeta synonymMetaInfo = procedureSynonymMetaInfo.getSynonymMetaInfo();
final UnifiedSchema synonymOwner = synonymMetaInfo.getSynonymOwner();
final DfDatabaseProperties databaseProperties = getProperties().getDatabaseProperties();
final DfAdditionalSchemaInfo additionalSchemaInfo = databaseProperties.getAdditionalSchemaInfo(synonymOwner);
if (additionalSchemaInfo != null) {
return additionalSchemaInfo.hasObjectTypeSynonym();
} else {
// as main schema
return databaseProperties.hasObjectTypeSynonym();
}
}
use of org.dbflute.properties.assistant.database.DfAdditionalSchemaInfo 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;
}
Aggregations