public static String[] toStringArray(String propValue, String delim) { if (propValue!=null) { return StringHelper.split(delim, propValue); } else { return ArrayHelper.EMPTY_STRING_ARRAY; } }
public static String[] split(String seperators, String list) { return split( seperators, list, false ); }
public static String[] toStringArray(String propValue, String delim) { if (propValue!=null) { return StringHelper.split(delim, propValue); } else { return ArrayHelper.EMPTY_STRING_ARRAY; } }
public static String[] split(String seperators, String list) { return split( seperators, list, false ); }
public boolean isSequence(Object key) { if (key instanceof String){ String[] strings = StringHelper.split(".", (String) key); return sequences.contains( strings[strings.length-1].toLowerCase()); } return false; }
public boolean isTable(Object key) throws HibernateException { if(key instanceof String) { Table tbl = new Table((String)key); if ( getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null ) { return true; } else { String[] strings = StringHelper.split(".", (String) key); if(strings.length==3) { tbl = new Table(strings[2]); tbl.setCatalog(strings[0]); tbl.setSchema(strings[1]); return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null; } else if (strings.length==2) { tbl = new Table(strings[1]); tbl.setSchema(strings[0]); return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null; } } } return false; }
public void configure(Type type, Properties params, Dialect dialect) throws MappingException { String tableList = params.getProperty("tables"); if (tableList==null) tableList = params.getProperty(PersistentIdentifierGenerator.TABLES); String[] tables = StringHelper.split(", ", tableList); String column = params.getProperty("column"); if (column==null) column = params.getProperty(PersistentIdentifierGenerator.PK); String schema = params.getProperty(PersistentIdentifierGenerator.SCHEMA); String catalog = params.getProperty(PersistentIdentifierGenerator.CATALOG); returnClass = type.getReturnedClass(); StringBuffer buf = new StringBuffer(); for ( int i=0; i<tables.length; i++ ) { if (tables.length>1) { buf.append("select ").append(column).append(" from "); } buf.append( Table.qualify( catalog, schema, tables[i] ) ); if ( i<tables.length-1) buf.append(" union "); } if (tables.length>1) { buf.insert(0, "( ").append(" ) ids_"); column = "ids_." + column; } sql = "select max(" + column + ") from " + buf.toString(); }
public void configure(Type type, Properties params, Dialect d) throws MappingException { String tableList = params.getProperty("tables"); if (tableList==null) tableList = params.getProperty(PersistentIdentifierGenerator.TABLES); String[] tables = StringHelper.split(", ", tableList); String column = params.getProperty("column"); if (column==null) column = params.getProperty(PersistentIdentifierGenerator.PK); String schema = params.getProperty(PersistentIdentifierGenerator.SCHEMA); String catalog = params.getProperty(PersistentIdentifierGenerator.CATALOG); returnClass = type.getReturnedClass(); StringBuffer buf = new StringBuffer(); for ( int i=0; i<tables.length; i++ ) { if (tables.length>1) { buf.append("select ").append(column).append(" from "); } buf.append( Table.qualify(catalog, schema, tables[i], d.getSchemaSeparator() ) ); if ( i<tables.length-1) buf.append(" union "); } if (tables.length>1) { buf.insert(0, "( ").append(" ) ids_"); column = "ids_." + column; } sql = "select max(" + column + ") from " + buf.toString(); }
/** * Turns a path into an AST. * * @param path The path. * @param factory The AST factory to use. * @return An HQL AST representing the path. */ public static AST parsePath(String path, ASTFactory factory) { String[] identifiers = StringHelper.split( ".", path ); AST lhs = null; for ( int i = 0; i < identifiers.length; i++ ) { String identifier = identifiers[i]; AST child = ASTUtil.create( factory, HqlSqlTokenTypes.IDENT, identifier ); if ( i == 0 ) { lhs = child; } else { lhs = ASTUtil.createBinarySubtree( factory, HqlSqlTokenTypes.DOT, ".", lhs, child ); } } if ( log.isDebugEnabled() ) { log.debug( "parsePath() : " + path + " -> " + ASTUtil.getDebugString( lhs ) ); } return lhs; }
/** * Turns a path into an AST. * * @param path The path. * @param factory The AST factory to use. * @return An HQL AST representing the path. */ static AST parsePath(String path, ASTFactory factory) { String[] identifiers = StringHelper.split( ".", path ); AST lhs = null; for ( int i = 0; i < identifiers.length; i++ ) { String identifier = identifiers[i]; AST child = ASTUtil.create( factory, HqlSqlTokenTypes.IDENT, identifier ); if ( i == 0 ) { lhs = child; } else { lhs = ASTUtil.createBinarySubtree( factory, HqlSqlTokenTypes.DOT, ".", lhs, child ); } } if ( log.isDebugEnabled() ) { log.debug( "parsePath() : " + path + " -> " + ASTUtil.getDebugString( lhs ) ); } return lhs; }
String[] tokens = StringHelper.split( StringHelper.WHITESPACE + "(),", query, true ); if ( tokens.length == 0 ) return new String[]{query}; // just especially for the trivial collection filter ArrayList placeholders = new ArrayList();
String[] tokens = StringHelper.split( StringHelper.WHITESPACE + "(),", query, true ); if ( tokens.length == 0 ) return new String[]{query}; // just especially for the trivial collection filter ArrayList placeholders = new ArrayList();
private void preprocess(String token, QueryTranslatorImpl q) throws QueryException { // ugly hack for cases like "elements(foo.bar.collection)" // (multi-part path expression ending in elements or indices) String[] tokens = StringHelper.split( ".", token, true ); if ( tokens.length > 5 && ( CollectionPropertyNames.COLLECTION_ELEMENTS.equals( tokens[tokens.length - 1] ) || CollectionPropertyNames.COLLECTION_INDICES.equals( tokens[tokens.length - 1] ) ) ) { pathExpressionParser.start( q ); for ( int i = 0; i < tokens.length - 3; i++ ) { pathExpressionParser.token( tokens[i], q ); } pathExpressionParser.token( null, q ); pathExpressionParser.end( q ); addJoin( pathExpressionParser.getWhereJoin(), q ); pathExpressionParser.ignoreInitialJoin(); } }
private void preprocess(String token, QueryTranslatorImpl q) throws QueryException { // ugly hack for cases like "elements(foo.bar.collection)" // (multi-part path expression ending in elements or indices) String[] tokens = StringHelper.split( ".", token, true ); if ( tokens.length > 5 && ( CollectionPropertyNames.COLLECTION_ELEMENTS.equals( tokens[tokens.length - 1] ) || CollectionPropertyNames.COLLECTION_INDICES.equals( tokens[tokens.length - 1] ) ) ) { pathExpressionParser.start( q ); for ( int i = 0; i < tokens.length - 3; i++ ) { pathExpressionParser.token( tokens[i], q ); } pathExpressionParser.token( null, q ); pathExpressionParser.end( q ); addJoin( pathExpressionParser.getWhereJoin(), q ); pathExpressionParser.ignoreInitialJoin(); } }