public Object execute( String expression, Object value ) { expression = ValueSourceUtils.trimPrefix( expression, expressionPrefixes, true ); if ( projectDir != null && value != null && unprefixedPathKeys.contains( expression ) ) { return pathTranslator.alignToBaseDirectory( String.valueOf( value ), projectDir ); } return value; }
/** * <p>Replace all occurances of a String within another String.</p> * * <p>A <code>null</code> reference passed to this method is a no-op.</p> * * @see #replace(String text, String repl, String with, int max) * @param text text to search and replace in * @param repl String to search for * @param with String to replace with * @return the text with any replacements processed */ public static String replace( String text, String repl, String with ) { return replace( text, repl, with, -1 ); }
String methodBase = StringUtils.capitalizeFirstLetter( token );
public Object execute( String expression, Object value ) { expression = ValueSourceUtils.trimPrefix( expression, expressionPrefixes, true ); if ( projectDir != null && value != null && unprefixedPathKeys.contains( expression ) ) { return pathTranslator.alignToBaseDirectory( String.valueOf( value ), projectDir ); } return value; }
private CRole buildRole( Entry<String, ContentClass> entry, String method ) { String content = entry.getKey(); CRole view = new CRole(); view.setId( content + "-all-" + method ); String contentClassName = entry.getValue().getName(); if ( entry.getValue() instanceof RootContentClass ) { // NXCM-3544 set name to empty string to generate 'All Repositories' role name/description contentClassName = ""; } view.setDescription( "Gives access to " + method + " ALL " + contentClassName + " Repositories in Nexus." ); method = StringUtils.capitalizeFirstLetter( method ); view.setName( "Repo: All " + contentClassName + " Repositories (" + method + ")" ); view.setSessionTimeout( 60 ); List<? extends Repository> repos = getRepositoriesWithContentClass( entry.getValue() ); for ( Repository repo : repos ) { view.addPrivilege( "repository-" + repo.getId() ); } return view; }
result = StringUtils.replace( result, wholeExpr, String.valueOf( value ) );
@Override public Object execute( String expression, Object value ) { if ( value != null ) { expression = ValueSourceUtils.trimPrefix( expression, expressionPrefixes, true ); if ( unprefixedPathKeys.contains( expression ) ) { return pathTranslator.alignToBaseDirectory( String.valueOf( value ), projectDir ); } } return null; }
public boolean hasRecursiveExpression( String expression ) { String realExpr = ValueSourceUtils.trimPrefix( expression, possiblePrefixes, watchUnprefixedExpressions ); if ( realExpr != null ) { return nakedExpressions.contains( realExpr ); } return false; }
public void expressionResolutionStarted( String expression ) { String realExpr = ValueSourceUtils.trimPrefix( expression, possiblePrefixes, watchUnprefixedExpressions ); nakedExpressions.push( realExpr ); }
/** * Uses {@link ValueSourceUtils#trimPrefix(String, java.util.Collection, boolean)} to * get the trimmed expression. If this expression is null (because the original * expression was null, or because the expression is unprefixed and unprefixed * expressions are not allowed here), then return null; otherwise, return the * nested {@link ValueSource#getValue(String)} result. */ public Object getValue( String expression ) { lastExpression = ValueSourceUtils.trimPrefix( expression, possiblePrefixes, allowUnprefixedExpressions ); if ( lastExpression == null ) { return null; } return valueSource.getValue( lastExpression ); }
public Object execute(String expression, Object value) { if (value != null) { expression = ValueSourceUtils.trimPrefix(expression, expressionPrefixes, true); if (unprefixedPathKeys.contains(expression)) { return pathTranslator.alignToBaseDirectory(String.valueOf(value), projectDir); } } return null; }
@Override public Object execute( String expression, Object value ) { if ( value != null ) { expression = ValueSourceUtils.trimPrefix( expression, expressionPrefixes, true ); if ( unprefixedPathKeys.contains( expression ) ) { return pathTranslator.alignToBaseDirectory( String.valueOf( value ), projectDir ); } } return null; }
/** * When an expression is determined to be a recursive reference, this method * returns the sublist of tracked expressions that participate in this cycle. * Otherwise, if the expression isn't present in the in-process stack, return * {@link Collections#EMPTY_LIST}. Also, if the expression doesn't have a matched * prefix from this interceptor's list, and unprefixed expressions aren't allowed * then return {@link Collections#EMPTY_LIST}. */ public List getExpressionCycle( String expression ) { String expr = ValueSourceUtils.trimPrefix( expression, possiblePrefixes, watchUnprefixedExpressions ); if ( expr == null ) { return Collections.EMPTY_LIST; } int idx = nakedExpressions.indexOf( expression ); if ( idx < 0 ) { return Collections.EMPTY_LIST; } else { return nakedExpressions.subList( idx, nakedExpressions.size() ); } }