use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class ForeignKey method extractFixedConditionEmbeddedCommentClassification.
// -----------------------------------------------------
// EmbeddedComment Classification
// ------------------------------
protected String extractFixedConditionEmbeddedCommentClassification(String peace, String parameterType) {
// parameterType is e.g. MemberStatus.Formalized
if (!parameterType.contains(".")) {
String msg = "The classification expression should be 'classificationName.elementName':";
msg = msg + " expression=" + parameterType + " embeddedComment=" + peace;
throw new DfFixedConditionInvalidClassificationEmbeddedCommentException(msg);
}
// e.g. MemberStatus
final String classificationName = parameterType.substring(0, parameterType.indexOf("."));
// e.g. Formalized
final String elementName = parameterType.substring(parameterType.indexOf(".") + ".".length());
final Map<String, DfClassificationTop> topMap = getClassificationProperties().getClassificationTopMap();
final DfClassificationTop classificationTop = topMap.get(classificationName);
if (classificationTop == null) {
throwFixedConditionEmbeddedCommentClassificationNotFoundException(classificationName);
}
String code = doExtractFixedConditionEmbeddedCommentClassificationNormalCode(classificationTop, elementName);
if (code != null) {
return code;
}
// may be group here
code = doExtractFixedConditionEmbeddedCommentClassificationGroupCode(classificationTop, elementName);
if (code != null) {
return code;
}
throwFixedConditionEmbeddedCommentClassificationElementNotFoundException(classificationTop, elementName);
// unreachable
return null;
}
use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class DfClassificationProperties method extractClassificationResource.
protected List<DfClassificationTop> extractClassificationResource() {
final DfClassificationResourceAnalyzer analyzer = new DfClassificationResourceAnalyzer();
final String dirBaseName = "./dfprop";
final String resource = NAME_CLASSIFICATION_RESOURCE;
final String extension = "dfprop";
if (isSpecifiedEnvironmentType()) {
final String dirEnvName = dirBaseName + "/" + getEnvironmentType();
final List<DfClassificationTop> ls = analyzer.analyze(dirEnvName, resource, extension);
if (!ls.isEmpty()) {
return ls;
}
return analyzer.analyze(dirBaseName, resource, extension);
} else {
return analyzer.analyze(dirBaseName, resource, extension);
}
}
use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class DfClassificationProperties method createAllInOneTableClassificationTop.
protected DfClassificationTop createAllInOneTableClassificationTop(final String classificationName) {
final DfClassificationTop tmpTop = new DfClassificationTop();
tmpTop.setClassificationName(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;
}
use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class DfAppClsTableLoader method createRefClsElement.
protected DfRefClsElement createRefClsElement(String classificationName, Map<String, Object> elementMap, Map<String, DfClassificationTop> dbClsMap, DfFreeGenResource resource) {
final String refCls = (String) elementMap.get(DfRefClsElement.KEY_REFCLS);
final String projectName;
final String refClsName;
final String groupName;
if (refCls.contains("@")) {
// #hope other schema's reference
projectName = Srl.substringFirstFront(refCls, "@");
final String rearName = Srl.substringFirstRear(refCls, "@");
if (rearName.contains(".")) {
refClsName = Srl.substringFirstFront(rearName, ".");
groupName = Srl.substringFirstRear(rearName, ".");
} else {
refClsName = rearName;
groupName = null;
}
} else {
projectName = null;
if (refCls.contains(".")) {
refClsName = Srl.substringFirstFront(refCls, ".");
groupName = Srl.substringFirstRear(refCls, ".");
} else {
refClsName = refCls;
groupName = null;
}
}
final String classificationType = buildClassificationType(refClsName);
final String refType = (String) elementMap.get(DfRefClsElement.KEY_REFTYPE);
if (refType == null) {
String msg = "Not found the refType in refCls elementMap: " + classificationName + " " + elementMap;
throw new DfIllegalPropertySettingException(msg);
}
final DfClassificationTop dbClsTop = findDBCls(classificationName, refClsName, dbClsMap, resource);
return new DfRefClsElement(projectName, refClsName, classificationType, groupName, refType, dbClsTop);
}
use of org.dbflute.properties.assistant.classification.DfClassificationTop in project dbflute-core by dbflute.
the class DfAppClsTableLoader method handleRefCls.
protected void handleRefCls(DfClassificationTop classificationTop, DfRefClsElement refClsElement) {
refClsElement.checkFormalRefType(classificationTop);
classificationTop.addRefClsElement(refClsElement);
if (refClsElement.isRefTypeIncluded()) {
final DfClassificationTop dbClsTop = refClsElement.getDBClsTop();
final String groupName = refClsElement.getGroupName();
if (groupName != null) {
final DfClassificationGroup group = dbClsTop.getGroupList().stream().filter(gr -> {
return gr.getGroupName().equals(groupName);
}).findFirst().orElseThrow(() -> {
String msg = "Not found the group name: " + refClsElement.getClassificationName() + "." + groupName;
return new DfIllegalPropertySettingException(msg);
});
classificationTop.addClassificationElementAll(group.getElementList());
} else {
final List<DfClassificationElement> dbElementList = dbClsTop.getClassificationElementList();
classificationTop.addClassificationElementAll(dbElementList);
classificationTop.acceptGroupList(dbClsTop.getGroupList());
}
}
}
Aggregations