/** * Splits a string on all occurrences of delimiter and returns a list with all parts. Each part will be trimmed from * whitespace. See {@link StringUtils#split(String, String, int)} for further options. If you need regular * expressions, use {@link String#split(String)}. * * @param string * the string to split * @param delimiter * @return a list with all parts */ public static String[] split( String string, String delimiter ) { return split( string, delimiter, 0 ); }
private boolean testTransformation( ProcessletInputs in ) { String isT = getLiteralInputValue( in, IN_TEST_TRANSFORM ); return !isSet( isT ) ? false : Boolean.parseBoolean( isT ); }
private String buildMetadataUrl( String pattern, String datasetId ) { if ( pattern == null || datasetId == null ) { return null; } return StringUtils.replaceAll( pattern, "${metadataSetId}", datasetId ); }
synchronized ( MEM_LOCK ) { String cacheSize = System.getProperty( DEF_RASTER_CACHE_MEM_SIZE ); long mm = StringUtils.parseByteSize( cacheSize ); if ( mm == 0 ) { if ( StringUtils.isSet( cacheSize ) ) { LOG.warn( "Ignoring supplied property: {} because it could not be parsed. Using 0.5 of the total memory for raster caching.", DEF_RASTER_CACHE_MEM_SIZE ); mm = StringUtils.parseByteSize( t ); if ( mm == 0 ) { if ( StringUtils.isSet( t ) ) { LOG.warn( "Ignoring supplied property: {} because it could not be parsed. Using 20G of disk space for raster caching.", DEF_RASTER_CACHE_MEM_SIZE );
public OWSException( List<String> messages, String exceptionCode, String locator ) { super( StringUtils.concat( messages, ";" ) ); this.messages = messages; this.exceptionCode = exceptionCode; this.locator = locator; }
public String toString( int indent ) { StringBuilder sb = new StringBuilder(); sb.append( repeat( indent, " " ) + " - " + value + "\n" ); indent += 2; for ( Tree<T> c : children ) { sb.append( c.toString( indent ) ); } return sb.toString(); }
int count = StringUtils.count( string, delimiter ); count += 1; // n delimiters -> n+1 fields int missingFields = count - parts.length - doublesRemoves;
private void createCustomMappedProperties( GeometryType geomType, List<Mapping> mappings, LinkedList<PropertyType> types, String namespace, String prefix ) { types.clear(); for ( Mapping m : mappings ) { if ( m.fieldname == null ) { types.add( new GeometryPropertyType( new QName( namespace, m.propname, prefix ), 0, 1, null, null, geomType, DIM_2_OR_3, BOTH ) ); } else { PropertyType pt = properties.get( m.fieldname ); if ( pt == null ) { List<String> fieldNames = new ArrayList<String>( properties.keySet() ); String msg = "Error in mapping. DBF file does not have a field with name '" + m.fieldname + "'. Defined fields are: " + concat( fieldNames, ", " ); throw new IllegalArgumentException( msg ); } types.add( pt ); } } }
public String toString( int indent ) { StringBuilder sb = new StringBuilder(); sb.append( repeat( indent, " " ) ); sb.append( " - " ); sb.append( metadata.getName() ); sb.append( " " ); sb.append( layers.size() ); sb.append( " layers\n" ); indent += 2; for ( Theme t : themes ) { if ( t instanceof StandardTheme ) { sb.append( ( (StandardTheme) t ).toString( indent ) ); } else { sb.append( t ); } } return sb.toString(); }
public static String[] splitList( String param ) { return StringUtils.split( param, "," ); }
/** * Removes underscores and sets the first Character to an Uppercase. * * @param someValue * @return the new class name */ public static String createBetterClassName( String someValue ) { if ( StringUtils.isSet( someValue ) ) { String t = someValue.replace( "_", "" ); String result = modifyKeyword( t ); StringBuilder sb = new StringBuilder( result ); sb.replace( 0, 1, t.substring( 0, 1 ).toUpperCase() ); return sb.toString(); } return someValue; }
private String getUrlForMetadataSetId( final String id, final String mdUrlTemplate ) { if ( id == null || mdUrlTemplate == null ) { return null; } return replaceAll( mdUrlTemplate, "${metadataSetId}", id ); } }
private void writeJoinedTable( XMLStreamWriter writer, TableJoin jc ) throws XMLStreamException { writer.writeStartElement( CONFIG_NS, "Join" ); if ( jc.getToTable() != null ) { writer.writeAttribute( "table", jc.getToTable().toString() ); } writer.writeAttribute( "fromColumns", StringUtils.concat( jc.getFromColumns(), "," ) ); writer.writeAttribute( "toColumns", StringUtils.concat( jc.getToColumns(), "," ) ); if ( jc.getOrderColumns() != null && !jc.getOrderColumns().isEmpty() ) { writer.writeAttribute( "orderColumns", StringUtils.concat( jc.getOrderColumns(), "," ) ); } if ( jc.isNumberedOrder() ) { writer.writeAttribute( "numbered", "true" ); } writer.writeEndElement(); }
private static List<String> splitNullSafe( String csv ) { if ( csv == null ) { return emptyList(); } String[] tokens = StringUtils.split( csv, "," ); return asList( tokens ); }
/** * Removes underscores and sets the first Character to a lowercase. * * @param someValue * @return the new class name */ public static String createBetterMethodName( String someValue ) { if ( StringUtils.isSet( someValue ) ) { String t = someValue.replace( "_", "" ); String result = modifyKeyword( t ); StringBuilder sb = new StringBuilder( result ); sb.replace( 0, 1, t.substring( 0, 1 ).toLowerCase() ); return sb.toString(); } return someValue; }
private String getMetadataURL( String metadataUrlTemplate, FeatureTypeMetadata ftMd ) { if ( metadataUrlTemplate == null || ftMd == null || ftMd.getMetadataSetId() == null ) { return null; } return StringUtils.replaceAll( metadataUrlTemplate, "${metadataSetId}", ftMd.getMetadataSetId() ); }
private void initQueryCRS( List<String> queryCRSLists ) { // try { for ( String queryCRS : queryCRSLists ) { String[] querySrs = StringUtils.split( queryCRS, " ", REMOVE_EMPTY_FIELDS | REMOVE_DOUBLE_FIELDS ); for ( String srs : querySrs ) { LOG.debug( "Query CRS: " + srs ); ICRS crs = CRSManager.getCRSRef( srs ); this.queryCRS.add( crs ); } } // } catch ( UnknownCRSException e ) { // String msg = "Invalid QuerySRS parameter: " + e.getMessage(); // throw new ControllerInitException( msg ); // } if ( queryCRS.isEmpty() ) { LOG.info( "No query CRS defined, defaulting to EPSG:4326." ); queryCRS.add( CRSUtils.EPSG_4326 ); } defaultQueryCRS = this.queryCRS.get( 0 ); }
private PropertyIsLike buildIsLike( Expression propName, Expression literal, boolean matchCase ) throws UnmappableException { if ( !( propName instanceof ValueReference ) || !( literal instanceof Literal ) ) { String msg = "Can not map filter. Multi-valued columns can only be compared to literals."; throw new UnmappableException( msg ); } String wildCard = "*"; String singleChar = "?"; String escapeChar = "\\"; String s = ( (Literal<?>) literal ).getValue().toString(); s = StringUtils.replaceAll( s, escapeChar, escapeChar + escapeChar ); s = StringUtils.replaceAll( s, singleChar, escapeChar + singleChar ); s = StringUtils.replaceAll( s, wildCard, escapeChar + wildCard ); Literal<PrimitiveValue> escapedLiteral = new Literal<PrimitiveValue>( new PrimitiveValue( s ), null ); return new PropertyIsLike( (ValueReference) propName, escapedLiteral, wildCard, singleChar, escapeChar, matchCase, null ); }