use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class DfRefClsReferenceRegistry method createDBClsReference.
protected DfRefClsReference createDBClsReference(String clsTheme) {
final Map<String, DfClassificationTop> topMap = getClassificationProperties().getClassificationTopMap();
final String cdefPackage = getBasicProperties().getBaseCommonPackage();
final String cdefInterfaceName = getBasicProperties().getCDefPureName();
final DfRefClsReferredCDef refCDef = new DfRefClsReferredCDef(cdefPackage, cdefInterfaceName);
return new DfRefClsReference(clsTheme, topMap, refCDef);
}
use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class DfPmbPropertyOptionClassification method getPropertyOptionClassificationTop.
public DfClassificationTop getPropertyOptionClassificationTop() {
final String classificationName = extractClassificationNameFromOption(true);
final DfClassificationTop classificationTop = _classificationProperties.getClassificationTop(classificationName);
if (classificationTop == null) {
throwClassificationNotFoundException(classificationName);
}
return classificationTop;
}
use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class DfClassificationProperties method filterUseDocumentOnly.
// -----------------------------------------------------
// DocumentOnly
// ------------
protected void filterUseDocumentOnly() {
final boolean docOnlyTask = isDocOnlyTask();
for (Entry<String, DfClassificationTop> entry : _classificationTopMap.entrySet()) {
final String classificationName = entry.getKey();
final DfClassificationTop classificationTop = entry.getValue();
if (!docOnlyTask && classificationTop.isUseDocumentOnly()) {
_log.info("...Skipping document-only classification: " + classificationName);
// e.g. Generate or Sql2Entity, and document-only classification
_documentOnlyClassificationSet.add(classificationName);
}
}
for (String documentOnlyClassificationName : _documentOnlyClassificationSet) {
_classificationTopMap.remove(documentOnlyClassificationName);
_tableClassificationMap.remove(documentOnlyClassificationName);
}
}
use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class DfClassificationProperties method getClassificationDefinitionMap.
// -----------------------------------------------------
// Native Definition
// -----------------
/**
* Get the map of classification definition.
* @return The map of classification definition. (NotNull)
*/
protected Map<String, DfClassificationTop> getClassificationDefinitionMap() {
if (_classificationTopMap != null) {
return _classificationTopMap;
}
_classificationTopMap = newLinkedHashMap();
final Map<String, Object> plainDefinitionMap;
{
final String mapName = KEY_classificationDefinitionMap;
final String propKey = "torque." + mapName;
plainDefinitionMap = resolveSplit(mapName, mapProp(propKey, DEFAULT_EMPTY_MAP));
}
final DfClsElementLiteralArranger literalArranger = new DfClsElementLiteralArranger();
String allInOneSql = null;
Connection conn = null;
try {
for (Entry<String, Object> entry : plainDefinitionMap.entrySet()) {
final String classificationName = entry.getKey();
final Object objValue = entry.getValue();
// handle special elements
if (classificationName.equalsIgnoreCase("$$SQL$$")) {
allInOneSql = (String) objValue;
continue;
}
// check duplicate classification
if (_classificationTopMap.containsKey(classificationName)) {
String msg = "Duplicate classification: " + classificationName;
throw new DfIllegalPropertySettingException(msg);
}
final DfClassificationTop classificationTop = new DfClassificationTop(classificationName);
_classificationTopMap.put(classificationName, classificationTop);
// handle classification elements
if (!(objValue instanceof List<?>)) {
throwClassificationMapValueIllegalListTypeException(objValue);
}
final List<?> plainList = (List<?>) objValue;
final List<DfClassificationElement> elementList = new ArrayList<DfClassificationElement>();
boolean tableClassification = false;
for (Object element : plainList) {
if (!(element instanceof Map<?, ?>)) {
throwClassificationListElementIllegalMapTypeException(element);
}
@SuppressWarnings("unchecked") final Map<String, Object> elementMap = (Map<String, Object>) element;
// from table
final String table = (String) elementMap.get(DfClassificationElement.KEY_TABLE);
if (Srl.is_NotNull_and_NotTrimmedEmpty(table)) {
tableClassification = true;
if (conn == null) {
// on demand
conn = createMainSchemaConnection();
}
arrangeTableClassification(classificationTop, elementMap, table, elementList, conn);
continue;
}
// from literal
if (isElementMapClassificationTop(elementMap)) {
// top definition
arrangeClassificationTopFromLiteral(classificationTop, elementMap);
} else {
literalArranger.arrange(classificationName, elementMap);
final DfClassificationElement classificationElement = new DfClassificationElement();
classificationElement.setClassificationName(classificationName);
classificationElement.acceptBasicItemMap(elementMap);
elementList.add(classificationElement);
}
}
// adjust classification top
classificationTop.addClassificationElementAll(elementList);
classificationTop.setTableClassification(tableClassification);
_classificationTopMap.put(classificationName, classificationTop);
}
if (allInOneSql != null) {
if (conn == null) {
// on demand
conn = createMainSchemaConnection();
}
arrangeAllInOneTableClassification(conn, allInOneSql);
}
// *Classification Resource Point!
reflectClassificationResourceToDefinition();
filterUseDocumentOnly();
verifyClassificationConstraintsIfNeeds();
prepareSuppressedDBAccessClassTableSet();
} finally {
new DfClassificationJdbcCloser().closeConnection(conn);
}
return _classificationTopMap;
}
use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class DfClsTableAllInOneArranger method createAllInOneTableClassificationTop.
protected DfClassificationTop createAllInOneTableClassificationTop(final String classificationName) {
final DfClassificationTop tmpTop = new DfClassificationTop(classificationName);
final DfLittleAdjustmentProperties prop = getLittleAdjustmentProperties();
tmpTop.setCheckClassificationCode(prop.isPlainCheckClassificationCode());
tmpTop.setUndefinedHandlingType(prop.getClassificationUndefinedHandlingType());
// unsupported
tmpTop.setCheckImplicitSet(false);
tmpTop.setCheckSelectedClassification(prop.isCheckSelectedClassification());
tmpTop.setForceClassificationSetting(prop.isForceClassificationSetting());
return tmpTop;
}
Aggregations