Search in sources :

Example 1 with DfBasicProperties

use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.

the class TorqueDataModelTask method setupControlTemplate.

protected void setupControlTemplate() {
    final DfLittleAdjustmentProperties littleProp = getLittleAdjustmentProperties();
    final String title;
    final String control;
    final DfBasicProperties basicProp = getBasicProperties();
    if (littleProp.isAlternateGenerateControlValid()) {
        title = "alternate control";
        control = littleProp.getAlternateGenerateControl();
    } else {
        final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
        if (basicProp.isApplicationBehaviorProject()) {
            title = lang.getLanguageTitle() + " BhvAp";
            control = lang.getGenerateControlBhvAp();
        } else {
            title = lang.getLanguageTitle();
            control = lang.getGenerateControl();
        }
    }
    _log.info("");
    _log.info("...Using " + title + " control: " + control);
    setControlTemplate(control);
}
Also used : DfLittleAdjustmentProperties(org.dbflute.properties.DfLittleAdjustmentProperties) DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Example 2 with DfBasicProperties

use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.

the class AppData method createAsEmpty.

public static AppData createAsEmpty() {
    // e.g. ReplaceSchema's generation
    final DfBasicProperties basicProp = DfBuildProperties.getInstance().getBasicProperties();
    final DfDatabaseTypeFacadeProp facadeProp = basicProp.getDatabaseTypeFacadeProp();
    final String databaseType = facadeProp.getTargetDatabase();
    final AppData appData = new AppData(databaseType);
    final Database database = new Database();
    database.setAppData(appData);
    appData.addDatabase(database);
    return appData;
}
Also used : DfDatabaseTypeFacadeProp(org.dbflute.properties.facade.DfDatabaseTypeFacadeProp) DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Example 3 with DfBasicProperties

use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.

the class DfOutsideSqlCollector method handleSecondaryDirectory.

protected boolean handleSecondaryDirectory(DfOutsideSqlPack outsideSqlPack, DfOutsideSqlLocation sqlLocation, String sqlDirectory, boolean checkNotFound) {
    final DfBasicProperties basicProp = getBasicProperties();
    final DfLanguageDependency lang = basicProp.getLanguageDependency();
    final String secondaryDirectory = lang.convertToSecondaryOutsideSqlDirectory(sqlDirectory);
    final boolean foundSecondaryDirectory;
    if (secondaryDirectory != null && !sqlDirectory.equals(secondaryDirectory)) {
        try {
            outsideSqlPack.addAll(collectSqlFile(secondaryDirectory, sqlLocation));
        } catch (FileNotFoundException e) {
            if (checkNotFound) {
                String msg = "The sqlDirectory does not exist: " + secondaryDirectory;
                throw new IllegalStateException(msg);
            } else {
                _log.info("Not found sql directory on resources: " + secondaryDirectory);
            }
        }
        foundSecondaryDirectory = true;
    } else {
        foundSecondaryDirectory = false;
    }
    return foundSecondaryDirectory;
}
Also used : FileNotFoundException(java.io.FileNotFoundException) DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Example 4 with DfBasicProperties

use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.

the class DfBehaviorQueryPathSetupper method findBsBhvDirOrWarining.

// -----------------------------------------------------
// BsBhv Directory
// ---------------
protected File findBsBhvDirOrWarining() {
    // null allowed
    final DfBasicProperties basicProp = getBasicProperties();
    final String outputDirectory = basicProp.getGenerateOutputDirectory();
    final String mainPath = buildBsBhvPathBase(basicProp, outputDirectory);
    final File mainBsbhvDir = new File(mainPath);
    if (mainBsbhvDir.exists() && hasProgramFile(basicProp, mainBsbhvDir)) {
        // normally here
        return mainBsbhvDir;
    }
    // not exception just in case (sub function here)
    if (basicProp.isGenerationGapileValid()) {
        final String gapileDirectory = basicProp.getGapileDirectory();
        final String gapilePath = buildBsBhvPathBase(basicProp, gapileDirectory);
        final File gapileBsbhvDir = new File(gapilePath);
        if (gapileBsbhvDir.exists() && hasProgramFile(basicProp, gapileBsbhvDir)) {
            return gapileBsbhvDir;
        } else {
            _log.warn("*Not found the base behavior for behavior query path: " + gapilePath);
            return null;
        }
    } else {
        _log.warn("*Not found the base behavior for behavior query path: " + mainPath);
        return null;
    }
}
Also used : DfOutsideSqlFile(org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlFile) File(java.io.File) DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Example 5 with DfBasicProperties

use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.

the class DfBqpBehaviorFile method doAnalyze.

protected void doAnalyze() {
    String tableKeyName = _bsbhvFile.getName();
    final int extIndex = tableKeyName.lastIndexOf(".");
    if (extIndex >= 0) {
        tableKeyName = tableKeyName.substring(0, extIndex);
    }
    // ApplicationBehavior resolved here
    final DfBasicProperties basicProperties = getBasicProperties();
    final String bhvSuffix = getBhvApResolvedBehaviorSuffix();
    final String projectPrefix = getBhvApResolvedProjectPrefix();
    if (tableKeyName.endsWith(bhvSuffix)) {
        tableKeyName = tableKeyName.substring(0, tableKeyName.length() - bhvSuffix.length());
    }
    if (Srl.is_NotNull_and_NotTrimmedEmpty(projectPrefix) && tableKeyName.startsWith(projectPrefix)) {
        tableKeyName = tableKeyName.substring(projectPrefix.length());
    }
    final String basePrefix = basicProperties.getBasePrefix();
    if (Srl.is_NotNull_and_NotTrimmedEmpty(basePrefix) && tableKeyName.startsWith(basePrefix)) {
        tableKeyName = tableKeyName.substring(basePrefix.length(), tableKeyName.length());
    }
    _tableKeyName = tableKeyName;
}
Also used : DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Aggregations

DfBasicProperties (org.dbflute.properties.DfBasicProperties)20 Properties (java.util.Properties)4 DfLanguageDependency (org.dbflute.logic.generate.language.DfLanguageDependency)3 DfSchemaXmlFacadeProp (org.dbflute.properties.facade.DfSchemaXmlFacadeProp)3 File (java.io.File)2 DfOutsideSqlFile (org.dbflute.logic.sql2entity.analyzer.DfOutsideSqlFile)2 DfDatabaseTypeFacadeProp (org.dbflute.properties.facade.DfDatabaseTypeFacadeProp)2 FileNotFoundException (java.io.FileNotFoundException)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 DfBuildProperties (org.dbflute.DfBuildProperties)1 StringKeyMap (org.dbflute.helper.StringKeyMap)1 DfLanguageGrammar (org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)1 DfLanguageClassPackage (org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage)1 DfDocumentProperties (org.dbflute.properties.DfDocumentProperties)1 DfLittleAdjustmentProperties (org.dbflute.properties.DfLittleAdjustmentProperties)1 DfSequenceIdentityProperties (org.dbflute.properties.DfSequenceIdentityProperties)1