本文整理匯總了Java中ninja.utils.NinjaConstant類的典型用法代碼示例。如果您正苦於以下問題:Java NinjaConstant類的具體用法?Java NinjaConstant怎麽用?Java NinjaConstant使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
NinjaConstant類屬於ninja.utils包,在下文中一共展示了NinjaConstant類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startServer
import ninja.utils.NinjaConstant; //導入依賴的package包/類
/**
* This method reads the configuration properties from
* your application.conf file and configures jOOQ accordingly.
*
*/
public final void startServer(){
logger.info("Starting jOOQ Module.");
// Setup basic parameters
boolean renderSchema = ninjaProperties.getBooleanWithDefault(JOOQ_RENDER_SCHEMA, true);
//renderMapping
String renderNameStyleString = ninjaProperties.getWithDefault(JOOQ_RENDER_NAME_STYLE, "QUOTED");
RenderNameStyle renderNameStyle = RenderNameStyle.fromValue(renderNameStyleString);
String renderKeywordStyleString = ninjaProperties.getWithDefault(JOOQ_RENDER_KEYWORD_STYLE, "LOWER");
RenderKeywordStyle renderKeywordStyle = RenderKeywordStyle.valueOf(renderKeywordStyleString);
boolean renderFormatted = ninjaProperties.getBooleanWithDefault(JOOQ_RENDER_FORMATTED, false);
String statementTypeString = ninjaProperties.getWithDefault(JOOQ_STATEMENT_TYPE, "PREPARED_STATEMENT");
StatementType statementType = StatementType.valueOf(statementTypeString);
boolean executeLogging = ninjaProperties.getBooleanWithDefault(JOOQ_EXECUTE_LOGGING, true);
// Execute listeners
boolean executeWithOptimisticLocking = ninjaProperties
.getBooleanWithDefault(JOOQ_EXECUTE_WITH_OPTIMISTIC_LOCKING, true);
boolean attachRecords = ninjaProperties.getBooleanWithDefault(JOOQ_ATTACH_RECORDS, true);
String sqlDialectString = ninjaProperties.getWithDefault(JOOQ_SQL_DIALECT, "DEFAULT");
SQLDialect sqlDialect = SQLDialect.valueOf(sqlDialectString);
Settings settings = new Settings();
settings.setRenderSchema(renderSchema);
settings.setRenderNameStyle(renderNameStyle);
settings.setRenderKeywordStyle(renderKeywordStyle);
settings.setRenderFormatted(renderFormatted);
settings.setStatementType(statementType);
settings.setExecuteLogging(executeLogging);
settings.setExecuteWithOptimisticLocking(executeWithOptimisticLocking);
settings.setAttachRecords(attachRecords);
String connectionUrl = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_URL);
String connectionUsername = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_USERNAME);
String connectionPassword = ninjaProperties.getWithDefault(NinjaConstant.DB_CONNECTION_PASSWORD, "");
BasicDataSource connectionPool = new BasicDataSource();
connectionPool.setUrl(connectionUrl);
connectionPool.setUsername(connectionUsername);
connectionPool.setPassword(connectionPassword);
Configuration configuration = new DefaultConfiguration();
configuration.set(sqlDialect);
configuration.set(settings);
configuration.set(connectionPool);
dslContext = DSL.using(configuration);
}
示例2: filter
import ninja.utils.NinjaConstant; //導入依賴的package包/類
@Override
public Result filter(FilterChain chain, Context context) {
Session session = context.getSession();
if (session != null) {
String username = session.get(USERNAME);
if (username != null) {
if (dao.isAdmin(username)) {
return chain.next(context);
}
}
}
return Results.forbidden().html()
.template(NinjaConstant.LOCATION_VIEW_FTL_HTML_FORBIDDEN);
}
示例3: startServerInTestMode
import ninja.utils.NinjaConstant; //導入依賴的package包/類
@Before
public void startServerInTestMode() {
System.setProperty(NinjaConstant.MODE_KEY_NAME, NinjaConstant.MODE_TEST);
ninjaTestServer = new NinjaTestServer();
ninjaTestBrowser = new TestBrowserImpl();
}
示例4: shutdownServer
import ninja.utils.NinjaConstant; //導入依賴的package包/類
@After
public void shutdownServer() {
System.clearProperty(NinjaConstant.MODE_KEY_NAME);
ninjaTestServer.shutdown();
}
示例5: startServerInTestMode
import ninja.utils.NinjaConstant; //導入依賴的package包/類
@Before
public void startServerInTestMode() {
System.setProperty(NinjaConstant.MODE_KEY_NAME, NinjaConstant.MODE_TEST);
ninjaTestServer = new NinjaTestServer();
}