Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-2015 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  * either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
 package org.dbflute.bhv.core.command;
 
 import java.util.Map;
 
 

Parameters:
<RESULT> The type of result.
Author(s):
jflute
 
 public abstract class AbstractBehaviorCommand<RESULT> implements BehaviorCommand<RESULT>, BehaviorCommandComponentSetup {
 
     // ===================================================================================
     //                                                                           Attribute
     //                                                                           =========
     // -----------------------------------------------------
     //                                     Basic Information
     //                                     -----------------
     
The table DB name. (NotNull)
 
     protected String _tableDbName;

    
Is it initialize only?
 
     protected boolean _initializeOnly;
 
     // -----------------------------------------------------
     //                                   Injection Component
     //                                   -------------------
     // these are not null
     protected DBMetaProvider _dbmetaProvider;
     protected DataSource _dataSource;
     protected StatementFactory _statementFactory;
     protected String _sqlFileEncoding;
 
     // ===================================================================================
     //                                                                              DBMeta
     //                                                                              ======
     public String getProjectName() {
         return getDBMeta().getProjectName();
     }
 
     public DBMeta getDBMeta() {
         return .provideDBMeta();
     }
 
     // ===================================================================================
     //                                                                             Factory
     //                                                                             =======
     // -----------------------------------------------------
     //                            OutsideSqlExecuteExecution
     //                            --------------------------
     // the non-primary insert also uses this so defined here
     protected OutsideSqlExecuteExecution createOutsideSqlExecuteExecution(Object pmbTypeObjString sql) {
         final Map<StringClass<?>> argNameTypeMap = createBeanArgNameTypeMap(pmbTypeObj);
         return newOutsideSqlExecuteExecution(argNameTypeMapsql);
     }
 
     protected OutsideSqlExecuteExecution newOutsideSqlExecuteExecution(Map<StringClass<?>> argNameTypeMapString sql) {
         return new OutsideSqlExecuteExecution(argNameTypeMapsql);
     }
 
     protected Map<StringClass<?>> createBeanArgNameTypeMap(Object pmbTypeObj) {
         final Map<StringClass<?>> argNameTypeMap = newArgNameTypeMap();
         if (pmbTypeObj == null) {
             return argNameTypeMap;
         }
        final Class<?> pmbType;
        if (pmbTypeObj instanceof Class<?>) {
            pmbType = (Class<?>) pmbTypeObj;
        } else {
            pmbType = pmbTypeObj.getClass();
        }
        argNameTypeMap.put("pmb"pmbType);
        return argNameTypeMap;
    }
    protected Map<StringClass<?>> newArgNameTypeMap() {
        return new LinkedHashMap<StringClass<?>>();
    }
    // -----------------------------------------------------
    //                                      ResultSetHandler
    //                                      ----------------
    }
    }
    protected TnResultSetHandler createScalarResultSetHandler(Class<?> objectType) {
        return .createScalarResultSetHandler(objectType);
    }
    protected TnResultSetHandler createScalarListResultSetHandler(Class<?> objectType) {
    }
    }
    protected TnResultSetHandler createDynamicScalarResultSetHandler(Class<?> objectType) {
    }
    // ===================================================================================
    //                                                                 Runtime Information
    //                                                                 ===================
    public String getInvokePath() {
        final InvokePathProvider provider = InternalMapContext.getInvokePathProvider();
        return provider != null ? provider.provide() : null;
    }
    // ===================================================================================
    //                                                                       Assert Helper
    //                                                                       =============
    protected void assertBasicProperty(String methodName) {
        if ( == null) {
            throw new IllegalStateException(buildAssertMessage("_tableDbName"methodName));
        }
    }
    protected void assertComponentProperty(String methodName) {
        if ( == null) {
            throw new IllegalStateException(buildAssertMessage("_dataSource"methodName));
        }
        if ( == null) {
            throw new IllegalStateException(buildAssertMessage("_statementFactory"methodName));
        }
        if ( == null) {
            throw new IllegalStateException(buildAssertMessage("_beanMetaDataFactory"methodName));
        }
        if ( == null) {
            throw new IllegalStateException(buildAssertMessage("_resultSetHandlerFactory"methodName));
        }
        if ( == null) {
            throw new IllegalStateException(buildAssertMessage("_sqlFileEncoding"methodName));
        }
    }
    protected String buildAssertMessage(String propertyNameString methodName) {
        String msg = "The property '" + Srl.ltrim(propertyName"_") + "' should not be null";
        msg = msg + " when you call " + methodName + "().";
        throw new IllegalStateException(msg);
    }
    // ===================================================================================
    //                                                                      Basic Override
    //                                                                      ==============
    @Override
    public String toString() {
        return DfTypeUtil.toClassTitle(this) + ":{" + buildSqlExecutionKey() + "}";
    }
    // ===================================================================================
    //                                                                            Accessor
    //                                                                            ========
    // -----------------------------------------------------
    //                                     Basic Information
    //                                     -----------------
    public String getTableDbName() {
        return ;
    }
    public void setTableDbName(String tableDbName) {
         = tableDbName;
    }
    public void setInitializeOnly(boolean initializeOnly) {
         = initializeOnly;
    }
    public boolean isInitializeOnly() {
        return ;
    }
    // -----------------------------------------------------
    //                                   Injection Component
    //                                   -------------------
    @Override
    public void setDBMetaProvider(DBMetaProvider dbmetaProvider) {
         = dbmetaProvider;
    }
    public void setDataSource(DataSource dataSource) {
         = dataSource;
    }
    public void setStatementFactory(StatementFactory statementFactory) {
         = statementFactory;
    }
    public void setBeanMetaDataFactory(TnBeanMetaDataFactory beanMetaDataFactory) {
         = beanMetaDataFactory;
    }
    public void setResultSetHandlerFactory(TnResultSetHandlerFactory resultSetHandlerFactory) {
         = resultSetHandlerFactory;
    }
    public void setSqlFileEncoding(String sqlFileEncoding) {
         = sqlFileEncoding;
    }
New to GrepCode? Check out our FAQ X