Search in sources :

Example 16 with DfBasicProperties

use of org.dbflute.properties.DfBasicProperties 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 17 with DfBasicProperties

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

the class DfLanguagePropertyPackageResolver method doResolvePackageName.

protected String doResolvePackageName(String typeName, boolean exceptUtil) {
    if (typeName == null) {
        return typeName;
    }
    final String processed = processLanguageType(typeName, exceptUtil);
    if (processed != null) {
        return processed;
    }
    if (typeName.contains(VAR_CDEF)) {
        final DfBasicProperties prop = getBasicProperties();
        final String pkg = prop.getBaseCommonPackage();
        typeName = DfStringUtil.replace(typeName, VAR_CDEF, pkg + "." + prop.getCDefPureName());
    }
    if (typeName.contains(VAR_DOMAIN + ".")) {
        // as domain entity
        final String pkg = getBasicProperties().getExtendedEntityPackage();
        typeName = Srl.replace(typeName, VAR_DOMAIN + ".", pkg + ".");
    }
    if (typeName.contains(VAR_CUSTOMIZE + ".")) {
        // as customize entity
        final String pkg = getOutsideSqlProperties().getExtendedEntityPackage();
        typeName = Srl.replace(typeName, VAR_CUSTOMIZE + ".", pkg + ".");
    }
    if (typeName.contains(VAR_PMB + ".")) {
        // as parameter-bean
        final String pkg = getOutsideSqlProperties().getExtendedParameterBeanPackage();
        typeName = Srl.replace(typeName, VAR_PMB + ".", pkg + ".");
    }
    return typeName;
}
Also used : DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Example 18 with DfBasicProperties

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

the class Table method isUseIdentity.

// ===================================================================================
// Identity
// ========
/**
 * Determine whether this table uses an identity.
 * @return The determination, true or false.
 */
public boolean isUseIdentity() {
    final DfBasicProperties basicProperties = getBasicProperties();
    // because serial type is treated as sequence
    if (basicProperties.isDatabasePostgreSQL()) {
        return false;
    }
    // It gives priority to auto-increment information of JDBC.
    if (hasAutoIncrementColumn()) {
        return true;
    }
    final DfSequenceIdentityProperties prop = getSequenceIdentityProperties();
    return prop.getIdentityColumnName(getTableDbName()) != null;
}
Also used : DfSequenceIdentityProperties(org.dbflute.properties.DfSequenceIdentityProperties) DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Example 19 with DfBasicProperties

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

the class Table method extractPostgreSQLSerialSequenceName.

/**
 * Extract sequence name of postgreSQL serial type column.
 * @return Sequence name of postgreSQL serial type column. (NullAllowed: If null, not found)
 */
protected String extractPostgreSQLSerialSequenceName() {
    final DfBasicProperties basicProperties = getBasicProperties();
    if (!basicProperties.isDatabasePostgreSQL() || !hasAutoIncrementColumn()) {
        return null;
    }
    final Column autoIncrementColumn = getAutoIncrementColumn();
    if (autoIncrementColumn == null) {
        return null;
    }
    final String defaultValue = autoIncrementColumn.getDefaultValue();
    if (defaultValue == null) {
        return null;
    }
    final String prefix = "nextval('";
    if (!defaultValue.startsWith(prefix)) {
        return null;
    }
    final String excludedPrefixString = defaultValue.substring(prefix.length());
    final int endIndex = excludedPrefixString.indexOf("'");
    if (endIndex < 0) {
        return null;
    }
    return excludedPrefixString.substring(0, endIndex);
}
Also used : DfBasicProperties(org.dbflute.properties.DfBasicProperties)

Example 20 with DfBasicProperties

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

the class Procedure method getProcedureUniqueName.

// ===================================================================================
// Derived Property
// ================
public String getProcedureUniqueName() {
    final DfBasicProperties prop = getBasicProperties();
    final String filteredName;
    if (prop.isDatabaseSQLServer()) {
        // SQLServer returns 'sp_foo;1'
        filteredName = Srl.substringLastFront(_procedureName, ";");
    } else {
        filteredName = _procedureName;
    }
    return _unifiedSchema.getCatalogSchema() + "." + filteredName;
}
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