Search in sources :

Example 1 with DfLanguageClassPackage

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage in project dbflute-core by dbflute.

the class DfBasicProperties method getCDefPureName.

public String getCDefPureName() {
    // e.g. CDef
    final String projectPrefix = getProjectPrefix();
    final String allcommonPrefix = getAllcommonPrefix();
    final DfLanguageClassPackage classPackage = getLanguageDependency().getLanguageClassPackage();
    return classPackage.buildCDefPureClassName(projectPrefix, allcommonPrefix);
}
Also used : DfLanguageClassPackage(org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage)

Example 2 with DfLanguageClassPackage

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage in project dbflute-core by dbflute.

the class DfBqpOutsideSqlFile method doAnalyze.

protected void doAnalyze() {
    final String exbhvMark;
    {
        final String exbhvPackage;
        if (isApplicationBehaviorProject()) {
            exbhvPackage = getLibraryBehaviorPackage();
        } else {
            exbhvPackage = getBasicProperties().getExtendedBehaviorPackage();
        }
        final String exbhvName = Srl.substringLastRear(exbhvPackage, ".");
        final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
        final DfLanguageClassPackage pkg = lang.getLanguageClassPackage();
        final String sqlPackage;
        if (getOutsideSqlProperties().isSqlPackageValid()) {
            final String pureSqlPackage = getOutsideSqlProperties().getSqlPackage();
            if (pureSqlPackage.endsWith(exbhvName)) {
                // contains 'exbhv'
                sqlPackage = Srl.substringLastFront(pureSqlPackage, ".");
            } else {
                sqlPackage = pureSqlPackage;
            }
        } else {
            sqlPackage = Srl.substringLastFront(exbhvPackage, ".");
        }
        exbhvMark = pkg.buildExtendedBehaviorPackageMark(sqlPackage, exbhvName);
    }
    // both types are target
    final String bhvSuffix = "Bhv";
    final String bhvApSuffix = getApplicationBehaviorAdditionalSuffix();
    final Pattern bqpPattern = Pattern.compile(".+" + exbhvMark + ".+" + bhvSuffix + "_.+.sql$");
    final Pattern bqpApPattern = Pattern.compile(".+" + exbhvMark + ".+" + bhvApSuffix + "_.+.sql$");
    final String path = getSlashPath(_outsideSqlFile.getPhysicalFile());
    final Matcher matcher = bqpPattern.matcher(path);
    final Matcher matcherAp = bqpApPattern.matcher(path);
    final String foundSuffix;
    if (matcher.matches()) {
        foundSuffix = bhvSuffix;
    } else if (matcherAp.matches()) {
        foundSuffix = bhvApSuffix;
    } else {
        _bqp = false;
        return;
    }
    _bqp = true;
    String simpleFileName = path.substring(path.lastIndexOf(exbhvMark) + exbhvMark.length());
    if (simpleFileName.contains("/")) {
        _subDirectoryPath = simpleFileName.substring(0, simpleFileName.lastIndexOf("/"));
        simpleFileName = simpleFileName.substring(simpleFileName.lastIndexOf("/") + "/".length());
    }
    final int behaviorNameMarkIndex = simpleFileName.indexOf(foundSuffix + "_");
    final int behaviorNameEndIndex = behaviorNameMarkIndex + foundSuffix.length();
    final int behaviorQueryPathStartIndex = behaviorNameMarkIndex + (foundSuffix + "_").length();
    final int behaviorQueryPathEndIndex = simpleFileName.lastIndexOf(".sql");
    _entityName = simpleFileName.substring(0, behaviorNameMarkIndex);
    _behaviorName = simpleFileName.substring(0, behaviorNameEndIndex);
    _behaviorQueryPath = simpleFileName.substring(behaviorQueryPathStartIndex, behaviorQueryPathEndIndex);
    _filePath = path;
    if (_outsideSqlFile.isSqlAp()) {
        _sqlAp = true;
    }
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguageClassPackage(org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage)

Example 3 with DfLanguageClassPackage

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage in project dbflute-core by dbflute.

the class DfCommonColumnProperties method getAccessContextFqcn.

public String getAccessContextFqcn() {
    if (_accessContextFqcn != null) {
        return _accessContextFqcn;
    }
    final DfBasicProperties prop = getBasicProperties();
    final boolean hibernate = prop.isFriendsHibernate();
    final String baseCommonPackage = prop.getBaseCommonPackage();
    final String projectPrefix = prop.getProjectPrefix();
    final String accessContext;
    if (hibernate) {
        accessContext = baseCommonPackage + "." + projectPrefix + "AccessContext";
    } else {
        final DfLanguageClassPackage classPkg = prop.getLanguageDependency().getLanguageClassPackage();
        accessContext = classPkg.buildAccessContextFqcn(baseCommonPackage, projectPrefix);
    }
    _accessContextFqcn = accessContext;
    return _accessContextFqcn;
}
Also used : DfLanguageClassPackage(org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage)

Example 4 with DfLanguageClassPackage

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage in project dbflute-core by dbflute.

the class DfGapileProcess method createReflector.

protected DfGapileClassReflector createReflector(String gapileDirectory) {
    final DfBasicProperties prop = getBasicProperties();
    final String outputDirectory = prop.getGenerateOutputDirectory();
    final String packageBase = prop.getPackageBase();
    final DfLanguageDependency lang = prop.getLanguageDependency();
    final DfLanguageClassPackage classPackage = lang.getLanguageClassPackage();
    final DfLanguageGrammar grammar = lang.getLanguageGrammar();
    return new DfGapileClassReflector(outputDirectory, packageBase, classPackage, grammar, gapileDirectory);
}
Also used : DfLanguageGrammar(org.dbflute.logic.generate.language.grammar.DfLanguageGrammar) DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguageClassPackage(org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage) DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Example 5 with DfLanguageClassPackage

use of org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage in project dbflute-core by dbflute.

the class Database method createOldClassHandler.

protected DfOldClassHandler createOldClassHandler() {
    final DfGenerator generator = getGeneratorInstance();
    final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
    final DfLanguageClassPackage pkg = lang.getLanguageClassPackage();
    return new DfOldClassHandler(generator, pkg, getTableList());
}
Also used : DfLanguageDependency(org.dbflute.logic.generate.language.DfLanguageDependency) DfLanguageClassPackage(org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage) DfGenerator(org.dbflute.friends.velocity.DfGenerator) DfOldClassHandler(org.dbflute.logic.generate.deletefile.DfOldClassHandler)

Aggregations

DfLanguageClassPackage (org.dbflute.logic.generate.language.pkgstyle.DfLanguageClassPackage)5 DfLanguageDependency (org.dbflute.logic.generate.language.DfLanguageDependency)3 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 DfGenerator (org.dbflute.friends.velocity.DfGenerator)1 DfOldClassHandler (org.dbflute.logic.generate.deletefile.DfOldClassHandler)1 DfLanguageGrammar (org.dbflute.logic.generate.language.grammar.DfLanguageGrammar)1 DfBasicProperties (org.dbflute.properties.DfBasicProperties)1