Search in sources :

Example 1 with DfFreeGenMapProp

use of org.dbflute.logic.manage.freegen.DfFreeGenMapProp 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);
}
Also used : Path(java.nio.file.Path) DfPmFileTableLoader(org.dbflute.logic.manage.freegen.table.pmfile.DfPmFileTableLoader) DfMailFluteTableLoader(org.dbflute.logic.manage.freegen.table.mailflute.DfMailFluteTableLoader) DfAppClsTableLoader(org.dbflute.logic.manage.freegen.table.appcls.DfAppClsTableLoader) ArrayList(java.util.ArrayList) DfFreeGenResource(org.dbflute.logic.manage.freegen.DfFreeGenResource) DfWebClsTableLoader(org.dbflute.logic.manage.freegen.table.appcls.DfWebClsTableLoader) DfFreeGenMapProp(org.dbflute.logic.manage.freegen.DfFreeGenMapProp) ArrayList(java.util.ArrayList) List(java.util.List) File(java.io.File) DfLastaDocContentsActionMap(org.dbflute.properties.assistant.lastaflute.DfLastaDocContentsMap.DfLastaDocContentsActionMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

File (java.io.File)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 DfFreeGenMapProp (org.dbflute.logic.manage.freegen.DfFreeGenMapProp)1 DfFreeGenResource (org.dbflute.logic.manage.freegen.DfFreeGenResource)1 DfAppClsTableLoader (org.dbflute.logic.manage.freegen.table.appcls.DfAppClsTableLoader)1 DfWebClsTableLoader (org.dbflute.logic.manage.freegen.table.appcls.DfWebClsTableLoader)1 DfMailFluteTableLoader (org.dbflute.logic.manage.freegen.table.mailflute.DfMailFluteTableLoader)1 DfPmFileTableLoader (org.dbflute.logic.manage.freegen.table.pmfile.DfPmFileTableLoader)1 DfLastaDocContentsActionMap (org.dbflute.properties.assistant.lastaflute.DfLastaDocContentsMap.DfLastaDocContentsActionMap)1