Java Code Examples for org.pentaho.di.job.JobMeta#nrNotes()

The following examples show how to use org.pentaho.di.job.JobMeta#nrNotes() . 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: JobHasANoteImportRule.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public List<ImportValidationFeedback> verifyRule( Object subject ) {

  List<ImportValidationFeedback> feedback = new ArrayList<ImportValidationFeedback>();

  if ( !isEnabled() ) {
    return feedback;
  }
  if ( !( subject instanceof JobMeta ) ) {
    return feedback;
  }

  JobMeta jobMeta = (JobMeta) subject;

  if ( jobMeta.nrNotes() == 0 ) {
    feedback.add( new ImportValidationFeedback(
      this, ImportValidationResultType.ERROR, "There is not even a single note in the job." ) );
  } else {
    feedback.add( new ImportValidationFeedback(
      this, ImportValidationResultType.APPROVAL, "At least one not is present in the job." ) );
  }

  return feedback;
}
 
Example 2
Source File: JobGraph.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void selectInRect( JobMeta jobMeta, org.pentaho.di.core.gui.Rectangle rect ) {
  int i;
  for ( i = 0; i < jobMeta.nrJobEntries(); i++ ) {
    JobEntryCopy je = jobMeta.getJobEntry( i );
    Point p = je.getLocation();
    if ( ( ( p.x >= rect.x && p.x <= rect.x + rect.width ) || ( p.x >= rect.x + rect.width && p.x <= rect.x ) )
      && ( ( p.y >= rect.y && p.y <= rect.y + rect.height ) || ( p.y >= rect.y + rect.height && p.y <= rect.y ) ) ) {
      je.setSelected( true );
    }
  }
  for ( i = 0; i < jobMeta.nrNotes(); i++ ) {
    NotePadMeta ni = jobMeta.getNote( i );
    Point a = ni.getLocation();
    Point b = new Point( a.x + ni.width, a.y + ni.height );
    if ( rect.contains( a.x, a.y ) && rect.contains( b.x, b.y ) ) {
      ni.setSelected( true );
    }
  }
}