public static void getUsedVariables( String aString, List<String> list, boolean includeSystemVariables ) { getUsedVariables( aString, UNIX_OPEN, UNIX_CLOSE, list, includeSystemVariables ); getUsedVariables( aString, WINDOWS_OPEN, WINDOWS_CLOSE, list, includeSystemVariables ); }
private static boolean containsVariables( String entryPath ) { List<String> variablesList = new ArrayList<String>(); StringUtil.getUsedVariables( entryPath, variablesList, true ); return !variablesList.isEmpty(); }
private static boolean containsVariables( String entryPath ) { List<String> variablesList = new ArrayList<String>(); StringUtil.getUsedVariables( entryPath, variablesList, true ); return !variablesList.isEmpty(); } }
/** * @return The formatted message. */ @Override public String getMessage() { String formatted = message; if ( arguments != null ) { // get all "tokens" enclosed by curly brackets within the message final List<String> tokens = new ArrayList<>(); StringUtil.getUsedVariables( formatted, "{", "}", tokens, true ); // perform MessageFormat.format( ... ) on each token, if we get an exception, we'll know that we have a // segment that isn't parsable by MessageFormat, likely a pdi variable name (${foo}) - in this case, we need to // escape the curly brackets in the message, so that MessageFormat does not complain for ( final String token : tokens ) { try { MessageFormat.format( "{" + token + "}", arguments ); } catch ( final IllegalArgumentException iar ) { formatted = formatted.replaceAll( "\\{" + token + "\\}", "\\'{'" + token + "\\'}'" ); } } // now that we have escaped curly brackets in all invalid tokens, we can attempt to format the entire message formatted = MessageFormat.format( formatted, arguments ); } return formatted; }
/** * 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 */ protected final String encryptPasswordIfNotUsingVariablesInternal( String password ) { String encrPassword = ""; List<String> varList = new ArrayList<>(); StringUtil.getUsedVariables( password, varList, true ); if ( varList.isEmpty() ) { encrPassword = PASSWORD_ENCRYPTED_PREFIX + KettleTwoWayPasswordEncoder.encryptPassword( password ); } else { encrPassword = password; } return encrPassword; }
/** * 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<>(); // 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; }
/** * Gets the used variables. * * @return the used variables */ 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; }
public static final void checkPasswordVisible( Text wPassword ) { String password = wPassword.getText(); java.util.List<String> list = new ArrayList<String>(); StringUtil.getUsedVariables( password, list, true );