use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.
the class DfSchemaXmlReader method doCreateAsCoreTo.
public static DfSchemaXmlReader doCreateAsCoreTo(DfGenetateXmlReadingFilter readingFilter) {
final DfBasicProperties basicProp = DfBuildProperties.getInstance().getBasicProperties();
final DfSchemaXmlFacadeProp facadeProp = basicProp.getSchemaXmlFacadeProp();
final String schemaXml = facadeProp.getProejctSchemaXMLFile();
return doCreateAs(schemaXml, readingFilter);
}
use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.
the class DfSchemaXmlSerializer method createAsCore.
/**
* Create instance as core process (that is JDBC task).
* @param dataSource The data source of the database. (NotNull)
* @return The new instance. (NotNull)
*/
public static DfSchemaXmlSerializer createAsCore(DfSchemaSource dataSource) {
final DfBuildProperties buildProp = DfBuildProperties.getInstance();
final DfBasicProperties basicProp = buildProp.getBasicProperties();
final DfSchemaXmlFacadeProp facadeProp = basicProp.getSchemaXmlFacadeProp();
final String schemaXml = facadeProp.getProejctSchemaXMLFile();
final String historyFile = facadeProp.getProjectSchemaHistoryFile();
final DfSchemaXmlSerializer serializer = newSerializer(dataSource, schemaXml, historyFile);
final DfDocumentProperties docProp = buildProp.getDocumentProperties();
final String craftMetaDir = docProp.getCoreCraftMetaDir();
serializer.enableCraftDiff(dataSource, craftMetaDir, DfCraftDiffAssertDirection.ROLLING_NEXT);
// to avoid getting nonsense differences in JDBC task
serializer.keepDefinitionOrderAsPrevious();
return serializer;
}
use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.
the class DfBasicPropertiesTest method test_extendedConditionBeanPackage_without_conditionBeanPackage.
public void test_extendedConditionBeanPackage_without_conditionBeanPackage() {
// ## Arrange ##
Properties prop = new Properties();
prop.setProperty("torque.packageBase", "test.base");
prop.setProperty("torque.extendedConditionBeanPackage", "extended.cbean");
DfBasicProperties packageProperties = new DfBasicProperties(prop);
// ## Act ##
String extendedConditionBeanPackage = packageProperties.getExtendedConditionBeanPackage();
// ## Assert ##
assertEquals("test.base.extended.cbean", extendedConditionBeanPackage);
}
use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.
the class DfProcedureMeta method buildProcedureSqlName.
public String buildProcedureSqlName() {
if (Srl.is_NotNull_and_NotTrimmedEmpty(_procedureSqlName)) {
return _procedureSqlName;
}
final DfBasicProperties prop = getBasicProperties();
final String sqlName = getProcedureSchema().buildSqlName(getProcedureName());
if (prop.isDatabaseDB2() && !sqlName.contains(".")) {
// patch
// DB2 needs schema prefix for calling procedures
// (actually executed and confirmed result)
_procedureSqlName = getProcedureSchema().buildSchemaQualifiedName(sqlName);
} else {
_procedureSqlName = sqlName;
}
if (prop.isDatabaseSQLServer()) {
// SQLServer returns 'sp_foo;1'
_procedureSqlName = Srl.substringLastFront(_procedureSqlName, ";");
}
return _procedureSqlName;
}
use of org.dbflute.properties.DfBasicProperties in project dbflute-core by dbflute.
the class DfBehaviorQueryPathSetupper method doCreateBhvFileResourceMap.
/**
* @param behaviorQueryPathMap The map of behavior query path. (NotNull)
* @return The map of base behavior resource. (NotNull)
* @throws DfBehaviorNotFoundException When the behavior is not found.
*/
protected Map<File, Map<String, Map<String, String>>> doCreateBhvFileResourceMap(Map<String, Map<String, String>> behaviorQueryPathMap, boolean reflectOnly) {
if (behaviorQueryPathMap.isEmpty()) {
return new HashMap<File, Map<String, Map<String, String>>>();
}
final DfBasicProperties basicProp = getBasicProperties();
final File bsbhvDir = findBsBhvDirOrWarining();
if (bsbhvDir == null) {
// warning-only ending
return new HashMap<File, Map<String, Map<String, String>>>();
}
final Map<String, File> bsbhvFileMap = createBsBhvFileMap(bsbhvDir);
final Map<File, Map<String, Map<String, String>>> reflectResourceMap = new HashMap<File, Map<String, Map<String, String>>>();
for (Entry<String, Map<String, String>> entry : behaviorQueryPathMap.entrySet()) {
final Map<String, String> behaviorQueryElementMap = entry.getValue();
// on SQL file
final String behaviorName = behaviorQueryElementMap.get(KEY_BEHAVIOR_NAME);
final String behaviorQueryPath = behaviorQueryElementMap.get(KEY_BEHAVIOR_QUERY_PATH);
final String sqlApExp = behaviorQueryElementMap.get(KEY_SQLAP);
if (reflectOnly && sqlApExp != null && "true".equalsIgnoreCase(sqlApExp)) {
// out of target for ApplicationOutsideSql if reflect-only
continue;
}
// relation point between SQL file and BsBhv
File bsbhvFile = bsbhvFileMap.get(behaviorName);
if (bsbhvFile == null) {
if (isApplicationBehaviorProject()) {
final String projectPrefixLib = getLibraryProjectPrefix();
String retryName = behaviorName;
if (retryName.startsWith(projectPrefixLib)) {
// e.g. LbFooBhv --> FooBhv
retryName = retryName.substring(projectPrefixLib.length());
}
final String projectPrefixAp = basicProp.getProjectPrefix();
// e.g. FooBhv --> BpFooBhv
retryName = projectPrefixAp + retryName;
final String additionalSuffix = getApplicationBehaviorAdditionalSuffix();
// e.g. BpFooBhv --> BpFooBhvAp
retryName = retryName + additionalSuffix;
bsbhvFile = bsbhvFileMap.get(retryName);
}
if (bsbhvFile == null) {
throwBehaviorNotFoundException(bsbhvFileMap, behaviorQueryElementMap, bsbhvDir);
}
}
Map<String, Map<String, String>> resourceElementMap = reflectResourceMap.get(bsbhvFile);
if (resourceElementMap == null) {
resourceElementMap = new LinkedHashMap<String, Map<String, String>>();
reflectResourceMap.put(bsbhvFile, resourceElementMap);
}
if (!resourceElementMap.containsKey(behaviorQueryPath)) {
resourceElementMap.put(behaviorQueryPath, behaviorQueryElementMap);
}
}
return reflectResourceMap;
}
Aggregations