Search in sources :

Example 41 with ScopeInfo

use of org.dbflute.util.Srl.ScopeInfo in project dbflute-core by dbflute.

the class EmbeddedVariableNode method processDynamicBinding.

protected boolean processDynamicBinding(CommandContext ctx, Object firstValue, Class<?> firstType, String embeddedString) {
    final ScopeInfo first = Srl.extractScopeFirst(embeddedString, "/*", "*/");
    if (first == null) {
        return false;
    }
    // unsupported general purpose options in dynamic for now, e.g. MailFlute, may be almost unneeded
    final SqlAnalyzer analyzer = new SqlAnalyzer(embeddedString, _blockNullParameter);
    final Node rootNode = analyzer.analyze();
    final CommandContextCreator creator = new CommandContextCreator(new String[] { "pmb" }, new Class<?>[] { firstType });
    final CommandContext rootCtx = creator.createCommandContext(new Object[] { firstValue });
    rootNode.accept(rootCtx);
    final String sql = rootCtx.getSql();
    ctx.addSql(sql, rootCtx.getBindVariables(), rootCtx.getBindVariableTypes());
    return true;
}
Also used : CommandContextCreator(org.dbflute.twowaysql.context.CommandContextCreator) CommandContext(org.dbflute.twowaysql.context.CommandContext) ScopeInfo(org.dbflute.util.Srl.ScopeInfo) SqlAnalyzer(org.dbflute.twowaysql.SqlAnalyzer)

Example 42 with ScopeInfo

use of org.dbflute.util.Srl.ScopeInfo in project dbflute-core by dbflute.

the class DfSql2EntityTask method extractSql2EntityHintedClassification.

protected String extractSql2EntityHintedClassification(String entityName, DfCustomizeEntityInfo entityInfo, Column column) {
    final String comment = column.getComment();
    final ScopeInfo scopeInfo = Srl.extractScopeFirst(comment, "cls(", ")");
    if (scopeInfo != null) {
        final String classification = scopeInfo.getContent().trim();
        if (!getProperties().getClassificationProperties().hasClassificationTop(classification)) {
            throwUnknownClassificationSpecifiedInHintException(entityName, entityInfo, column, classification);
        }
        return classification;
    }
    return null;
}
Also used : ScopeInfo(org.dbflute.util.Srl.ScopeInfo)

Aggregations

ScopeInfo (org.dbflute.util.Srl.ScopeInfo)42 File (java.io.File)7 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 LinkedHashMap (java.util.LinkedHashMap)6 List (java.util.List)6 FileTextIO (org.dbflute.helper.filesystem.FileTextIO)6 FileInputStream (java.io.FileInputStream)4 FileNotFoundException (java.io.FileNotFoundException)4 LinkedHashSet (java.util.LinkedHashSet)4 IOException (java.io.IOException)3 Arrays (java.util.Arrays)3 Set (java.util.Set)3 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)3 DateTimeFormatter (java.time.format.DateTimeFormatter)2 TemporalAccessor (java.time.temporal.TemporalAccessor)2 DfBuildProperties (org.dbflute.DfBuildProperties)2 DfIllegalPropertySettingException (org.dbflute.exception.DfIllegalPropertySettingException)2 StringKeyMap (org.dbflute.helper.StringKeyMap)2 FileHierarchyTracer (org.dbflute.helper.filesystem.FileHierarchyTracer)2