本文整理汇总了Java中org.pentaho.di.core.parameters.NamedParams.listParameters方法的典型用法代码示例。如果您正苦于以下问题:Java NamedParams.listParameters方法的具体用法?Java NamedParams.listParameters怎么用?Java NamedParams.listParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.parameters.NamedParams
的用法示例。
在下文中一共展示了NamedParams.listParameters方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setParams
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
/**
* 将来源对象的参数拷贝到目标对象,并根据要求修改 <br/>
* @author jingma
* @param target 要设置的目标对象
* @param source 来源对象
* @param params 要修改的参数
*/
public static void setParams(NamedParams target,
NamedParams source,Map<String, String> params) {
//修改参数
target.eraseParameters();
try {
for ( String key : source.listParameters() ) {
String defaultVal = source.getParameterDefault( key );
if(params.containsKey(key)){
defaultVal = params.get(key);
}
target.addParameterDefinition( key, defaultVal,
source.getParameterDescription( key ) );
}
} catch (Exception e) {
log.error("保存JOB失败", e);
}
}
示例2: filterUserParameters
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
private NamedParams filterUserParameters( NamedParams params ) {
NamedParams userParams = new NamedParamsDefault();
if ( !isEmpty( params ) ) {
for ( String paramName : params.listParameters() ) {
if ( isUserParameter( paramName ) ) {
try {
userParams.addParameterDefinition( paramName, StringUtils.EMPTY, StringUtils.EMPTY );
} catch ( DuplicateParamException e ) {
// ignore
}
}
}
}
return userParams;
}
示例3: setParametersAsVariablesInUI
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
public void setParametersAsVariablesInUI(NamedParams namedParameters, VariableSpace space) {
for (String param : namedParameters.listParameters()) {
try {
space.setVariable(param, Const.NVL(namedParameters.getParameterValue(param), Const.NVL(namedParameters.getParameterDefault(param), Const.NVL(space.getVariable(param), ""))));
}
catch(Exception e) {
// ignore this
}
}
}
示例4: setParametersAsVariablesInUI
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
public void setParametersAsVariablesInUI(NamedParams namedParameters, VariableSpace space) {
for (String param : namedParameters.listParameters()) {
try {
space.setVariable(param, Const.NVL(namedParameters.getParameterValue(param), Const.NVL(namedParameters
.getParameterDefault(param), Const.NVL(space.getVariable(param), ""))));
} catch (Exception e) {
// ignore this
}
}
}
示例5: testTransformationUserParameters
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
@Test
public void testTransformationUserParameters() throws Exception {
PdiAction action = new PdiAction();
action.setRepositoryName( KettleFileRepositoryMeta.REPOSITORY_TYPE_ID );
action.setArguments( new String[] { "dummyArg" } );
action.setDirectory( SOLUTION_REPOSITORY );
action.setTransformation( SAMPLE_TRANS );
action.execute();
Assert.isTrue( action.localTrans != null && action.localTrans.getTransMeta() != null );
NamedParams np = action.localTrans.getTransMeta();
boolean protectedParameterNameExistsInKtr = false;
for ( String param : np.listParameters() ) {
protectedParameterNameExistsInKtr |= param != null && param.equals( SAMPLE_PROTECTED_PARAMETER_NAME );
}
// we make sure: this ktr does indeed have a system/hidden parameter
Assert.isTrue( protectedParameterNameExistsInKtr );
// reset attribute
protectedParameterNameExistsInKtr = false;
// we now call IPdiContentProvider.getUserParameters( kjb ), that should filter out protected parameters
IPdiContentProvider pdiContentProvider = new PdiContentProvider( PentahoSystem.get( IUnifiedRepository.class ) );
String[] userParams = pdiContentProvider.getUserParameters( SOLUTION_REPOSITORY + SAMPLE_TRANS + ".ktr" );
for ( String userParam : userParams ) {
protectedParameterNameExistsInKtr |= userParam != null && userParam.equals( SAMPLE_PROTECTED_PARAMETER_NAME );
}
// we make sure: IPdiContentProvider has filtered it out
Assert.isTrue( !protectedParameterNameExistsInKtr );
}
示例6: testJobUserParameters
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
@Test
public void testJobUserParameters() throws Exception {
PdiAction action = new PdiAction();
action.setRepositoryName( KettleFileRepositoryMeta.REPOSITORY_TYPE_ID );
action.setArguments( new String[] { "dummyArg" } );
action.setDirectory( SOLUTION_REPOSITORY );
action.setJob( SAMPLE_JOB );
action.execute();
Assert.isTrue( action.localJob != null && action.localJob.getJobMeta() != null );
NamedParams np = action.localJob.getJobMeta();
boolean protectedParameterNameExistsInKjb = false;
for ( String param : np.listParameters() ) {
protectedParameterNameExistsInKjb |= param != null && param.equals( SAMPLE_PROTECTED_PARAMETER_NAME );
}
// we make sure: this kjb does indeed have a system/hidden parameter
Assert.isTrue( protectedParameterNameExistsInKjb );
// reset attribute
protectedParameterNameExistsInKjb = false;
// we now call IPdiContentProvider.getUserParameters( kjb ), that should filter out protected parameters
IPdiContentProvider pdiContentProvider = new PdiContentProvider( PentahoSystem.get( IUnifiedRepository.class ) );
String[] userParams = pdiContentProvider.getUserParameters( SOLUTION_REPOSITORY + SAMPLE_JOB + ".kjb" );
for ( String userParam : userParams ) {
protectedParameterNameExistsInKjb |= userParam != null && userParam.equals( SAMPLE_PROTECTED_PARAMETER_NAME );
}
// we make sure: IPdiContentProvider has filtered it out
Assert.isTrue( !protectedParameterNameExistsInKjb );
}
示例7: setParametersAsVariablesInUI
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
public void setParametersAsVariablesInUI( NamedParams namedParameters, VariableSpace space ) {
for ( String param : namedParameters.listParameters() ) {
try {
space.setVariable( param, Const.NVL( namedParameters.getParameterValue( param ), Const.NVL(
namedParameters.getParameterDefault( param ), Const.NVL( space.getVariable( param ), "" ) ) ) );
} catch ( Exception e ) {
// ignore this
}
}
}
示例8: getUserParameters
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
@Override
public String[] getUserParameters( String kettleFilePath ) {
List<String> userParams = new ArrayList<String>();
if ( !StringUtils.isEmpty( kettleFilePath ) ) {
try {
NamedParams np = getMeta( kettleFilePath );
if ( !isEmpty( np = filterUserParameters( np ) ) ) {
return np.listParameters();
}
} catch ( KettleException e ) {
log.error( e );
}
}
return userParams.toArray( new String[] {} );
}
示例9: isEmpty
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
private boolean isEmpty( NamedParams np ) {
return np == null || np.listParameters() == null || np.listParameters().length == 0;
}
示例10: getUserParameters
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
@Override
public String[] getUserParameters( String kettleFilePath ) {
List<String> userParams = new ArrayList<String>();
if ( !StringUtils.isEmpty( kettleFilePath ) ) {
RepositoryFile file = unifiedRepository.getFile( kettleFilePath );
if ( file != null ) {
try {
NamedParams np = getMeta( file );
if ( !isEmpty( np = filterUserParameters( np ) ) ) {
return np.listParameters();
}
} catch ( KettleException e ) {
log.error( e );
}
}
}
return userParams.toArray( new String[] {} );
}
示例11: isEmpty
import org.pentaho.di.core.parameters.NamedParams; //导入方法依赖的package包/类
private boolean isEmpty( NamedParams np ) {
return np == null || np.listParameters() == null || np.listParameters().length == 0;
}