Ejemplo n.º 1
0
 /**
  * copy property's values from SVD operator to SVD Calculator operator this function should be
  * called when update SVD operator's properties and connect SVD operator to SVD calculator.
  *
  * @param svdOperator
  * @param calculatorOperator
  */
 public static void syncSVDParams2SVDCalculator(
     Operator svdOperator, Operator calculatorOperator) {
   final int svdOperatorIdx = 1, svdCalculatorOperatorIdx = 0;
   final String[][] syncParamsNameMapping = {
     {OperatorParameter.NAME_UmatrixFullTable, OperatorParameter.NAME_UmatrixTable},
     {OperatorParameter.NAME_RowNameF, OperatorParameter.NAME_RowName},
     {OperatorParameter.NAME_UdependentColumn, OperatorParameter.NAME_dependentColumn},
     {OperatorParameter.NAME_VmatrixFullTable, OperatorParameter.NAME_VmatrixTable},
     {OperatorParameter.NAME_ColNameF, OperatorParameter.NAME_ColName},
     {OperatorParameter.NAME_VdependentColumn, OperatorParameter.NAME_dependentColumn},
     {OperatorParameter.NAME_SmatrixFullTable, OperatorParameter.NAME_singularValueTable},
     {OperatorParameter.NAME_SdependentColumn, OperatorParameter.NAME_dependentColumn}
   };
   for (String[] syncParamNameMapping : syncParamsNameMapping) {
     Object value =
         svdOperator.getOperatorParameter(syncParamNameMapping[svdOperatorIdx]).getValue();
     boolean isTable = false;
     String schemaName = null;
     if (syncParamNameMapping[svdOperatorIdx] == OperatorParameter.NAME_UmatrixTable) {
       schemaName =
           StringHandler.doubleQ(
               (String)
                   svdOperator
                       .getOperatorParameter(OperatorParameter.NAME_UmatrixSchema)
                       .getValue());
       isTable |= true;
     } else if (syncParamNameMapping[svdOperatorIdx] == OperatorParameter.NAME_VmatrixTable) {
       schemaName =
           StringHandler.doubleQ(
               (String)
                   svdOperator
                       .getOperatorParameter(OperatorParameter.NAME_VmatrixSchema)
                       .getValue());
       isTable |= true;
     } else if (syncParamNameMapping[svdOperatorIdx]
         == OperatorParameter.NAME_singularValueTable) {
       schemaName =
           StringHandler.doubleQ(
               (String)
                   svdOperator
                       .getOperatorParameter(OperatorParameter.NAME_singularValueSchema)
                       .getValue());
       isTable |= true;
     }
     if (isTable) {
       value = schemaName + "." + StringHandler.doubleQ((String) value);
     }
     calculatorOperator
         .getOperatorParameter(syncParamNameMapping[svdCalculatorOperatorIdx])
         .setValue(value);
   }
 }
  @Override
  public String validateInputLink(Operator precedingOperator) {
    String message = super.validateInputLink(precedingOperator);
    if (message == null || message.trim().equals("")) {
      if (!(precedingOperator instanceof RandomSamplingOperator)
          && !(precedingOperator instanceof StratifiedSamplingOperator)) {
        message =
            NLSUtility.bind(
                LanguagePack.getMessage(LanguagePack.MESSAGE_CHECK_LINK, locale),
                precedingOperator.getToolTipTypeName(),
                this.getToolTipTypeName());
      }
    }

    if (message == null || message.trim().equals("")) {
      List<UIOperatorModel> parentList = OperatorUtility.getParentList(getOperModel());
      if (parentList != null && parentList.size() > 0) {
        message =
            NLSUtility.bind(
                LanguagePack.getMessage(LanguagePack.CANNOT_LINKMUTIL_TOOPERATOR, locale),
                this.getToolTipTypeName());
      }
    }
    return message;
  }