use of org.dbflute.logic.manage.freegen.table.pmfile.DfPmFileTableLoader in project dbflute-core by dbflute.
the class DfLastaDocTableLoader method loadTable.
// ===================================================================================
// Load Table
// ==========
// ; resourceMap = map:{
// ; baseDir = ../src/main
// ; resourceType = LASTA_DOC
// }
// ; outputMap = map:{
// ; templateFile = LaDocHtml.vm
// ; outputDirectory = $$baseDir$$/../test/resources
// ; package = doc
// ; className = lastadoc-dockside
// ; fileExt = html
// }
// ; optionMap = map:{
// ; targetDir = $$baseDir$$/java
// }
@Override
public DfFreeGenMetaData loadTable(String requestName, DfFreeGenResource resource, DfFreeGenMapProp mapProp) {
final Map<String, Object> optionMap = mapProp.getOptionMap();
final String targetDir = resource.resolveBaseDir((String) optionMap.get("targetDir"));
final File rootDir = new File(targetDir);
if (!rootDir.exists()) {
throw new IllegalStateException("Not found the targetDir: " + targetDir);
}
final DfLastaFlutePhysicalHolder physicalHolder = preparePhysicalHolder(rootDir);
final List<Map<String, Object>> columnList = prepareColumnList(physicalHolder);
executeTestDocument(optionMap);
final Path lastaDocFile = acceptLastaDocFile(optionMap);
if (Files.exists(lastaDocFile)) {
optionMap.putAll(decodeJsonMap(lastaDocFile));
}
optionMap.put("appList", findAppList(mapProp));
if (optionMap.get("mailPackage") != null) {
optionMap.put("mailList", new DfMailFluteTableLoader(true).loadTable(requestName, resource, mapProp).getTableList());
}
if (optionMap.get("templatePackage") != null) {
optionMap.put("templateList", new DfPmFileTableLoader(true).loadTable(requestName, resource, mapProp).getTableList());
}
if (optionMap.get("namedclsList") != null) {
// should be before appcls, webcls for refCls
@SuppressWarnings("unchecked") final List<Map<String, Object>> namedclsList = (List<Map<String, Object>>) optionMap.get("namedclsList");
if (!namedclsList.isEmpty()) {
final List<Map<String, Object>> loadedList = new ArrayList<Map<String, Object>>();
for (Map<String, Object> namedclsMap : namedclsList) {
final String clsTheme = (String) namedclsMap.get("clsTheme");
final DfFreeGenResource docResource = createDocResource(resource, namedclsMap, clsTheme);
final DfFreeGenMapProp docMapProp = createDocMapProp(mapProp, namedclsMap);
loadedList.add(new DfAppClsTableLoader().loadTable(requestName, docResource, docMapProp).getOptionMap());
}
// override, convert to loaded list
optionMap.put("namedclsList", loadedList);
}
}
if (optionMap.get("appclsPackage") != null) {
// should be after namedcls for refCls
final String clsTheme = "appcls";
final DfFreeGenResource docResource = createDocResource(resource, optionMap, clsTheme);
final DfFreeGenMapProp docMapProp = createDocMapProp(mapProp, mapProp.getOptionMap());
optionMap.put("appclsMap", new DfAppClsTableLoader().loadTable(requestName, docResource, docMapProp).getOptionMap());
}
if (optionMap.get("webclsPackage") != null) {
// should be after appcls for refCls
final String clsTheme = "webcls";
final DfFreeGenResource docResource = createDocResource(resource, optionMap, clsTheme);
final DfFreeGenMapProp docMapProp = createDocMapProp(mapProp, mapProp.getOptionMap());
optionMap.put("webclsMap", new DfWebClsTableLoader().loadTable(requestName, docResource, docMapProp).getOptionMap());
}
setupContentsAdjustment(optionMap);
return DfFreeGenMetaData.asOnlyOne(optionMap, "unused", columnList);
}
Aggregations