@Override
  public void undo() {
    propagateDatas(false);

    if (currentInputMetadata != null) {
      if (!currentInputMetadata.sameMetadataAs(oldInputMetadata, IMetadataColumn.OPTIONS_NONE)) {
        currentInputMetadata.setListColumns(oldInputMetadata.getListColumns());
        if (inputWasRepository) {
          inputNode.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(), EmfComponent.REPOSITORY);
        }
      }
    }
    if (!currentOutputMetadata.sameMetadataAs(oldOutputMetadata, IMetadataColumn.OPTIONS_NONE)) {
      List<IMetadataColumn> currentColumns =
          new ArrayList<IMetadataColumn>(oldOutputMetadata.getListColumns());
      currentOutputMetadata.setListColumns(currentColumns);
      MetadataToolHelper.copyTable(oldOutputMetadata, currentOutputMetadata);
    }

    for (INodeConnector connector : node.getListConnector()) {
      if ((!connector.getName().equals(currentConnector))
          && connector.getBaseSchema().equals(currentConnector)) {
        MetadataToolHelper.copyTable(
            oldOutputMetadata, node.getMetadataFromConnector(connector.getName()));
      }
    }
    if (outputWasRepository) {
      node.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(), EmfComponent.REPOSITORY);
    }
    for (ChangeMetadataCommand cmd : propagatedChange) {
      cmd.undo();
    }

    List<ColumnNameChanged> columnNameChanged =
        MetadataToolHelper.getColumnNameChanged(oldOutputMetadata, newOutputMetadata);
    ColumnListController.updateColumnList(node, columnNameChanged, true);
    // newOutputMetadata.setListColumns(new
    // ArrayList<IMetadataColumn>(oldOutputMetadata.getListColumns()));

    if (!internal) {
      updateColumnList(newOutputMetadata, oldOutputMetadata);
      ((Process) node.getProcess()).checkProcess();
    }
    refreshMetadataChanged();
  }
  @Override
  public void execute() {
    propagatedChange.clear();

    propagateDatas(true);
    if (currentInputMetadata != null) {
      if (!currentInputMetadata.sameMetadataAs(newInputMetadata, IMetadataColumn.OPTIONS_NONE)) {
        if (!currentInputMetadata.sameMetadataAs(
            newInputMetadata, IMetadataColumn.OPTIONS_IGNORE_USED)) {
          String type = (String) inputNode.getPropertyValue(EParameterName.SCHEMA_TYPE.getName());
          if (type != null) {
            if (type.equals(EmfComponent.REPOSITORY)) {
              inputWasRepository = true;
              inputNode.setPropertyValue(
                  EParameterName.SCHEMA_TYPE.getName(), EmfComponent.BUILTIN);
            }
          }
        }
        MetadataToolHelper.copyTable(newInputMetadata, currentInputMetadata);
      }
    }

    if (!currentOutputMetadata.sameMetadataAs(newOutputMetadata, IMetadataColumn.OPTIONS_NONE)) {
      if (!currentOutputMetadata.sameMetadataAs(
          newOutputMetadata, IMetadataColumn.OPTIONS_IGNORE_USED)) {
        String type = (String) node.getPropertyValue(EParameterName.SCHEMA_TYPE.getName());
        if (type != null && type.equals(EmfComponent.REPOSITORY) && !repositoryMode) {
          // for one node has several schema_type,set mode for the current one
          if ((node.getElementParameter("SCHEMA_TYPE")
              .getContext()
              .equals(currentOutputMetadata.getAttachedConnector()))) {
            outputWasRepository = true;
            node.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(), EmfComponent.BUILTIN);
          }
        }
      }
      MetadataToolHelper.copyTable(newOutputMetadata, currentOutputMetadata);
    }
    if (inputSchemaParam != null
        && inputSchemaParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName()) != null
        && EmfComponent.REPOSITORY.equals(
            inputSchemaParam
                .getChildParameters()
                .get(EParameterName.SCHEMA_TYPE.getName())
                .getValue())) {
      // add by wzhang to fix bug 7898.
      IElementParameter elementParameter =
          node.getElementParameter(EParameterName.MAPPING.getName());
      if (elementParameter != null) {
        if (elementParameter.getValue() instanceof String) {
          String value = (String) elementParameter.getValue();
          if (!isDBComponent(value)) {
            schemaParam
                .getChildParameters()
                .get(EParameterName.SCHEMA_TYPE.getName())
                .setValue(EmfComponent.REPOSITORY);
            schemaParam
                .getChildParameters()
                .get(EParameterName.REPOSITORY_SCHEMA_TYPE.getName())
                .setValue(
                    inputSchemaParam
                        .getChildParameters()
                        .get(EParameterName.REPOSITORY_SCHEMA_TYPE.getName())
                        .getValue());
          }
        }
      }
    }

    for (INodeConnector connector : node.getListConnector()) {
      if ((!connector.getName().equals(currentConnector))
          && connector.getBaseSchema().equals(currentConnector)) {
        if (node.getComponent() != null
            && "tSalesforceOutput".equals(node.getComponent().getName())
            && "REJECT".equals(connector.getName())) {
          IMetadataTable clone = newOutputMetadata.clone(true);
          Iterator<IMetadataColumn> iterator = clone.getListColumns().iterator();
          while (iterator.hasNext()) {
            IMetadataColumn column = iterator.next();
            if (column.isCustom()) {
              iterator.remove();
            }
          }
          MetadataToolHelper.copyTable(clone, node.getMetadataFromConnector(connector.getName()));
        } else {
          // if there is some other schema dependant of this one, modify them
          MetadataToolHelper.copyTable(
              newOutputMetadata, node.getMetadataFromConnector(connector.getName()));
        }
      }
    }

    List<ColumnNameChanged> columnNameChanged =
        MetadataToolHelper.getColumnNameChanged(oldOutputMetadata, newOutputMetadata);
    ColumnListController.updateColumnList(node, columnNameChanged, true);

    if (inputNode != null) {
      List<ColumnNameChanged> inputColumnNameChangedExt =
          MetadataToolHelper.getColumnNameChangedExt(inputNode, oldInputMetadata, newInputMetadata);
      ColumnListController.updateColumnList(node, inputColumnNameChangedExt);
    }
    //
    List<ColumnNameChanged> outputColumnNameChangedExt =
        MetadataToolHelper.getColumnNameChangedExt(node, oldOutputMetadata, newOutputMetadata);
    syncOutputNodeColumnsList(outputColumnNameChangedExt);

    setXMLMAPPING();

    if (!internal) {
      updateColumnList(oldOutputMetadata, newOutputMetadata);
      ((Process) node.getProcess()).checkProcess();
    }
    refreshMetadataChanged();
  }