Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.ISelectionMapper


    boolean causingPrompting = false; // Set to true if this securefilter
    // component actually adds feeback parameters.
    for ( Iterator it = selList.iterator(); it.hasNext(); ) {
      entry = (SelEntry) it.next();

      ISelectionMapper selMap =
          SelectionMapper.create( entry.selectionParam, entry.valueCol, entry.dispCol,
            entry.title, entry.displayStyle );

      // If we have a value for the input param, verify that it is within the selections
      if ( ( entry.inputParam.hasValue() || ( entry.inputParam.hasDefaultValue() && !feedbackAllowed() ) )
          && !parameterUINeeded ) {
        // TODO support numeric values here
        Object value = entry.inputParam.getValue();
        if ( value instanceof String ) {
          if ( ( selMap != null ) && !selMap.hasValue( (String) value ) ) {
            if ( !entry.isOptional || !"".equals( value ) ) { //$NON-NLS-1$
              error( Messages
                  .getInstance()
                  .getErrorString(
                    "SecureFilterComponent.ERROR_0001_INVALID_SELECTION", entry.inputParam.getValue().toString(),
                    entry.inputParam.getName() ) ); //$NON-NLS-1$
              isOk = false;
            }
          } // else this should be ok, we are just checking for selMap's existance
        } else if ( value instanceof Object[] ) {
          // test each item
          if ( selMap != null ) {
            Object[] values = (Object[]) value;
            for ( Object element : values ) {
              if ( !selMap.hasValue( element.toString() ) ) {
                if ( !entry.isOptional || !"".equals( value ) ) { //$NON-NLS-1$
                  error( Messages
                      .getInstance()
                      .getErrorString(
                        "SecureFilterComponent.ERROR_0001_INVALID_SELECTION", entry.inputParam.getValue().toString(),
                        entry.inputParam.getName() ) ); //$NON-NLS-1$
                  isOk = false;
                }
              }
            }
          } // else this should be ok, we are just checking for selMap's existence
        } else {
          // we cannot validate this
          error( Messages
              .getInstance()
              .getErrorString(
                "SecureFilterComponent.ERROR_0001_INVALID_SELECTION", entry.inputParam.getValue().toString(),
                entry.inputParam.getName() ) ); //$NON-NLS-1$
          isOk = false;
        }
      } else { // Need to prompt
        if ( selMap == null ) {
          entry.createFeedbackParam = true;
          if ( !entry.isOptional ) {
            causingPrompting = true; // trigger feedback below
          }
        } else if ( !entry.promptOne && ( selMap.selectionCount() == 1 ) ) {
          entry.inputParam.setValue( selMap.getValueAt( 0 ) );
        } else if ( !feedbackAllowed() && entry.isOptional ) {
          isOk = true;
        } else if ( !feedbackAllowed() ) {
          isOk = false;
        } else {
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.ISelectionMapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.