use of org.dbflute.properties.assistant.classification.refcls.DfRefClsReferredCDef in project dbflute-core by dbflute.
the class DfRefClsLoadingHandler method registerRefClsReference.
// ===================================================================================
// Register Reference
// ==================
public void registerRefClsReference(String requestName, String clsTheme, List<DfClassificationTop> topList, Map<String, Object> optionMap) {
if (!isOptionLastaFlute(optionMap)) {
// only LastaFlute classifications can be referred (to be simple logic)
return;
}
if (isOptionLastaDoc(optionMap)) {
// LastaDoc uses real loader's registration (to avoid unexpected data use)
return;
}
final Map<String, DfClassificationTop> clsTopMap = topList.stream().collect(Collectors.toMap(top -> top.getClassificationName(), top -> top));
// not null here, already checked here
final String cdefPackage = extractCDefPackage(optionMap);
// me too
final String cdefClassName = extractCDefClassName(optionMap);
if (cdefPackage == null || cdefClassName == null) {
// just in case
throwRefClsReferenceCDefInfoNotFoundException(requestName, clsTheme, optionMap, cdefPackage, cdefClassName);
}
final DfRefClsReferredCDef referredCDef = new DfRefClsReferredCDef(cdefPackage, cdefClassName);
DfRefClsReferenceRegistry.getInstance().registerReference(clsTheme, clsTopMap, referredCDef);
}
use of org.dbflute.properties.assistant.classification.refcls.DfRefClsReferredCDef in project dbflute-core by dbflute.
the class DfRefClsLoadingHandler method createRefClsElement.
public DfRefClsElement createRefClsElement(String classificationName, Map<String, Object> elementMap, DfFreeGenResource resource) {
// e.g. map:{ refCls=maihamadb@MemberStatus ; refType=included }
final String refAttr = (String) elementMap.get(DfRefClsElement.KEY_REFCLS);
// of e.g. DB or "appcls" or namedcls's name
final String refClsTheme;
// classification name
final String refClsName;
final String refGroupName;
if (refAttr.contains("@")) {
// #hope other schema's reference
refClsTheme = Srl.substringFirstFront(refAttr, "@");
final String rearName = Srl.substringFirstRear(refAttr, "@");
if (rearName.contains(".")) {
refClsName = Srl.substringFirstFront(rearName, ".");
refGroupName = Srl.substringFirstRear(rearName, ".");
} else {
refClsName = rearName;
refGroupName = null;
}
} else {
// current DB as default
refClsTheme = getBasicProperties().getProjectName();
if (refAttr.contains(".")) {
refClsName = Srl.substringFirstFront(refAttr, ".");
refGroupName = Srl.substringFirstRear(refAttr, ".");
} else {
refClsName = refAttr;
refGroupName = null;
}
}
final String refType = extractRefType(classificationName, elementMap);
final DfClassificationTop referredClsTop = findReferredClsTop(classificationName, refAttr, refClsTheme, refClsName, resource);
final DfRefClsReferredCDef referredCDef = findReferredCDef(classificationName, refAttr, refClsTheme, refClsName, resource);
final DfClassificationGroup referredGroup = findReferredGroup(classificationName, refAttr, refClsTheme, refClsName, refGroupName, referredClsTop, resource);
final String resourceFile = resource.getResourceFile();
return new DfRefClsElement(refClsTheme, refClsName, refGroupName, refType, referredClsTop, referredCDef, referredGroup, resourceFile);
}
use of org.dbflute.properties.assistant.classification.refcls.DfRefClsReferredCDef 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);
}
Aggregations