本文整理汇总了Java中liquibase.util.StringUtils.trimToNull方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.trimToNull方法的具体用法?Java StringUtils.trimToNull怎么用?Java StringUtils.trimToNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类liquibase.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.trimToNull方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postConfigureQueryInstance
import liquibase.util.StringUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void postConfigureQueryInstance(TimelineQueryParameters queryInstance) {
TopicTimelineParameters blogQueryInstance = (TopicTimelineParameters) queryInstance;
if (StringUtils.trimToNull(blogQueryInstance.getSortString()) == null) {
blogQueryInstance.sortByBlogNameAsc();
}
queryInstance.getTypeSpecificExtension().setUserId(SecurityHelper.getCurrentUserId());
queryInstance.getTypeSpecificExtension().setTopicAccessLevel(TopicAccessLevel.READ);
}
示例2: getOracleSrid
import liquibase.util.StringUtils; //导入方法依赖的package包/类
/**
* Converts the given EPSG SRID to the corresponding Oracle SRID.
*
* @param srid
* the EPSG SRID.
* @param database
* the database instance.
* @return the corresponding Oracle SRID.
*/
public static String getOracleSrid(final String srid, final Database database) {
final String oracleSrid;
if (StringUtils.trimToNull(srid) == null) {
oracleSrid = null;
} else if (EPSG_TO_ORACLE_MAP.containsKey(srid)) {
oracleSrid = EPSG_TO_ORACLE_MAP.get(srid);
} else {
oracleSrid = loadOracleSrid(srid, database);
EPSG_TO_ORACLE_MAP.put(srid, oracleSrid);
}
return oracleSrid;
}
示例3: getParameters
import liquibase.util.StringUtils; //导入方法依赖的package包/类
/**
* Creates the parameters to the spatial index creation statement.
*
* @param statement
* the statement.
* @return the optional parameters for the <code>CREATE INDEX</code> statement.
*/
protected Collection<String> getParameters(final CreateSpatialIndexStatement statement) {
final Collection<String> parameters = new ArrayList<String>();
if (StringUtils.trimToNull(statement.getGeometryType()) != null) {
final String gType = getGtype(statement.getGeometryType().trim());
if (gType != null) {
parameters.add("layer_gtype=" + gType);
}
}
if (StringUtils.trimToNull(statement.getTablespace()) != null) {
parameters.add("tablespace=" + statement.getTablespace().trim());
}
return parameters;
}
示例4: escapeTableName
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public String escapeTableName(String schemaName, String tableName) {
if (schemaName == null) {
schemaName = getDefaultSchemaName();
}
if (StringUtils.trimToNull(schemaName) == null || !supportsSchemas()) {
return escapeDatabaseObject(tableName);
} else {
return escapeDatabaseObject(schemaName) + "." + escapeDatabaseObject(tableName);
}
}
示例5: escapeSequenceName
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public String escapeSequenceName(String schemaName, String sequenceName) {
if (schemaName == null) {
schemaName = getDefaultSchemaName();
}
if (StringUtils.trimToNull(schemaName) == null || !supportsSchemas()) {
return escapeDatabaseObject(sequenceName);
} else {
return escapeDatabaseObject(schemaName) + "." + escapeDatabaseObject(sequenceName);
}
}
示例6: addRollBackSQL
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public void addRollBackSQL(String sql) {
if (StringUtils.trimToNull(sql) == null) {
rollBackChanges.add(new EmptyChange());
return;
}
for (String statment : StringUtils.splitSQL(sql, null)) {
rollBackChanges.add(new RawSQLChange(statment.trim()));
}
}
示例7: convertDatabaseValueToObject
import liquibase.util.StringUtils; //导入方法依赖的package包/类
@Override
public Object convertDatabaseValueToObject(Object defaultValue, int dataType, int columnSize, int decimalDigits, Database database) throws ParseException {
if (defaultValue != null && defaultValue instanceof String) {
if (StringUtils.trimToEmpty(((String) defaultValue)).startsWith("(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_")) {
return null;
}
if (StringUtils.trimToNull(((String) defaultValue)) == null) {
return null;
}
}
return super.convertDatabaseValueToObject(defaultValue, dataType, columnSize, decimalDigits, database);
}
示例8: reportStatus
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public void reportStatus(boolean verbose, String contexts, Writer out) throws LiquibaseException {
contexts = StringUtils.trimToNull(contexts);
changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));
try {
List<ChangeSet> unrunChangeSets = listUnrunChangeSets(contexts);
if (unrunChangeSets.size() == 0) {
out.append(getDatabase().getConnection().getConnectionUserName());
out.append("@");
out.append(getDatabase().getConnection().getURL());
out.append(" is up to date");
out.append(StreamUtil.getLineSeparator());
} else {
out.append(String.valueOf(unrunChangeSets.size()));
out.append(" change sets have not been applied to ");
out.append(getDatabase().getConnection().getConnectionUserName());
out.append("@");
out.append(getDatabase().getConnection().getURL());
out.append(StreamUtil.getLineSeparator());
if (verbose) {
for (ChangeSet changeSet : unrunChangeSets) {
out.append(" ").append(changeSet.toString(false)).append(StreamUtil.getLineSeparator());
}
}
}
out.flush();
} catch (IOException e) {
throw new LiquibaseException(e);
}
}
示例9: setSchemaName
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public void setSchemaName(String schemaName) {
this.schemaName = StringUtils.trimToNull(schemaName);
}
示例10: generateSql
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public Sql[] generateSql(CreateIndexStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
// Default filter of index creation:
// creation of all indexes with associations are switched off.
List<String> associatedWith = StringUtils.splitAndTrim(statement.getAssociatedWith(), ",");
if (associatedWith != null && (associatedWith.contains(Index.MARK_PRIMARY_KEY) ||
associatedWith.contains(Index.MARK_UNIQUE_CONSTRAINT) ||
associatedWith.contains(Index.MARK_FOREIGN_KEY))) {
return new Sql[0];
}
StringBuilder buffer = new StringBuilder();
buffer.append("CREATE ");
if (statement.isUnique() != null && statement.isUnique()) {
buffer.append("UNIQUE ");
}
buffer.append("INDEX ");
if (statement.getIndexName() != null) {
String indexSchema = statement.getTableSchemaName();
buffer.append(database.escapeIndexName(null, statement.getIndexName())).append(" ");
}
buffer.append("ON ");
buffer.append(database.escapeTableName(statement.getTableSchemaName(), statement.getTableName())).append("(");
Iterator<String> iterator = Arrays.asList(statement.getColumns()).iterator();
while (iterator.hasNext()) {
String column = iterator.next();
buffer.append(database.escapeColumnName(statement.getTableSchemaName(), statement.getTableName(), column));
if (iterator.hasNext()) {
buffer.append(", ");
}
}
buffer.append(")");
if (StringUtils.trimToNull(statement.getTablespace()) != null && database.supportsTablespaces()) {
if (database instanceof MSSQLDatabase || database instanceof SybaseASADatabase) {
buffer.append(" ON ").append(statement.getTablespace());
} else if (database instanceof DB2Database || database instanceof InformixDatabase) {
buffer.append(" IN ").append(statement.getTablespace());
} else {
buffer.append(" TABLESPACE ").append(statement.getTablespace());
}
}
return new Sql[]{new UnparsedSql(buffer.toString())};
}
示例11: futureRollbackSQL
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public void futureRollbackSQL(Integer count, String contexts, Writer output) throws LiquibaseException {
contexts = StringUtils.trimToNull(contexts);
changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));
LoggingExecutor outputTemplate = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);
Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);
ExecutorService.getInstance().setExecutor(database, outputTemplate);
outputHeader("SQL to roll back currently unexecuted changes");
LockService lockService = LockService.getInstance(database);
lockService.waitForLock();
try {
DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);
checkDatabaseChangeLogTable(false, changeLog, contexts);
changeLog.validate(database, contexts);
ChangeLogIterator logIterator;
if (count == null) {
logIterator = new ChangeLogIterator(changeLog,
new NotRanChangeSetFilter(database.getRanChangeSetList()),
new ContextChangeSetFilter(contexts),
new DbmsChangeSetFilter(database));
} else {
ChangeLogIterator forwardIterator = new ChangeLogIterator(changeLog,
new NotRanChangeSetFilter(database.getRanChangeSetList()),
new ContextChangeSetFilter(contexts),
new DbmsChangeSetFilter(database),
new CountChangeSetFilter(count));
final ListVisitor listVisitor = new ListVisitor();
forwardIterator.run(listVisitor, database);
logIterator = new ChangeLogIterator(changeLog,
new NotRanChangeSetFilter(database.getRanChangeSetList()),
new ContextChangeSetFilter(contexts),
new DbmsChangeSetFilter(database),
new ChangeSetFilter() {
public boolean accepts(ChangeSet changeSet) {
return listVisitor.getSeenChangeSets().contains(changeSet);
}
});
}
logIterator.run(new RollbackVisitor(database), database);
} finally {
lockService.releaseLock();
ExecutorService.getInstance().setExecutor(database, oldTemplate);
}
try {
output.flush();
} catch (IOException e) {
throw new LiquibaseException(e);
}
}