org.pentaho.di.core.exception.KettlePluginException Java Examples

The following examples show how to use org.pentaho.di.core.exception.KettlePluginException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransPartitioningTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * This is a case when first step running 2 copies and next is partitioned one.
 * 
 * @throws KettlePluginException
 */
private void prepareStepMetas_x2_cl1() throws KettlePluginException {
  StepMeta dummy1 = new StepMeta( ONE, null );
  StepMeta dummy2 = new StepMeta( TWO, null );

  PartitionSchema schema1 = new PartitionSchema( "p1", Arrays.asList( new String[] { PID1, PID2 } ) );
  StepPartitioningMeta partMeta1 = new StepPartitioningMeta( "Mirror to all partitions", schema1 );

  dummy2.setStepPartitioningMeta( partMeta1 );
  dummy1.setCopies( 2 );

  chain.add( dummy1 );
  chain.add( dummy2 );
  for ( StepMeta item : chain ) {
    item.setStepMetaInterface( new DummyTransMeta() );
  }
}
 
Example #2
Source File: RegexEvalMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private ValueMetaInterface constructValueMeta( ValueMetaInterface sourceValueMeta, String fieldName, int i,
  String name ) throws KettlePluginException {
  int type = fieldType[i];
  if ( type == ValueMetaInterface.TYPE_NONE ) {
    type = ValueMetaInterface.TYPE_STRING;
  }
  ValueMetaInterface v;
  if ( sourceValueMeta == null ) {
    v = ValueMetaFactory.createValueMeta( fieldName, type );
  } else {
    v = ValueMetaFactory.cloneValueMeta( sourceValueMeta, type );
  }
  v.setLength( fieldLength[i] );
  v.setPrecision( fieldPrecision[i] );
  v.setOrigin( name );
  v.setConversionMask( fieldFormat[i] );
  v.setDecimalSymbol( fieldDecimal[i] );
  v.setGroupingSymbol( fieldGroup[i] );
  v.setCurrencySymbol( fieldCurrency[i] );
  v.setTrimType( fieldTrimType[i] );

  return v;
}
 
Example #3
Source File: ExcelInputMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public RowMetaInterface getEmptyFields() {
  RowMetaInterface row = new RowMeta();
  if ( field != null ) {
    for ( int i = 0; i < field.length; i++ ) {
      ValueMetaInterface v;
      try {
        v = ValueMetaFactory.createValueMeta( field[ i ].getName(), field[ i ].getType() );
      } catch ( KettlePluginException e ) {
        v = new ValueMetaNone( field[ i ].getName() );
      }
      row.addValueMeta( v );
    }
  }

  return row;
}
 
Example #4
Source File: AbstractMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void importFromMetaStore() throws MetaStoreException, KettlePluginException {
  // Read the databases...
  //
  if ( metaStore != null ) {
    IMetaStoreElementType databaseType =
      metaStore.getElementTypeByName(
        PentahoDefaults.NAMESPACE, PentahoDefaults.DATABASE_CONNECTION_ELEMENT_TYPE_NAME );
    if ( databaseType != null ) {
      List<IMetaStoreElement> databaseElements = metaStore.getElements( PentahoDefaults.NAMESPACE, databaseType );
      for ( IMetaStoreElement databaseElement : databaseElements ) {
        addDatabase( DatabaseMetaStoreUtil.loadDatabaseMetaFromDatabaseElement(
          metaStore, databaseElement ), false );
      }
    }

    // TODO: do the same for slaves, clusters, partition schemas
  }
}
 
Example #5
Source File: PluginRegistry.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * @param pluginType the type of plugin to get information for
 * @return a row buffer containing plugin information for the given plugin type
 * @throws KettlePluginException
 */
public RowBuffer getPluginInformation( Class<? extends PluginTypeInterface> pluginType )
    throws KettlePluginException {
  RowBuffer rowBuffer = new RowBuffer( getPluginInformationRowMeta() );
  for ( PluginInterface plugin : getPlugins( pluginType ) ) {

    Object[] row = new Object[getPluginInformationRowMeta().size()];
    int rowIndex = 0;

    row[rowIndex++] = getPluginType( plugin.getPluginType() ).getName();
    row[rowIndex++] = plugin.getIds()[0];
    row[rowIndex++] = plugin.getName();
    row[rowIndex++] = Const.NVL( plugin.getDescription(), "" );
    row[rowIndex++] = Utils.isEmpty( plugin.getLibraries() ) ? "" : plugin.getLibraries().toString();
    row[rowIndex++] = Const.NVL( plugin.getImageFile(), "" );
    row[rowIndex++] = plugin.getClassMap().values().toString();
    row[rowIndex] = Const.NVL( plugin.getCategory(), "" );

    rowBuffer.getBuffer().add( row );
  }
  return rowBuffer;
}
 
Example #6
Source File: PartitionerPluginType.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void registerXmlPlugins() throws KettlePluginException {
  for ( PluginFolderInterface folder : pluginFolders ) {

    if ( folder.isPluginXmlFolder() ) {
      List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() );
      for ( FileObject file : pluginXmlFiles ) {

        try {
          Document document = XMLHandler.loadXMLFile( file );
          Node pluginNode = XMLHandler.getSubNode( document, "partitioner-plugin" );
          if ( pluginNode != null ) {
            registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this
              .getClass(), false, file.getParent().getURL() );
          }
        } catch ( Exception e ) {
          // We want to report this plugin.xml error, perhaps an XML typo or something like that...
          //
          log.logError(
            "Error found while reading partitioning plugin.xml file: " + file.getName().toString(), e );
        }
      }
    }
  }
}
 
Example #7
Source File: CartePluginType.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void registerXmlPlugins() throws KettlePluginException {
  for ( PluginFolderInterface folder : pluginFolders ) {

    if ( folder.isPluginXmlFolder() ) {
      List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() );
      for ( FileObject file : pluginXmlFiles ) {

        try {
          Document document = XMLHandler.loadXMLFile( file );
          Node pluginNode = XMLHandler.getSubNode( document, "plugin" );
          if ( pluginNode != null ) {
            registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this
              .getClass(), false, file.getParent().getURL() );
          }
        } catch ( Exception e ) {
          // We want to report this plugin.xml error, perhaps an XML typo or
          // something like that...
          //
          log.logError( "Error found while reading step plugin.xml file: " + file.getName().toString(), e );
        }
      }
    }
  }
}
 
Example #8
Source File: StepPluginType.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void registerXmlPlugins() throws KettlePluginException {
  for ( PluginFolderInterface folder : pluginFolders ) {

    if ( folder.isPluginXmlFolder() ) {
      List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() );
      for ( FileObject file : pluginXmlFiles ) {

        try {
          Document document = XMLHandler.loadXMLFile( file );
          Node pluginNode = XMLHandler.getSubNode( document, "plugin" );
          if ( pluginNode != null ) {
            registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this
              .getClass(), false, file.getParent().getURL() );
          }
        } catch ( Exception e ) {
          // We want to report this plugin.xml error, perhaps an XML typo or something like that...
          //
          log.logError( "Error found while reading step plugin.xml file: " + file.getName().toString(), e );
        }
      }
    }
  }
}
 
Example #9
Source File: JobEntryPluginType.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void registerXmlPlugins() throws KettlePluginException {
  for ( PluginFolderInterface folder : pluginFolders ) {

    if ( folder.isPluginXmlFolder() ) {
      List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() );
      for ( FileObject file : pluginXmlFiles ) {

        try {
          Document document = XMLHandler.loadXMLFile( file );
          Node pluginNode = XMLHandler.getSubNode( document, "plugin" );
          if ( pluginNode != null ) {
            registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this
              .getClass(), false, file.getParent().getURL() );
          }
        } catch ( Exception e ) {
          // We want to report this plugin.xml error, perhaps an XML typo or something like that...
          //
          log.logError( "Error found while reading job entry plugin.xml file: " + file.getName().toString(), e );
        }
      }
    }
  }
}
 
Example #10
Source File: RepositoryPluginType.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void registerXmlPlugins() throws KettlePluginException {
  for ( PluginFolderInterface folder : pluginFolders ) {

    if ( folder.isPluginXmlFolder() ) {
      List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() );
      for ( FileObject file : pluginXmlFiles ) {

        try {
          Document document = XMLHandler.loadXMLFile( file );
          Node pluginNode = XMLHandler.getSubNode( document, "plugin" );

          registerPluginFromXmlResource(
            pluginNode, KettleVFS.getFilename( file.getParent() ), this.getClass(), false, file
              .getParent().getURL() );
        } catch ( Exception e ) {
          // We want to report this plugin.xml error, perhaps an XML typo or something like that...
          //
          log.logError( "Error found while reading repository plugin.xml file: " + file.getName().toString(), e );
        }
      }
    }
  }
}
 
Example #11
Source File: MemoryGroupByMetaGetFieldsTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws KettlePluginException {
  mockSpace = mock( VariableSpace.class );
  doReturn("N" ).when( mockSpace ).getVariable( any(), anyString() );

  rowMeta = spy( new RowMeta() );
  memoryGroupByMeta = spy( new MemoryGroupByMeta() );

  mockStatic( ValueMetaFactory.class );
  when( ValueMetaFactory.createValueMeta( anyInt() ) ).thenCallRealMethod();
  when( ValueMetaFactory.createValueMeta( anyString(), anyInt() ) ).thenCallRealMethod();
  when( ValueMetaFactory.createValueMeta( "maxDate", 3, -1, -1 ) ).thenReturn( new ValueMetaDate( "maxDate" ) );
  when( ValueMetaFactory.createValueMeta( "minDate", 3, -1, -1 ) ).thenReturn( new ValueMetaDate( "minDate" ) );
  when( ValueMetaFactory.createValueMeta( "countDate", 5, -1, -1 ) ).thenReturn( new ValueMetaInteger( "countDate" ) );
  when( ValueMetaFactory.getValueMetaName( 3 ) ).thenReturn( "Date" );
  when( ValueMetaFactory.getValueMetaName( 5 ) ).thenReturn( "Integer" );
}
 
Example #12
Source File: LoggingPluginType.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
protected void registerXmlPlugins() throws KettlePluginException {
  for ( PluginFolderInterface folder : pluginFolders ) {

    if ( folder.isPluginXmlFolder() ) {
      List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() );
      for ( FileObject file : pluginXmlFiles ) {

        try {
          Document document = XMLHandler.loadXMLFile( file );
          Node pluginNode = XMLHandler.getSubNode( document, "plugin" );
          if ( pluginNode != null ) {
            registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this
              .getClass(), false, file.getParent().getURL() );
          }
        } catch ( Exception e ) {
          // We want to report this plugin.xml error, perhaps an XML typo or something like that...
          //
          log.logError( "Error found while reading logging plugin.xml file: " + file.getName().toString(), e );
        }
      }
    }
  }
}
 
Example #13
Source File: TransPartitioningTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * This is a case when we have 2 steps, but partitioned differently
 * 
 * @throws KettlePluginException
 */
private void prepareStepMetas_cl1_cl2() throws KettlePluginException {
  StepMeta dummy1 = new StepMeta( ONE, null );
  StepMeta dummy2 = new StepMeta( TWO, null );

  PartitionSchema schema1 = new PartitionSchema( "p1", Arrays.asList( new String[] { PID1, PID2 } ) );
  PartitionSchema schema2 = new PartitionSchema( "p2", Arrays.asList( new String[] { PID1, PID2 } ) );

  StepPartitioningMeta partMeta1 = new StepPartitioningMeta( "Mirror to all partitions", schema1 );
  StepPartitioningMeta partMeta2 = new StepPartitioningMeta( "Mirror to all partitions", schema2 );
  partMeta1.setPartitionSchemaName( schema1.getName() );
  partMeta2.setPartitionSchemaName( schema2.getName() );

  dummy1.setStepPartitioningMeta( partMeta1 );
  dummy2.setStepPartitioningMeta( partMeta2 );

  chain.add( dummy1 );
  chain.add( dummy2 );
  for ( StepMeta item : chain ) {
    item.setStepMetaInterface( new DummyTransMeta() );
  }
}
 
Example #14
Source File: TransPartitioningTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * This case simulates when we do have 2 step partitioned with one same partitioner We want to get a 'swim-lanes'
 * transformation
 * 
 * @throws KettlePluginException
 */
private void prepareStepMetas_cl1_cl1() throws KettlePluginException {
  StepMeta dummy1 = new StepMeta( ONE, null );
  StepMeta dummy2 = new StepMeta( TWO, null );

  PartitionSchema schema = new PartitionSchema( "p1", Arrays.asList( new String[] { PID1, PID2 } ) );
  // for delayed binding StepPartitioning meta does not achieve
  // schema name when using in constructor so we have to set it
  // explicitly. See equals implementation for StepPartitioningMeta.
  StepPartitioningMeta partMeta = new StepPartitioningMeta( "Mirror to all partitions", schema );
  // that is what I am talking about:
  partMeta.setPartitionSchemaName( schema.getName() );

  dummy1.setStepPartitioningMeta( partMeta );
  dummy2.setStepPartitioningMeta( partMeta );

  chain.add( dummy1 );
  chain.add( dummy2 );
  for ( StepMeta item : chain ) {
    item.setStepMetaInterface( new DummyTransMeta() );
  }
}
 
Example #15
Source File: StepPartitioningMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * @param method
 *          the partitioning method to set
 */
public void setMethod( String method ) throws KettlePluginException {
  if ( !method.equals( this.method ) ) {
    this.method = method;
    createPartitioner( method );
    hasChanged = true;
  }
}
 
Example #16
Source File: EmbeddedKettleTransformationProducer.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private TransMeta loadTransformation( final ResourceKey contextKey ) throws KettleMissingPluginsException,
  KettlePluginException, KettleXMLException {
  final Document document = DocumentHelper.loadDocumentFromBytes( getTransformationRaw() );
  final Node node = XMLHandler.getSubNode( document, TransMeta.XML_TAG );
  final TransMeta meta = new TransMeta();
  meta.loadXML( node, null, true, null, null );
  final String filename = computeFullFilename( contextKey );
  if ( filename != null ) {
    logger.debug( "Computed Transformation Location: " + filename );
    meta.setFilename( filename );
  }
  return meta;
}
 
Example #17
Source File: OpenERPObjectInputMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public RowMetaInterface getRowMeta() throws KettlePluginException {
  RowMetaInterface rowMeta = new RowMeta();
  for ( FieldMapping map : this.getMappings() ) {
    rowMeta.addValueMeta( ValueMetaFactory.createValueMeta( map.target_field, map.target_field_type ) );
  }
  return rowMeta;
}
 
Example #18
Source File: SpoonPluginManagerTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws KettlePluginException {
  when( spoonPluginManager.getPluginRegistry() ).thenReturn( pluginRegistry );
  when( spoonPluginManager.getSpoonPerspectiveManager() ).thenReturn( spoonPerspectiveManager );
  when( pluginRegistry.loadClass( any( PluginInterface.class ) ) )
      .thenReturn( spoonPluginInterface1, spoonPluginInterface2 );
}
 
Example #19
Source File: RowsFromResultMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void getFields( RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep,
  VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
  for ( int i = 0; i < this.fieldname.length; i++ ) {
    ValueMetaInterface v;
    try {
      v = ValueMetaFactory.createValueMeta( fieldname[i], type[i], length[i], precision[i] );
      v.setOrigin( origin );
      r.addValueMeta( v );
    } catch ( KettlePluginException e ) {
      throw new KettleStepException( e );
    }
  }
}
 
Example #20
Source File: InjectorMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
  VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
  for ( int i = 0; i < this.fieldname.length; i++ ) {
    ValueMetaInterface v;
    try {
      v = ValueMetaFactory.createValueMeta( this.fieldname[i], type[i], length[i], precision[i] );
      inputRowMeta.addValueMeta( v );
    } catch ( KettlePluginException e ) {
      throw new KettleStepException( e );
    }
  }
}
 
Example #21
Source File: DatabaseMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpOnce() throws KettlePluginException, KettleException {
  // Register Natives to create a default DatabaseMeta
  DatabasePluginType.getInstance().searchPlugins();
  ValueMetaPluginType.getInstance().searchPlugins();
  KettleClientEnvironment.init();
}
 
Example #22
Source File: PluginRegistry.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public PluginTypeInterface getPluginType( Class<? extends PluginTypeInterface> pluginTypeClass )
    throws KettlePluginException {
  try {
    // All these plugin type interfaces are singletons...
    // So we should call a static getInstance() method...
    //
    Method method = pluginTypeClass.getMethod( "getInstance", new Class<?>[0] );

    return (PluginTypeInterface) method.invoke( null, new Object[0] );
  } catch ( Exception e ) {
    throw new KettlePluginException( "Unable to get instance of plugin type: " + pluginTypeClass.getName(), e );
  }
}
 
Example #23
Source File: TransPartitioningTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * This is a case when we have 1 step to 1 clustered step distribution.
 * 
 * @throws KettlePluginException
 */
private void prepareStepMetas_1_cl1() throws KettlePluginException {
  StepMeta dummy1 = new StepMeta( ONE, null );
  StepMeta dummy2 = new StepMeta( TWO, null );

  PartitionSchema schema = new PartitionSchema( "p1", Arrays.asList( new String[] { PID1, PID2 } ) );
  StepPartitioningMeta partMeta = new StepPartitioningMeta( "Mirror to all partitions", schema );
  dummy2.setStepPartitioningMeta( partMeta );

  chain.add( dummy1 );
  chain.add( dummy2 );
  for ( StepMeta item : chain ) {
    item.setStepMetaInterface( new DummyTransMeta() );
  }
}
 
Example #24
Source File: PurRepositoryProxyTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  mockRegistry = mock( PluginRegistry.class );
  mockPluginInterface = mock( PluginInterface.class );
  mockClassLoader = mock( ClassLoader.class );
  mockRepository = mock( PurRepository.class );
  try {
    when( mockRegistry.findPluginWithId( any(), anyString() ) ).thenReturn( mockPluginInterface );
    when( mockRegistry.getClassLoader( any() ) ).thenReturn( mockClassLoader );
    proxy = spy( new PurRepositoryProxy( mockRegistry ) );
  } catch ( KettlePluginException e ) {
    e.printStackTrace();
  }
}
 
Example #25
Source File: BasePluginType.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * This method registers plugins from the InputStream with the XML Resource
 *
 * @param inputStream
 * @throws KettlePluginException
 * @throws KettleXMLException
 */
protected void registerPlugins( InputStream inputStream ) throws KettlePluginException, KettleXMLException {
  Document document = XMLHandler.loadXMLFile( inputStream, null, true, false );

  Node repsNode = XMLHandler.getSubNode( document, getMainTag() );
  List<Node> repsNodes = XMLHandler.getNodes( repsNode, getSubTag() );

  for ( Node repNode : repsNodes ) {
    registerPluginFromXmlResource( repNode, getPath(), this.getClass(), true, null );
  }
}
 
Example #26
Source File: ValueMetaFactory.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static List<ValueMetaInterface> getValueMetaPluginClasses() throws KettlePluginException {

    List<ValueMetaInterface> list = new ArrayList<ValueMetaInterface>();

    List<PluginInterface> plugins = pluginRegistry.getPlugins( ValueMetaPluginType.class );
    for ( PluginInterface plugin : plugins ) {
      ValueMetaInterface valueMetaInterface = (ValueMetaInterface) pluginRegistry.loadClass( plugin );
      list.add( valueMetaInterface );
    }

    return list;
  }
 
Example #27
Source File: GroupByMetaGetFieldsTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws KettlePluginException {
  rowMeta = spy( new RowMeta() );
  groupByMeta = spy( new GroupByMeta() );

  mockStatic( ValueMetaFactory.class );
  when( ValueMetaFactory.createValueMeta( anyInt() ) ).thenCallRealMethod();
  when( ValueMetaFactory.createValueMeta( anyString(), anyInt() ) ).thenCallRealMethod();
  when( ValueMetaFactory.createValueMeta( "maxDate", 3, -1, -1 ) ).thenReturn( new ValueMetaDate( "maxDate" ) );
  when( ValueMetaFactory.createValueMeta( "minDate", 3, -1, -1 ) ).thenReturn( new ValueMetaDate( "minDate" ) );
  when( ValueMetaFactory.createValueMeta( "countDate", 5, -1, -1 ) ).thenReturn( new ValueMetaInteger( "countDate" ) );
  when( ValueMetaFactory.getValueMetaName( 3 ) ).thenReturn( "Date" );
  when( ValueMetaFactory.getValueMetaName( 5 ) ).thenReturn( "Integer" );
}
 
Example #28
Source File: ValidatorTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void testPatternExpectedCompile() throws KettlePluginException {
  ValidatorData data = new ValidatorData();
  ValidatorMeta meta = new ValidatorMeta();
  data.regularExpression = new String[ 1 ];
  data.regularExpressionNotAllowed = new String[ 1 ];
  data.patternExpected = new Pattern[ 1 ];
  data.patternDisallowed = new Pattern[ 1 ];

  Validation v = new Validation();
  v.setFieldName( "field" );
  v.setDataType( 1 );
  v.setRegularExpression( "${param}" );
  v.setRegularExpressionNotAllowed( "${param}" );
  meta.setValidations( Collections.singletonList( v ) );

  validator.setVariable( "param", "^(((0[1-9]|[12]\\d|3[01])\\/(0[13578]|1[02])\\/((1[6-9]|[2-9]\\d)\\d{2}))|("
    + "(0[1-9]|[12]\\d|30)\\/(0[13456789]|1[012])\\/((1[6-9]|[2-9]\\d)\\d{2}))|((0[1-9]|1\\d|2[0-8])\\/02\\/("
    + "(1[6-9]|[2-9]\\d)\\d{2}))|(29\\/02\\/((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|("
    + "(16|[2468][048]|[3579][26])00))))$" );

  doReturn( new ValueMetaString( "field" ) ).when( validator ).createValueMeta( anyString(), anyInt() );
  doReturn( new ValueMetaString( "field" ) ).when( validator ).cloneValueMeta(
    (ValueMetaInterface) anyObject(), anyInt() );

  validator.init( meta, data );
}
 
Example #29
Source File: StepDialogFragmentType.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void handlePluginAnnotation( Class<?> clazz, java.lang.annotation.Annotation annotation,
  List<String> libraries, boolean nativePluginType, URL pluginFolder ) throws KettlePluginException {
  if ( ( (PluginDialog) annotation ).pluginType() == PluginDialog.PluginType.STEP ) {
    super.handlePluginAnnotation( clazz, annotation, libraries, nativePluginType, pluginFolder );
  }
}
 
Example #30
Source File: JobEntryDialogFragmentType.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void handlePluginAnnotation( Class<?> clazz, java.lang.annotation.Annotation annotation,
  List<String> libraries, boolean nativePluginType, URL pluginFolder ) throws KettlePluginException {
  if ( ( (PluginDialog) annotation ).pluginType() == PluginDialog.PluginType.JOBENTRY ) {
    super.handlePluginAnnotation( clazz, annotation, libraries, nativePluginType, pluginFolder );
  }
}