0

I have two target streams (Matches and mismatches) defined as below:

@Override
public StepIOMetaInterface getStepIOMeta() {

    StepMeta stepMeta = new StepMeta();


    if (ioMeta == null) {
        ioMeta = new StepIOMeta(true, false, false, false, false, true);

        StreamInterface matchStream = new Stream(StreamType.TARGET, null, "Matches", StreamIcon.TARGET, null);
        StreamInterface mismatchStream = new Stream(StreamType.TARGET, null, "Mismatches", StreamIcon.TARGET, null);

        ioMeta.addStream(matchStream);
        ioMeta.addStream(mismatchStream);

    }

    return ioMeta;
}

I want to send different meta data to these two targets. The meta data is received from the previous steps. For match, it needs to be a concatenation of both input streams and for mismatch just the first input stream.

I am stuck on how to define the metadata separately for the two target streams.

Appreciate your help.

Abhishek Dey Das
  • 587
  • 7
  • 23

1 Answers1

0
 List<StreamInterface> targets=getStepIOMeta().getTargetStreams();    
      List<StreamInterface> infos=getStepIOMeta().getInfoStreams();   
       if ( info != null ) 
     {
           if(targets!=null)
            {

if(nextStep.getName().equals(targets.get(0).getStepname()))  
                    {
                        if ( info != null ) {  
                              for ( int i = 0; i < info.length; i++ ) {  
                                if ( info[i] != null ) {  
                                  r.mergeRowMeta( info[i] );  
                                }
                              }
                            }
                    }
                    if(nextStep.getName().equals(targets.get(1).getStepname()))
                    {
                        if ( info != null ) {  
                              if ( info.length > 0 && info[0] != null ) {   
                                r.mergeRowMeta( info[0] );  
                              }   
                            }  
                    }
                    if(nextStep.getName().equals(targets.get(2).getStepname()))
                    {
                        if ( info != null ) {
                              if ( info.length > 0 && info[0] != null ) {
                                r.mergeRowMeta( info[1] );
                              }
                            }  
                    }

            }
  • this should be added to getFields Method in order to pass metadata to target steps but in order to do that you should have the list of targets and know their names so you can take the metadata from first step and pass to target – Shyqyri Jul 24 '15 at 09:59