本文整理汇总了Java中org.pentaho.di.core.util.StringUtil类的典型用法代码示例。如果您正苦于以下问题:Java StringUtil类的具体用法?Java StringUtil怎么用?Java StringUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringUtil类属于org.pentaho.di.core.util包,在下文中一共展示了StringUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUsedVariables
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
public List<String> getUsedVariables()
{
// Get the list of Strings.
List<StringSearchResult> stringList = getStringList(true, true, false, true);
List<String> varList = new ArrayList<String>();
// Look around in the strings, see what we find...
for (int i=0;i<stringList.size();i++)
{
StringSearchResult result = stringList.get(i);
StringUtil.getUsedVariables(result.getString(), varList, false);
}
return varList;
}
示例2: populateMetaAndData
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
private static void populateMetaAndData(int i, Object[] rowString10, RowMetaInterface metaString10, Object[] rowMixed10, RowMetaInterface metaMixed10)
{
rowString10[i] = StringUtil.generateRandomString(20, "", "", false);
ValueMetaInterface meta = new ValueMeta("String"+(i+1), ValueMetaInterface.TYPE_STRING, 20, 0);
metaString10.addValueMeta(meta);
rowMixed10[i*5 + 0] = StringUtil.generateRandomString(20, "", "", false);
ValueMetaInterface meta0 = new ValueMeta("String"+(i*5+1), ValueMetaInterface.TYPE_STRING, 20, 0);
metaMixed10.addValueMeta(meta0);
rowMixed10[i*5 + 1] = new Date();
ValueMetaInterface meta1 = new ValueMeta("String"+(i*5+1), ValueMetaInterface.TYPE_DATE);
metaMixed10.addValueMeta(meta1);
rowMixed10[i*5 + 2] = new Double( Math.random() * 1000000 );
ValueMetaInterface meta2 = new ValueMeta("String"+(i*5+1), ValueMetaInterface.TYPE_NUMBER, 12, 4);
metaMixed10.addValueMeta(meta2);
rowMixed10[i*5 + 3] = new Long( (long)(Math.random() * 1000000) );
ValueMetaInterface meta3 = new ValueMeta("String"+(i*5+1), ValueMetaInterface.TYPE_INTEGER, 8, 0);
metaMixed10.addValueMeta(meta3);
rowMixed10[i*5 + 4] = Boolean.valueOf( Math.random() > 0.5 ? true : false );
ValueMetaInterface meta4 = new ValueMeta("String"+(i*5+1), ValueMetaInterface.TYPE_BOOLEAN);
metaMixed10.addValueMeta(meta4);
}
示例3: encryptPasswordIfNotUsingVariables
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
/**
* Encrypt the password, but only if the password doesn't contain any variables.
* @param password The password to encrypt
* @return The encrypted password or the
*/
public static final String encryptPasswordIfNotUsingVariables(String password)
{
String encrPassword = "";
List<String> varList = new ArrayList<String>();
StringUtil.getUsedVariables(password, varList, true);
if (varList.isEmpty())
{
encrPassword = PASSWORD_ENCRYPTED_PREFIX+Encr.encryptPassword(password);
}
else
{
encrPassword = password;
}
return encrPassword;
}
示例4: getUsedVariables
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
/**
* Gets a list of the used variables in this transformation.
*
* @return a list of the used variables in this transformation.
*/
public List<String> getUsedVariables()
{
// Get the list of Strings.
List<StringSearchResult> stringList = getStringList(true, true, false, true);
List<String> varList = new ArrayList<String>();
// Look around in the strings, see what we find...
for (int i=0;i<stringList.size();i++)
{
StringSearchResult result = stringList.get(i);
StringUtil.getUsedVariables(result.getString(), varList, false);
}
return varList;
}
示例5: replaceNull
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
public void replaceNull(Object[] row, ValueMetaInterface sourceValueMeta,
int i, String realReplaceByValue, String realconversionMask, boolean setEmptystring) throws Exception
{
if(setEmptystring)
{
row[i]= StringUtil.EMPTY_STRING;
}
else
{
// DO CONVERSION OF THE DEFAULT VALUE ...
// Entered by user
ValueMetaInterface targetValueMeta = data.outputRowMeta.getValueMeta(i);
if(!Const.isEmpty(realconversionMask)) sourceValueMeta.setConversionMask(realconversionMask);
row[i] = targetValueMeta.convertData(sourceValueMeta, realReplaceByValue);
}
}
示例6: populateMetaAndData
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
private static void populateMetaAndData( int i, Object[] rowString10, RowMetaInterface metaString10,
Object[] rowMixed10, RowMetaInterface metaMixed10 ) {
rowString10[i] = StringUtil.generateRandomString( 20, "", "", false );
ValueMetaInterface meta = new ValueMetaString( "String" + ( i + 1 ), 20, 0 );
metaString10.addValueMeta( meta );
rowMixed10[i * 5 + 0] = StringUtil.generateRandomString( 20, "", "", false );
ValueMetaInterface meta0 = new ValueMetaString( "String" + ( i * 5 + 1 ), 20, 0 );
metaMixed10.addValueMeta( meta0 );
rowMixed10[i * 5 + 1] = new Date();
ValueMetaInterface meta1 = new ValueMetaDate( "String" + ( i * 5 + 1 ) );
metaMixed10.addValueMeta( meta1 );
rowMixed10[i * 5 + 2] = new Double( Math.random() * 1000000 );
ValueMetaInterface meta2 = new ValueMetaNumber( "String" + ( i * 5 + 1 ), 12, 4 );
metaMixed10.addValueMeta( meta2 );
rowMixed10[i * 5 + 3] = new Long( (long) ( Math.random() * 1000000 ) );
ValueMetaInterface meta3 = new ValueMetaInteger( "String" + ( i * 5 + 1 ), 8, 0 );
metaMixed10.addValueMeta( meta3 );
rowMixed10[i * 5 + 4] = Boolean.valueOf( Math.random() > 0.5 ? true : false );
ValueMetaInterface meta4 = new ValueMetaBoolean( "String" + ( i * 5 + 1 ) );
metaMixed10.addValueMeta( meta4 );
}
示例7: buildUniqueFilename
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
public String buildUniqueFilename( String filename ) {
String retval = "";
if ( Utils.isEmpty( filename ) ) {
return null;
}
int lenstring = filename.length();
int lastindexOfDot = filename.lastIndexOf( '.' );
if ( lastindexOfDot == -1 ) {
lastindexOfDot = lenstring;
}
retval = filename.substring( 0, lastindexOfDot );
retval += StringUtil.getFormattedDateTimeNow();
retval += filename.substring( lastindexOfDot, lenstring );
return retval;
}
示例8: checkPasswordVisible
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
private void checkPasswordVisible() {
String password = m_passText.getText();
ArrayList<String> list = new ArrayList<String>();
StringUtil.getUsedVariables(password, list, true);
if (list.size() == 0) {
m_passText.setEchoChar('*');
} else {
m_passText.setEchoChar('\0'); // show everything
}
}
示例9: needsDownload
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
/**
* See if the filename on the FTP server needs downloading.
* The default is to check the presence of the file in the target directory.
* If you need other functionality, extend this class and build it into a plugin.
*
* @param filename The local filename to check
* @param remoteFileSize The size of the remote file
* @return true if the file needs downloading
*/
protected boolean needsDownload(String filename)
{
boolean retval=false;
File file = new File(filename);
//return !file.exists();
if(!file.exists())
{
// Local file not exists!
return true;
}else
{
// Local file exists!
if(ifFileExists==ifFileExistsCreateUniq)
{
// Create file with unique name
int lenstring=targetFilename.length();
int lastindexOfDot=targetFilename.lastIndexOf('.');
if(lastindexOfDot==-1) lastindexOfDot=lenstring;
targetFilename=targetFilename.substring(0, lastindexOfDot)
+ StringUtil.getFormattedDateTimeNow(true)
+ targetFilename.substring(lastindexOfDot, lenstring);
return true;
}
else if(ifFileExists==ifFileExistsFail)
{
updateErrors();
}
}
return retval;
}
示例10: buildUniqueFilename
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
public String buildUniqueFilename(String filename)
{
String retval="";
if(Const.isEmpty(filename)) return null;
int lenstring=filename.length();
int lastindexOfDot=filename.lastIndexOf('.');
if(lastindexOfDot==-1) lastindexOfDot=lenstring;
retval=filename.substring(0, lastindexOfDot);
retval+=StringUtil.getFormattedDateTimeNow();
retval+=filename.substring(lastindexOfDot, lenstring);
return retval;
}
示例11: getUsedVariables
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
public List<String> getUsedVariables() {
// Get the list of Strings.
List<StringSearchResult> stringList = getStringList(true, true, false);
List<String> varList = new ArrayList<String>();
// Look around in the strings, see what we find...
for (StringSearchResult result : stringList) {
StringUtil.getUsedVariables(result.getString(), varList, false);
}
return varList;
}
示例12: checkPasswordVisible
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
public void checkPasswordVisible()
{
String password = wPassword.getText();
java.util.List<String> list = new ArrayList<String>();
StringUtil.getUsedVariables(password, list, true);
if (list.isEmpty())
{
wPassword.setEchoChar('*');
}
else
{
wPassword.setEchoChar('\0'); // Show it all...
}
}
示例13: checkPasswordVisible
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
public void checkPasswordVisible()
{
String password = wPassword.getText();
List<String> list = new ArrayList<String>();
StringUtil.getUsedVariables(password, list, true);
if (list.size() == 0)
{
wPassword.setEchoChar('*');
}
else
{
wPassword.setEchoChar('\0'); // Show it all...
}
}
示例14: checkPasswordVisible
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
public void checkPasswordVisible()
{
String password = wPassword.getText();
List<String> list = new ArrayList<String>();
StringUtil.getUsedVariables(password, list, true);
if (list.size() == 0)
wPassword.setEchoChar('*');
else
wPassword.setEchoChar('\0'); // Show it all...
}
示例15: checkPasswordVisible
import org.pentaho.di.core.util.StringUtil; //导入依赖的package包/类
/**
* Checks the password visible.
*/
private void checkPasswordVisible() {
final String password = wPasswordField.getText();
final List<String> list = new ArrayList<String>();
StringUtil.getUsedVariables(password, list, true);
if (list.size() == 0) {
wPasswordField.setEchoChar('*');
} else {
String variableName = null;
if (password.startsWith(StringUtil.UNIX_OPEN)
&& password.endsWith(StringUtil.UNIX_CLOSE)) {
variableName = password.substring(
StringUtil.UNIX_OPEN.length(), password.length()
- StringUtil.UNIX_CLOSE.length());
}
if (password.startsWith(StringUtil.WINDOWS_OPEN)
&& password.endsWith(StringUtil.WINDOWS_CLOSE)) {
variableName = password.substring(
StringUtil.WINDOWS_OPEN.length(), password.length()
- StringUtil.WINDOWS_CLOSE.length());
}
if (variableName != null
&& System.getProperty(variableName) != null) {
wPasswordField.setEchoChar('\0');
} else {
wPasswordField.setEchoChar('*');
}
}
}