本文整理汇总了Java中org.pentaho.pms.util.Const类的典型用法代码示例。如果您正苦于以下问题:Java Const类的具体用法?Java Const怎么用?Java Const使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Const类属于org.pentaho.pms.util包,在下文中一共展示了Const类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateSelect
import org.pentaho.pms.util.Const; //导入依赖的package包/类
@Override
protected void generateSelect( SQLQueryModel query, StringBuilder sql ) {
sql.append( "SELECT " );
generateSelectPredicate( query, sql );
sql.append( Const.CR );
boolean first = true;
for ( SQLSelection selection : query.getSelections() ) {
if ( first ) {
first = false;
sql.append( " " ); //$NON-NLS-1$
} else {
sql.append( " ," ); //$NON-NLS-1$
}
sql.append( selection.getFormula() );
if ( selection.getAlias() != null ) {
sql.append( " AS " ); //$NON-NLS-1$
sql.append( selection.getAlias() );
}
sql.append( Const.CR );
}
}
示例2: generateSelect
import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
* generates the SELECT portion of the SQL statement
*
* @param query
* query model
* @param sql
* string buffer
*/
protected void generateSelect( SQLQueryModel query, StringBuilder sql ) {
sql.append( "SELECT " ); //$NON-NLS-1$
generateSelectPredicate( query, sql );
sql.append( Const.CR );
boolean first = true;
for ( SQLSelection selection : query.getSelections() ) {
if ( first ) {
first = false;
sql.append( " " ); //$NON-NLS-1$
} else {
sql.append( " ," ); //$NON-NLS-1$
}
sql.append( selection.getFormula() );
if ( selection.getAlias() != null ) {
sql.append( " AS " ); //$NON-NLS-1$
sql.append( selection.getAlias() );
}
sql.append( Const.CR );
}
}
示例3: generateFrom
import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
* generates the FROM portion of the SQL statement
*
* @param query
* query model
* @param sql
* string buffer
*/
protected void generateFrom( SQLQueryModel query, StringBuilder sql ) {
sql.append( "FROM " ).append( Const.CR ); //$NON-NLS-1$
boolean first = true;
for ( SQLTable table : query.getTables() ) {
if ( first ) {
first = false;
sql.append( " " ); //$NON-NLS-1$
} else {
sql.append( " ," ); //$NON-NLS-1$
}
sql.append( table.getTableName() );
if ( table.getAlias() != null ) {
sql.append( " " ); //$NON-NLS-1$
sql.append( table.getAlias() );
}
sql.append( Const.CR );
}
}
示例4: generateJoins
import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
* Generates the WHERE clause portion of the SQL statement.<br>
* In this case, we generate the joins between the tables.<br>
* <br>
* Important: this method only applies to regular models, not outer-join scenarios!<br>
*
* @param query
* query model
* @param sql
* string buffer
*/
protected void generateJoins( SQLQueryModel query, StringBuilder sql ) {
if ( query.getJoins().size() > 0 ) {
boolean first = true;
sql.append( "WHERE " ).append( Const.CR ); //$NON-NLS-1$
List<SQLJoin> sortedJoins = new ArrayList<SQLJoin>( query.getJoins() );
Collections.sort( sortedJoins );
for ( SQLJoin join : sortedJoins ) {
if ( first ) {
first = false;
sql.append( " ( " ); //$NON-NLS-1$
} else {
// You always "AND" join conditions...
//
sql.append( " AND ( " ); //$NON-NLS-1$
}
sql.append( join.getSqlWhereFormula().getFormula() );
sql.append( " )" ).append( Const.CR ); //$NON-NLS-1$
}
}
}
示例5: generateGroupBy
import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
* generates the GROUP BY portion of the SQL statement
*
* @param query
* query model
* @param sql
* string buffer
*/
protected void generateGroupBy( SQLQueryModel query, StringBuilder sql ) {
if ( query.getGroupBys().size() > 0 ) {
sql.append( "GROUP BY " ).append( Const.CR ); //$NON-NLS-1$
boolean first = true;
for ( SQLSelection groupby : query.getGroupBys() ) {
if ( first ) {
first = false;
sql.append( " " ); //$NON-NLS-1$
} else {
sql.append( " ," ); //$NON-NLS-1$
}
// only render the alias or the formula
if ( groupby.getAlias() != null ) {
sql.append( groupby.getAlias() );
} else {
sql.append( groupby.getFormula() );
}
sql.append( Const.CR );
}
}
}
示例6: compare
import org.pentaho.pms.util.Const; //导入依赖的package包/类
public int compare( SQLJoin left, SQLJoin right ) {
// Case: no join order / no join order => equal
if ( Const.isEmpty( left.getJoinOrderKey() ) && Const.isEmpty( right.getJoinOrderKey() ) ) {
return 0;
}
// Case: join order / no join order => join order comes first
if ( !Const.isEmpty( left.getJoinOrderKey() ) && Const.isEmpty( right.getJoinOrderKey() ) ) {
return -1;
}
// Case: no join order / join order => join order comes first
if ( Const.isEmpty( left.getJoinOrderKey() ) && !Const.isEmpty( right.getJoinOrderKey() ) ) {
return 1;
}
// Case: join order / join order => natural order
return left.getJoinOrderKey().compareTo( right.getJoinOrderKey() );
}
示例7: generateSelect
import org.pentaho.pms.util.Const; //导入依赖的package包/类
@Override
protected void generateSelect( SQLQueryModel query, StringBuilder sql ) {
sql.append( "SELECT " );
generateSelectPredicate( query, sql );
sql.append( Const.CR );
boolean first = true;
for ( SQLSelection selection : query.getSelections() ) {
if ( first ) {
first = false;
sql.append( " " ); //$NON-NLS-1$
} else {
sql.append( " ," ); //$NON-NLS-1$
}
sql.append( selection.getFormula() );
if ( isDriverVersion( 0, 6 ) ) {
// Only Hive version 0.6 and beyond support column aliases
if ( selection.getAlias() != null ) {
sql.append( " AS " ); //$NON-NLS-1$
sql.append( selection.getAlias() );
}
}
sql.append( Const.CR );
}
}
示例8: getFromClauseWithTables
import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
* Create a FROM clause by joining the tables of the model without any conditions.
*
* @param query Query Model
* @return From clause built up by joining all tables together
*/
protected String getFromClauseWithTables( SQLQueryModel query ) {
StringBuilder sql = new StringBuilder();
Iterator<SQLTable> iter = query.getTables().iterator();
SQLTable table = iter.next();
sql.append( " " ); //$NON-NLS-1$
appendTableAndAlias( sql, table );
while ( iter.hasNext() ) {
// Hive does not support more than one table reference. When more than one table is
// used we must explicitly join it.
sql.append( Const.CR ).append( " JOIN " );
appendTableAndAlias( sql, iter.next() );
}
sql.append( Const.CR );
return sql.toString();
}
示例9: generateInnerJoinWhereConditions
import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
* Add join conditions that contain operators other than equalities to the WHERE condition.
*
* @param query Query Model
* @param sql In-progress query string being built
* @param joins {@link SQLJoin}s with WHERE conditions that have not been used in any ON clauses
*/
protected void generateInnerJoinWhereConditions( SQLQueryModel query, StringBuilder sql, List<SQLJoin> joins ) {
if ( !joins.isEmpty() ) {
boolean first = true;
sql.append( "WHERE" ).append( Const.CR ); //$NON-NLS-1$
for ( SQLJoin join : joins ) {
if ( first ) {
sql.append( " ( " ); //$NON-NLS-1$
first = false;
} else {
sql.append( " AND ( " ); //$NON-NLS-1$
}
sql.append( join.getSqlWhereFormula().getFormula() );
sql.append( " )" ).append( Const.CR ); //$NON-NLS-1$
}
}
}
示例10: generateGroupBy
import org.pentaho.pms.util.Const; //导入依赖的package包/类
protected void generateGroupBy( SQLQueryModel query, StringBuilder sql ) {
if ( query.getGroupBys().size() > 0 ) {
sql.append( "GROUP BY " ).append( Const.CR ); //$NON-NLS-1$
boolean first = true;
for ( SQLSelection groupby : query.getGroupBys() ) {
if ( first ) {
first = false;
sql.append( " " ); //$NON-NLS-1$
} else {
sql.append( " ," ); //$NON-NLS-1$
}
// Hive does not support column aliases
// if (groupby.getAlias() != null) {
// sql.append(groupby.getAlias());
// } else {
sql.append( groupby.getFormula() );
// }
sql.append( Const.CR );
}
}
}
示例11: getLocale
import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
* Create a new locale by reading it from a CWM meta-data model
*
* @param cwm The CWM model to read from
* @param cwmParameter The CwmParameter object to use
* @return a newly created LocaleInterface class (LocaleMeta)
*/
public LocaleInterface getLocale( CWM cwm, CwmParameter cwmParameter ) {
LocaleInterface locale = new LocaleMeta();
locale.setCode( cwmParameter.getName() );
// The description
String description = cwm.getFirstTaggedValue( cwmParameter, CWM.TAG_LOCALE_DESCRIPTION );
if ( !Const.isEmpty( description ) ) {
locale.setDescription( description );
}
// The order
String strOrder = cwm.getFirstTaggedValue( cwmParameter, CWM.TAG_LOCALE_ORDER );
locale.setOrder( Const.toInt( strOrder, -1 ) );
// Active?
boolean active =
"Y".equalsIgnoreCase( cwm.getFirstTaggedValue( cwmParameter, CWM.TAG_LOCALE_IS_ACTIVE ) ); //$NON-NLS-1$
locale.setActive( active );
return locale;
}
示例12: toXML
import org.pentaho.pms.util.Const; //导入依赖的package包/类
public String toXML() {
StringBuffer xml = new StringBuffer();
xml.append( "<security>" ).append( Const.CR ); //$NON-NLS-1$
List owners = getOwners();
for ( int i = 0; i < owners.size(); i++ ) {
xml.append( " <owner-rights>" ).append( Const.CR ); //$NON-NLS-1$
SecurityOwner owner = (SecurityOwner) owners.get( i );
int rights = getOwnerRights( owner );
xml.append( " " + owner.toXML() + " <rights>" + rights + "</rights>" ).append( Const.CR ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
xml.append( " </owner-rights>" ).append( Const.CR ); //$NON-NLS-1$
}
xml.append( "</security>" ).append( Const.CR ); //$NON-NLS-1$
return xml.toString();
}
示例13: toXML
import org.pentaho.pms.util.Const; //导入依赖的package包/类
public String toXML() throws Exception {
List users = securityService.getUsers();
List roles = securityService.getRoles();
StringBuffer xml = new StringBuffer();
xml.append( "<content>" ).append( Const.CR ); //$NON-NLS-1$
xml.append( " <users>" ).append( Const.CR ); //$NON-NLS-1$
for ( int i = 0; i < users.size(); i++ ) {
xml.append( " " ).append( XMLHandler.addTagValue( "user", (String) users.get( i ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
xml.append( " </users>" ).append( Const.CR ); //$NON-NLS-1$
xml.append( " <roles>" ).append( Const.CR ); //$NON-NLS-1$
for ( int i = 0; i < roles.size(); i++ ) {
xml.append( " " ).append( XMLHandler.addTagValue( "role", (String) roles.get( i ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
xml.append( " </roles>" ).append( Const.CR ); //$NON-NLS-1$
xml.append( "</content>" ).append( Const.CR ); //$NON-NLS-1$
return xml.toString();
}
示例14: getXML
import org.pentaho.pms.util.Const; //导入依赖的package包/类
public String getXML() {
String retval = ""; //$NON-NLS-1$
retval += " <relationship>" + Const.CR; //$NON-NLS-1$
retval += " " + XMLHandler.addTagValue( "table_from", table_from.getId() ); //$NON-NLS-1$ //$NON-NLS-2$
retval += " " + XMLHandler.addTagValue( "table_to", table_to.getId() ); //$NON-NLS-1$ //$NON-NLS-2$
retval += " " + XMLHandler.addTagValue( "field_from", field_from != null ? field_from.getId() : "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
retval += " " + XMLHandler.addTagValue( "field_to", field_to != null ? field_to.getId() : "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
retval += " " + XMLHandler.addTagValue( "type", getTypeDesc() ); //$NON-NLS-1$ //$NON-NLS-2$
retval += " " + XMLHandler.addTagValue( "complex", complex ); //$NON-NLS-1$ //$NON-NLS-2$
retval += " " + XMLHandler.addTagValue( "complex_join", complex_join ); //$NON-NLS-1$ //$NON-NLS-2$
retval += " " + XMLHandler.addTagValue( "join_order_key", joinOrderKey ); //$NON-NLS-1$ //$NON-NLS-2$
retval += " " + XMLHandler.addTagValue( "description", description ); //$NON-NLS-1$ //$NON-NLS-2$
retval += " </relationship>" + Const.CR; //$NON-NLS-1$
return retval;
}
示例15: fromString
import org.pentaho.pms.util.Const; //导入依赖的package包/类
public static FontSettings fromString( String value ) {
String[] pieces = value.split( SEPARATOR );
switch ( pieces.length ) {
case 0:
return null;
case 1:
return new FontSettings( pieces[0], 10, false, false );
case 2:
return new FontSettings( pieces[0], Const.toInt( pieces[1], 10 ), false, false );
case 3:
return new FontSettings( pieces[0], Const.toInt( pieces[1], 10 ), BOLD.equalsIgnoreCase( pieces[2] ), ITALIC
.equalsIgnoreCase( pieces[2] ) );
case 4:
return new FontSettings( pieces[0], Const.toInt( pieces[1], 10 ), true, true );
default:
return null;
}
}