use of org.dbflute.logic.generate.language.DfLanguageDependency in project dbflute-core by dbflute.
the class ForeignKey method filterDynamicFixedConditionParameterType.
protected String filterDynamicFixedConditionParameterType(String parameterType) {
final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
final DfLanguagePropertyPackageResolver resolver = lang.getLanguagePropertyPackageResolver();
return resolver.resolvePackageName(parameterType);
}
use of org.dbflute.logic.generate.language.DfLanguageDependency in project dbflute-core by dbflute.
the class DfFixedConditionDynamicAnalyzer method filterDynamicFixedConditionParameterType.
protected String filterDynamicFixedConditionParameterType(String parameterType) {
final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
final DfLanguagePropertyPackageResolver resolver = lang.getLanguagePropertyPackageResolver();
return resolver.resolvePackageName(parameterType);
}
use of org.dbflute.logic.generate.language.DfLanguageDependency in project dbflute-core by dbflute.
the class DfColumnListToStringBuilder method getColumnArgsSetupPropertyString.
public static String getColumnArgsSetupPropertyString(String beanName, List<Column> columnList) {
validateColumnList(columnList);
final boolean hasPrefix = beanName != null;
final String beanPrefix = (hasPrefix ? beanName + "." : "");
final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
final DfLanguageImplStyle implStyle = lang.getLanguageImplStyle();
String result = "";
for (Iterator<Column> ite = columnList.iterator(); ite.hasNext(); ) {
final Column column = (Column) ite.next();
final String javaName = column.getJavaName();
final String variable = column.getUncapitalisedJavaName();
final String cls = column.getClassificationName();
final String basic;
if (column.isForceClassificationSetting()) {
basic = "set" + javaName + "As" + cls + "(" + variable + ")";
} else {
basic = "set" + javaName + "(" + variable + ")";
}
final String adjusted = implStyle.adjustEntitySetPropertyCall(basic, !hasPrefix);
final String setter = beanPrefix + adjusted + ";";
if ("".equals(result)) {
result = setter;
} else {
result = result + setter;
}
}
return result;
}
use of org.dbflute.logic.generate.language.DfLanguageDependency in project dbflute-core by dbflute.
the class DfParameterBeanResolver method resolvePackageNameExceptUtil.
protected String resolvePackageNameExceptUtil(String typeName) {
final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
final DfLanguagePropertyPackageResolver resolver = lang.getLanguagePropertyPackageResolver();
return resolver.resolvePackageNameExceptUtil(typeName);
}
use of org.dbflute.logic.generate.language.DfLanguageDependency in project dbflute-core by dbflute.
the class DfBqpBehaviorFile method writeBehaviorQueryPath.
// ===================================================================================
// Write
// =====
/**
* @param resourceElementMap The map of resource element. (NotNull)
*/
protected void writeBehaviorQueryPath(Map<String, Map<String, String>> resourceElementMap) {
final String encoding = getBasicProperties().getSourceFileEncoding();
final String lineSep = getBasicProperties().getSourceCodeLineSeparator();
final DfLanguageDependency lang = getBasicProperties().getLanguageDependency();
final DfLanguageGrammar grammar = lang.getLanguageGrammar();
final String behaviorQueryPathBeginMark = getBasicProperties().getBehaviorQueryPathBeginMark();
final String behaviorQueryPathEndMark = getBasicProperties().getBehaviorQueryPathEndMark();
final DfDocumentProperties docprop = getDocumentProperties();
final StringBuilder sb = new StringBuilder();
String lineString = null;
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(_bsbhvFile), encoding));
boolean targetArea = false;
boolean done = false;
while (true) {
lineString = br.readLine();
if (lineString == null) {
if (targetArea) {
String msg = "The end mark of behavior query path was not found: bsbhvFile=" + _bsbhvFile;
throw new IllegalStateException(msg);
}
break;
}
if (targetArea) {
if (lineString.contains(behaviorQueryPathEndMark)) {
targetArea = false;
} else {
continue;
}
}
sb.append(lineString).append(lineSep);
if (!done && lineString.contains(behaviorQueryPathBeginMark)) {
targetArea = true;
final String adjustedIndent = grammar.adjustClassElementIndent(" ");
for (Entry<String, Map<String, String>> entry : resourceElementMap.entrySet()) {
final String behaviorQueryPath = entry.getKey();
final Map<String, String> behaviorQueryElementMap = entry.getValue();
final StringBuilder defSb = new StringBuilder();
final String keyTitle = DfBehaviorQueryPathSetupper.KEY_TITLE;
final String title = behaviorQueryElementMap.get(keyTitle);
if (title != null && title.trim().length() > 0) {
final String comment = buildJavaDocComment(grammar, docprop, title, adjustedIndent);
defSb.append(comment).append(lineSep);
}
defSb.append(adjustedIndent);
defSb.append(grammar.getPublicStaticFinal());
final String keySubDirectoryPath = DfBehaviorQueryPathSetupper.KEY_SUB_DIRECTORY_PATH;
final String subDirectoryPath = behaviorQueryElementMap.get(keySubDirectoryPath);
final String pathJavaNativeType = "String";
defSb.append(" ");
if (Srl.is_NotNull_and_NotTrimmedEmpty(subDirectoryPath)) {
final String subDirectoryName = Srl.replace(subDirectoryPath, "/", "_");
final String subDirectoryValue = Srl.replace(subDirectoryPath, "/", ":");
String variable = "PATH_" + subDirectoryName + "_" + behaviorQueryPath;
defSb.append(grammar.buildVariableSimpleDefinition(pathJavaNativeType, variable));
defSb.append(" = \"");
defSb.append(subDirectoryValue).append(":").append(behaviorQueryPath);
defSb.append("\";");
} else {
String variable = "PATH_" + behaviorQueryPath;
defSb.append(grammar.buildVariableSimpleDefinition(pathJavaNativeType, variable));
defSb.append(" = \"").append(behaviorQueryPath).append("\";");
}
defSb.append(lineSep);
sb.append(defSb);
}
done = true;
}
}
if (!done) {
_log.warn("*The mark of behavior query path was not found: " + _bsbhvFile);
}
} catch (IOException e) {
String msg = "BufferedReader.readLine() threw the exception: current line=" + lineString;
throw new IllegalStateException(msg, e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ignored) {
_log.warn(ignored.getMessage());
}
}
}
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(_bsbhvFile), encoding));
bw.write(sb.toString());
bw.flush();
} catch (UnsupportedEncodingException e) {
String msg = "The encoding is unsupported: encoding=" + encoding;
throw new IllegalStateException(msg, e);
} catch (FileNotFoundException e) {
String msg = "The file of base behavior was not found: bsbhvFile=" + _bsbhvFile;
throw new IllegalStateException(msg, e);
} catch (IOException e) {
String msg = "BufferedWriter.write() threw the exception: bsbhvFile=" + _bsbhvFile;
throw new IllegalStateException(msg, e);
} finally {
if (bw != null) {
try {
bw.close();
} catch (IOException ignored) {
_log.warn(ignored.getMessage());
}
}
}
}
Aggregations