本文整理汇总了Java中org.pentaho.pms.util.Const.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Const.isEmpty方法的具体用法?Java Const.isEmpty怎么用?Java Const.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.pms.util.Const
的用法示例。
在下文中一共展示了Const.isEmpty方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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() );
}
示例2: 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;
}
示例3: getWhereClause
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
/**
* generate the SQL condition
*
* @param locale
* locale for generating sql
* @param useOperator
* appends operator if true
* @return where clause
*/
public String getWhereClause( String locale, boolean useOperator ) throws PentahoMetadataException {
String retval = ""; //$NON-NLS-1$
if ( condition != null ) {
if ( Const.isEmpty( operator ) || !useOperator ) {
retval += Const.rightPad( " ", 9 ) + " "; //$NON-NLS-1$ //$NON-NLS-2$
} else {
retval += Const.rightPad( operator, 9 ) + " "; //$NON-NLS-1$
}
retval += " ( " + formula.generateSQL( locale ) + " ) "; //$NON-NLS-1$ //$NON-NLS-2$
}
return retval;
}
示例4: getTableAndAlias
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
/**
* Get the concatenation of table name and alias (if it exists).
*
* @param table Name of table
* @param alias Alias for table
* @return "{@code table}" or "{@code table} {@code alias}" if alias exists.
*/
protected String getTableAndAlias( String table, String alias ) {
String tableAndAlias = table;
if ( !Const.isEmpty( alias ) ) {
tableAndAlias += " " + alias; //$NON-NLS-1$
}
return tableAndAlias;
}
示例5: storeLocale
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
/**
* Store the locale meta-data into the CWM repository using CwmParamter objects.
*
* @param cwm The model to store in
* @param locale the locale to store
*/
public void storeLocale( CWM cwm, LocaleInterface locale ) {
if ( !hasAccess( CwmSchemaFactoryInterface.ACCESS_TYPE_SCHEMA_ADMIN, null ) ) {
throw new CwmSchemaFactoryException( Messages
.getString( "CwmSchemaFactory.ERROR_0001_SCHEMA_ADMIN_ACCESS_DENIED" ) ); //$NON-NLS-1$
}
CwmParameter cwmParameter = cwm.createParameter( locale.getCode() );
if ( !Const.isEmpty( locale.getDescription() ) ) {
cwm.addTaggedValue( cwmParameter, CWM.TAG_LOCALE_DESCRIPTION, locale.getDescription() );
}
cwm.addTaggedValue( cwmParameter, CWM.TAG_LOCALE_ORDER, Integer.toString( locale.getOrder() ) );
cwm.addTaggedValue( cwmParameter, CWM.TAG_LOCALE_IS_ACTIVE,
locale.isActive() ? "Y" : "N" ); //$NON-NLS-1$ //$NON-NLS-2$
}
示例6: getName
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
/**
* Returns the name for the concept using the specified locale. If the concept doesn't have a name given the specified
* locale, the default locale will be used
*
* @param locale The prefered locale to go for
* @return The localized name or the id if nothing was found for that or the default locale
*/
public String getName( String locale ) {
String name = internalGetName( locale );
// If the name is empty and the default locale isn't virtually the same
// as the locale...
if ( Const.isEmpty( name ) && !DEFAULT_LOCALE.startsWith( locale ) ) {
name = internalGetName( DEFAULT_LOCALE );
}
return ( Const.isEmpty( name ) ? id : name );
}
示例7: internalGetName
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
/**
* Used to check for the concept's name by using recursively less specific locales
*/
private String internalGetName( String locale ) {
String name = concept.getName( locale );
if ( Const.isEmpty( name ) && locale != null && locale.indexOf( '_' ) > 0 ) {
name = internalGetName( locale.substring( 0, locale.lastIndexOf( '_' ) ) );
}
return name;
}
示例8: getDescription
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
/**
* @param locale The prefered locale to go for
* @return The localized description or null if nothing was found for that locale
*/
public String getDescription( String locale ) {
String description = concept.getDescription( locale );
// If the description is empty and the default locale isn't virtually
// the same as the locale...
if ( Const.isEmpty( description ) && DEFAULT_LOCALE.indexOf( locale ) != 0 ) {
description = internalGetDescription( DEFAULT_LOCALE );
}
return ( Const.isEmpty( description ) ? id : description );
}
示例9: internalGetDescription
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
/**
* Used to look for the description using recursively less specific locale information
*/
private String internalGetDescription( String locale ) {
String description = concept.getDescription( locale );
if ( Const.isEmpty( description ) && locale != null && locale.indexOf( '_' ) > 0 ) {
description = internalGetDescription( locale.substring( 0, locale.lastIndexOf( '_' ) ) );
}
return description;
}
示例10: compareTo
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
public int compareTo( SQLJoin other ) {
// Case: No join order / no join order
//
if ( Const.isEmpty( getJoinOrderKey() ) && Const.isEmpty( other.getJoinOrderKey() ) ) {
if ( legacyJoinOrder ) {
return legacyCompare();
}
if ( getJoinType() == other.getJoinType() ) {
// no order key and same join type
return 0;
}
// Case: inner join : goes below
//
if ( getJoinType() == INNER_JOIN ) {
return -1;
} else if ( other.getJoinType() == INNER_JOIN ) {
// CASE: no inner join / inner join : goes to the top
return 1;
} else {
// CASE: no inner join / no inner join : nothing to work with:
return 0;
}
} else if ( !Const.isEmpty( getJoinOrderKey() ) && Const.isEmpty( other.getJoinOrderKey() ) ) {
// Case: Join order / no join order
//
// Case: ? / inner join : goes to the top
//
if ( getJoinType() != INNER_JOIN ) {
return 1;
} else {
// CASE: ? / no inner join : nothing to work with:
return 0;
}
} else if ( Const.isEmpty( getJoinOrderKey() ) && !Const.isEmpty( other.getJoinOrderKey() ) ) {
// Case: No join order / join order
//
// Case: inner join / ? : goes to the bottom
//
if ( getJoinType() == INNER_JOIN ) {
return -1;
} else {
// CASE: no inner join / ? : nothing to work with:
return 0;
}
} else {
// Case: both join orders are specified
return -getJoinOrderKey().compareTo( other.getJoinOrderKey() );
}
}
示例11: storeDatabaseMeta
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
/**
* Uility method to store Kettle Database Metadata
*
* @param cwm The model to store it in
* @param databaseMeta The Kettle database connection metadata to use.
*/
public void storeDatabaseMeta( CWM cwm, DatabaseMeta databaseMeta ) {
if ( !hasAccess( CwmSchemaFactoryInterface.ACCESS_TYPE_SCHEMA_ADMIN, null ) ) {
throw new CwmSchemaFactoryException( Messages
.getString( "CwmSchemaFactory.ERROR_0001_SCHEMA_ADMIN_ACCESS_DENIED" ) ); //$NON-NLS-1$
}
CwmCatalog catalog = cwm.createCatalog( databaseMeta.getName() );
catalog.setName( databaseMeta.getName() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_SERVER, databaseMeta.getHostname() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_TYPE, databaseMeta.getDatabaseTypeDesc() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_ACCESS, databaseMeta.getAccessTypeDesc() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_DATABASE, databaseMeta.getDatabaseName() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_PORT, databaseMeta.getDatabasePortNumberString() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_USERNAME, databaseMeta.getUsername() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_PASSWORD, databaseMeta.getPassword() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_SERVERNAME, databaseMeta.getServername() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_DATA_TABLESPACE, databaseMeta.getDataTablespace() );
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_INDEX_TABLESPACE, databaseMeta.getIndexTablespace() );
// Save all the attributes as well...
//
List<Object> list = new ArrayList<Object>( databaseMeta.getAttributes().keySet() );
for ( Iterator iter = list.iterator(); iter.hasNext(); ) {
String key = (String) iter.next();
String attribute = (String) databaseMeta.getAttributes().get( key );
if ( !Const.isEmpty( attribute ) ) {
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_ATTRIBUTE_PREFIX + key, attribute );
}
}
// Add the complete calculated URL for the pleasure of the other consumers besides Kettle
//
try {
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_JDBC_URL, databaseMeta.getURL() );
} catch ( KettleDatabaseException e ) {
// Data to make a URL is not valid, incomplete, etc.
cwm.addTaggedValue( catalog, CWM.TAG_DATABASE_JDBC_URL, Messages
.getString(
"CwmSchemaFactory.ERROR_0002_INVALID_DATA" ) ); // we don't read this back, it's only for 3rd party use.
// $NON-NLS-1$
}
}
示例12: storeRelationshipMeta
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
/**
* Stores a Kettle relationshipMeta object into the MDR
*
* @param cwm The MDR CWM model instantiation to use.
* @param relationshipMeta the relationshipMeta object to store.
* @param cwmSchema The schema to which the relationship belongs
*/
public void storeRelationshipMeta( CWM cwm, RelationshipMeta relationshipMeta, CwmSchema cwmSchema ) {
if ( !hasAccess( CwmSchemaFactoryInterface.ACCESS_TYPE_SCHEMA_ADMIN, null ) ) {
throw new CwmSchemaFactoryException( Messages
.getString( "CwmSchemaFactory.ERROR_0001_SCHEMA_ADMIN_ACCESS_DENIED" ) ); //$NON-NLS-1$
}
CwmKeyRelationship relationship = cwm.createRelationship();
@SuppressWarnings( "unchecked" )
Collection<CwmTaggedValue> pairs = relationship.getTaggedValue();
// Parent table
if ( relationshipMeta.getTableFrom() != null ) {
pairs
.add( cwm.createTaggedValue( CWM.TAG_RELATIONSHIP_TABLENAME_PARENT, relationshipMeta.getTableFrom().getId() ) );
}
// Child table
if ( relationshipMeta.getTableTo() != null ) {
pairs.add( cwm.createTaggedValue( CWM.TAG_RELATIONSHIP_TABLENAME_CHILD, relationshipMeta.getTableTo().getId() ) );
}
// Complex join or between 2 fields?
if ( relationshipMeta.isComplex() ) {
pairs.add( cwm.createTaggedValue( CWM.TAG_RELATIONSHIP_IS_COMPLEX, "Y" ) ); //$NON-NLS-1$
if ( !Const.isEmpty( relationshipMeta.getComplexJoin() ) ) {
pairs.add( cwm.createTaggedValue( CWM.TAG_RELATIONSHIP_COMPLEX_JOIN, relationshipMeta.getComplexJoin() ) );
}
} else {
// Parent table
if ( relationshipMeta.getFieldFrom() != null ) {
pairs.add( cwm.createTaggedValue( CWM.TAG_RELATIONSHIP_FIELDNAME_PARENT, relationshipMeta.getFieldFrom()
.getId() ) );
}
// Parent table
if ( relationshipMeta.getFieldTo() != null ) {
pairs
.add( cwm.createTaggedValue( CWM.TAG_RELATIONSHIP_FIELDNAME_CHILD, relationshipMeta.getFieldTo().getId() ) );
}
}
// And then the type of relationship between the two tables...
//
pairs.add( cwm.createTaggedValue( CWM.TAG_RELATIONSHIP_TYPE, relationshipMeta.getTypeDesc() ) );
// Save the relationship join order key
//
pairs.add( cwm.createTaggedValue( CWM.TAG_RELATIONSHIP_JOIN_ORDER_KEY, relationshipMeta.getJoinOrderKey() ) );
// Save the relationship description too
//
pairs.add( cwm.createTaggedValue( CWM.TAG_RELATIONSHIP_DESCRIPTION, relationshipMeta.getDescription() ) );
// add the relationship to the schema
@SuppressWarnings( "unchecked" )
Collection<CwmKeyRelationship> cr = cwmSchema.getOwnedElement();
cr.add( relationship );
}
示例13: hasService
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
public boolean hasService() {
return !Const.isEmpty( serviceURL ) && !Const.isEmpty( serviceName ) && !Const.isEmpty( detailNameParameter );
}
示例14: hasFile
import org.pentaho.pms.util.Const; //导入方法依赖的package包/类
public boolean hasFile() {
return !Const.isEmpty( filename );
}