use of org.dbflute.logic.doc.spolicy.parsed.DfSPolicyParsedPolicy.DfSPolicyParsedPolicyPart in project dbflute-core by dbflute.
the class DfSPolicyChecker method parsePolicy.
// ===================================================================================
// Parse Policy
// ============
protected DfSPolicyParsedPolicy parsePolicy() {
_log.info("...Parsing schema policy map: " + _policyMap.keySet());
DfSPolicyParsedPolicyPart wholePolicyPart = null;
DfSPolicyParsedPolicyPart tablePolicyPart = null;
DfSPolicyParsedPolicyPart columnPolicyPart = null;
for (Entry<String, Object> entry : _policyMap.entrySet()) {
final String key = entry.getKey();
final Object value = entry.getValue();
if (key.equals("wholeMap")) {
@SuppressWarnings("unchecked") final Map<String, Object> wholeMap = (Map<String, Object>) value;
final List<String> themeList = extractThemeList(wholeMap);
wholePolicyPart = new DfSPolicyParsedPolicyPart(themeList, Collections.emptyList());
} else if (key.equals("tableMap")) {
@SuppressWarnings("unchecked") final Map<String, Object> tableMap = (Map<String, Object>) value;
final List<String> themeList = extractThemeList(tableMap);
tablePolicyPart = new DfSPolicyParsedPolicyPart(themeList, extractStatementList(tableMap));
} else if (key.equals("columnMap")) {
@SuppressWarnings("unchecked") final Map<String, Object> columnMap = (Map<String, Object>) value;
final List<String> themeList = extractThemeList(columnMap);
columnPolicyPart = new DfSPolicyParsedPolicyPart(themeList, extractStatementList(columnMap));
} else {
if (!Srl.equalsPlain(key, "tableExceptList", "tableTargetList", "columnExceptMap", "isMainSchemaOnly")) {
_logicalSecretary.throwSchemaPolicyCheckUnknownPropertyException(key);
}
}
}
if (wholePolicyPart == null) {
wholePolicyPart = new DfSPolicyParsedPolicyPart(Collections.emptyList(), Collections.emptyList());
}
if (tablePolicyPart == null) {
tablePolicyPart = new DfSPolicyParsedPolicyPart(Collections.emptyList(), Collections.emptyList());
}
if (columnPolicyPart == null) {
columnPolicyPart = new DfSPolicyParsedPolicyPart(Collections.emptyList(), Collections.emptyList());
}
return new DfSPolicyParsedPolicy(wholePolicyPart, tablePolicyPart, columnPolicyPart);
}
use of org.dbflute.logic.doc.spolicy.parsed.DfSPolicyParsedPolicy.DfSPolicyParsedPolicyPart in project dbflute-core by dbflute.
the class DfSPolicyChecker method doCheckTableColumn.
protected void doCheckTableColumn(DfSPolicyParsedPolicy policy, DfSPolicyResult result, Table table) {
final DfSPolicyParsedPolicyPart tablePolicyPart = policy.getTablePolicyPart();
_tableThemeChecker.checkTableTheme(tablePolicyPart.getThemeList(), result, table);
_tableStatementChecker.checkTableStatement(tablePolicyPart.getStatementList(), result, table);
final List<Column> columnList = table.getColumnList();
final DfSPolicyParsedPolicyPart columnPolicyPart = policy.getColumnPolicyPart();
for (Column column : columnList) {
if (!isTargetColumn(column)) {
continue;
}
_columnThemeChecker.checkColumnTheme(columnPolicyPart.getThemeList(), result, column);
_columnStatementChecker.checkColumnStatement(columnPolicyPart.getStatementList(), result, column);
}
}
Aggregations