Program: 118334
Project: 118334
Buggy source:
@Override public void execute(){
  IElementParameter currentParam=elem.getElementParameter(propName);
  changeMetadataCommands.clear();
  oldElementValues.clear();
  if (currentParam == null) {
    return;
  }
  if (currentParam.isRepositoryValueUsed()) {
    if (currentParam.getFieldType() == EParameterFieldType.MEMO_SQL) {
      Object queryStoreValue=elem.getPropertyValue(EParameterName.QUERYSTORE_TYPE.getName());
      if (!EmfComponent.BUILTIN.equals(queryStoreValue) || !EmfComponent.TNS_FILE.equals(queryStoreValue)) {
        elem.setPropertyValue(EParameterName.QUERYSTORE_TYPE.getName(),EmfComponent.BUILTIN);
      }
      currentParam.setRepositoryValueUsed(false);
    }
 else {
      toUpdate=true;
      Object value=elem.getPropertyValue(propName);
      if (value == null || (!value.toString().endsWith("String_Node_Str") && !value.toString().endsWith("String_Node_Str"))) {
        elem.setPropertyValue(propertyTypeName,EmfComponent.BUILTIN);
      }
      for (      IElementParameter param : elem.getElementParameters()) {
        if (param.getRepositoryProperty() == null || param.getRepositoryProperty().equals(currentParam.getName())) {
          param.setRepositoryValueUsed(false);
        }
      }
    }
    repositoryValueWasUsed=true;
  }
 else {
    repositoryValueWasUsed=false;
  }
  oldValue=elem.getPropertyValue(propName);
  elem.setPropertyValue(propName,newValue);
  IElementParameter propertyTypeParam=elem.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
  IElementParameter repositoryTypeParam=elem.getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
  if (("String_Node_Str").equals(propName) && elem instanceof Node && propertyTypeParam != null && "String_Node_Str".equals(propertyTypeParam.getValue()) && repositoryTypeParam != null && !("String_Node_Str").equals(repositoryTypeParam.getValue())) {
    Node node=(Node)elem;
    for (    IElementParameter param : node.getElementParameters()) {
      String repositoryValue=param.getRepositoryValue();
      if ((repositoryValue != null) && (!param.getName().equals(EParameterName.PROPERTY_TYPE.getName())) && param.getFieldType() != EParameterFieldType.MEMO_SQL && !("String_Node_Str".equals(node.getComponent().getName()) && "String_Node_Str".equals(param.getRepositoryValue())) && !("String_Node_Str".equals(node.getComponent().getName()) && param.getName().equals(UpdatesConstants.MAPPING)) && !("String_Node_Str".equals(node.getComponent().getName()) && "String_Node_Str".equals(repositoryValue))) {
        param.setRepositoryValueUsed(true);
        if (!(EParameterName.DB_VERSION.getName()).equals(param.getName())) {
          param.setReadOnly(true);
        }
      }
    }
  }
  if (propName.contains(EParameterName.USE_DYNAMIC_JOB.getName()) && newValue.equals(false)) {
    IElementParameter processParam=elem.getElementParameter(EParameterName.PROCESS.getName());
    IElementParameter processTypeParameter=elem.getElementParameter(EParameterName.PROCESS_TYPE_PROCESS.getName());
    final String parentName=processParam.getName() + "String_Node_Str";
    elem.setPropertyValue(parentName + processTypeParameter.getName(),"String_Node_Str");
    elem.setPropertyValue(processParam.getName(),"String_Node_Str");
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
    boolean isSelectUseDynamic=false;
    IElementParameter useDynamicJobParameter=elem.getElementParameter(EParameterName.USE_DYNAMIC_JOB.getName());
    if (useDynamicJobParameter != null && useDynamicJobParameter instanceof IElementParameter) {
      Object useDynamicJobValue=useDynamicJobParameter.getValue();
      if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
        isSelectUseDynamic=(Boolean)useDynamicJobValue;
      }
    }
    if (isSelectUseDynamic) {
      StringBuffer labels=new StringBuffer("String_Node_Str");
      if (newValue != null) {
        String[] strValues=newValue.toString().split("String_Node_Str");
        for (int i=0; i < strValues.length; i++) {
          String strValue=strValues[i];
          ProcessItem processItem=ItemCacheManager.getProcessItem(strValue);
          if (processItem != null) {
            String label=processItem.getProperty().getLabel();
            if (i > 0) {
              labels.append("String_Node_Str");
            }
            labels.append(label);
          }
        }
      }
      currentParam.getParentParameter().setValue(labels.toString());
    }
 else {
      ProcessItem processItem=ItemCacheManager.getProcessItem((String)newValue);
      if (processItem != null) {
        currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
      }
    }
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_VERSION.getName())) {
    boolean isJobletComponent=false;
    IJobletProviderService service=null;
    if (PluginChecker.isJobLetPluginLoaded()) {
      service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    }
    if (elem instanceof Node) {
      if (service != null) {
        isJobletComponent=service.isJobletComponent((Node)elem);
      }
    }
    if (isJobletComponent) {
      String id=service.getJobletComponentItem((Node)elem).getId();
      String version=(String)newValue;
      IComponent newComponent=service.setPropertyForJobletComponent(id,version);
      reloadNode((Node)elem,newComponent);
    }
 else {
      IElementParameter processIdParam=currentParam.getParentParameter().getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
      ProcessItem processItem=ItemCacheManager.getProcessItem((String)processIdParam.getValue(),(String)newValue);
      if (processItem != null) {
        currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
      }
    }
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_CONTEXT.getName())) {
    if (elem instanceof Node) {
      Node node=(Node)elem;
      List<IContext> listContext=node.getProcess().getContextManager().getListContext();
      List<String> values=new ArrayList<String>();
      for (      IContext context : listContext) {
        values.add(context.getName());
      }
      currentParam.setListItemsDisplayName(values.toArray(new String[0]));
      currentParam.setListItemsValue(values.toArray(new String[0]));
      currentParam.setValue(newValue);
    }
  }
  if (propName.equals(EParameterName.VALIDATION_RULES.getName())) {
    if (elem instanceof INode) {
      ValidationRulesUtil.createRejectConnector((INode)elem);
      ValidationRulesUtil.updateRejectMetatable((INode)elem,null);
      if (newValue != null && (!(Boolean)newValue)) {
        ValidationRulesUtil.removeRejectConnector((INode)elem);
        ValidationRulesUtil.removeRejectConnection((INode)elem);
      }
    }
  }
  String dbType="String_Node_Str";
  if (newValue instanceof String) {
    dbType=(String)newValue;
  }
  IElementParameter schemaParameter=null;
  if (propName.equals(EParameterName.DB_TYPE.getName())) {
    IElementParameter elementParameter=elem.getElementParameter(EParameterName.DB_VERSION.getName());
    schemaParameter=elem.getElementParameter(EParameterName.SCHEMA_DB.getName());
    JobSettingVersionUtil.setDbVersion(elementParameter,dbType,true);
    DesignerUtilities.setSchemaDB(schemaParameter,newValue);
  }
 else   if (propName.equals(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName()))) {
    IElementParameter elementParameter=elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName()));
    schemaParameter=elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
    JobSettingVersionUtil.setDbVersion(elementParameter,dbType,true);
    DesignerUtilities.setSchemaDB(schemaParameter,newValue);
  }
  if (schemaParameter != null && !schemaParameter.isShow(elem.getElementParameters()) && !schemaParameter.getValue().equals("String_Node_Str")) {
    schemaParameter.setValue("String_Node_Str");
  }
  if (!toUpdate && (currentParam.getFieldType().equals(EParameterFieldType.RADIO) || currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST) || currentParam.getFieldType().equals(EParameterFieldType.OPENED_LIST)|| currentParam.getFieldType().equals(EParameterFieldType.CHECK)|| currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK)|| currentParam.getFieldType().equals(EParameterFieldType.COMPONENT_LIST))) {
    toUpdate=false;
    setDefaultValues(currentParam,elem);
  }
  if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
    toUpdate=true;
  }
  if (toUpdate) {
    elem.setPropertyValue(updataComponentParamName,Boolean.TRUE);
  }
  if (getNewValue() instanceof String && elem instanceof INode) {
    INode curNode=(INode)elem;
    String uniqueName=curNode.getUniqueName();
    IProcess process=curNode.getProcess();
    if (process != null && process instanceof IProcess2) {
      IProcess2 process2=(IProcess2)process;
      List<? extends INode> generatingNodes=null;
      if (process2.isProcessModified()) {
        process2.setProcessModified(false);
        generatingNodes=process2.getGeneratingNodes();
        if (generatingNodes != null) {
          for (          INode genNode : new ArrayList<INode>(generatingNodes)) {
            if (genNode.getUniqueName().equals(uniqueName)) {
              IElementParameter genParam=genNode.getElementParameter(propName);
              if (genParam != null) {
                genParam.setValue(newValue);
                break;
              }
            }
          }
        }
        process2.setProcessModified(true);
        codeViewUpdater.startIfExecutable(elem);
      }
    }
  }
  updateRelativeNodesIfNeeded(currentParam);
  checkProcess.startIfExecutable(elem);
  if (needUpdateMonitorConnection()) {
    ((Connection)elem).setMonitorConnection((Boolean)currentParam.getValue());
  }
  refreshMR(propName);
}

Fixed version (ground truth):
@Override public void execute(){
  IElementParameter currentParam=elem.getElementParameter(propName);
  changeMetadataCommands.clear();
  oldElementValues.clear();
  if (currentParam == null) {
    return;
  }
  if (currentParam.isRepositoryValueUsed()) {
    if (currentParam.getFieldType() == EParameterFieldType.MEMO_SQL) {
      Object queryStoreValue=elem.getPropertyValue(EParameterName.QUERYSTORE_TYPE.getName());
      if (!EmfComponent.BUILTIN.equals(queryStoreValue) || !EmfComponent.TNS_FILE.equals(queryStoreValue)) {
        elem.setPropertyValue(EParameterName.QUERYSTORE_TYPE.getName(),EmfComponent.BUILTIN);
      }
      currentParam.setRepositoryValueUsed(false);
    }
 else {
      toUpdate=true;
      Object value=elem.getPropertyValue(propName);
      if (value == null || (!value.toString().endsWith("String_Node_Str") && !value.toString().endsWith("String_Node_Str"))) {
        elem.setPropertyValue(propertyTypeName,EmfComponent.BUILTIN);
      }
      for (      IElementParameter param : elem.getElementParameters()) {
        if (param.getRepositoryProperty() == null || param.getRepositoryProperty().equals(currentParam.getName())) {
          param.setRepositoryValueUsed(false);
        }
      }
    }
    repositoryValueWasUsed=true;
  }
 else {
    repositoryValueWasUsed=false;
  }
  oldValue=elem.getPropertyValue(propName);
  elem.setPropertyValue(propName,newValue);
  if ("String_Node_Str".equals(propName) || "String_Node_Str".equals(propName)) {
    String oldELTValue="String_Node_Str";
    String newELTValue="String_Node_Str";
    String oldParamValue=TalendQuoteUtils.removeQuotes((String)oldValue);
    String newParamValue=TalendQuoteUtils.removeQuotes((String)newValue);
    if ("String_Node_Str".equals(propName)) {
      String schemaName=TalendQuoteUtils.removeQuotes((String)elem.getPropertyValue("String_Node_Str"));
      if (schemaName == null || "String_Node_Str".equals(schemaName.trim())) {
        oldELTValue=oldParamValue;
        newELTValue=newParamValue;
      }
 else {
        oldELTValue=schemaName + "String_Node_Str" + oldParamValue;
        newELTValue=schemaName + "String_Node_Str" + newParamValue;
      }
    }
 else {
      String tableName=TalendQuoteUtils.removeQuotes((String)elem.getPropertyValue("String_Node_Str"));
      if (oldParamValue != null && !"String_Node_Str".equals(oldParamValue.trim())) {
        oldELTValue=oldParamValue + "String_Node_Str";
      }
      if (newParamValue != null && !"String_Node_Str".equals(newParamValue.trim())) {
        newELTValue=newParamValue + "String_Node_Str";
      }
      oldELTValue=oldELTValue + tableName;
      newELTValue=newELTValue + tableName;
    }
    List<? extends IConnection> connections=((Node)elem).getOutgoingConnections();
    for (    IConnection connection : connections) {
      INode targetNode=connection.getTarget();
      String componentName=targetNode.getComponent().getName();
      if (componentName.matches("String_Node_Str")) {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IDbMapDesignerService.class)) {
          IDbMapDesignerService service=(IDbMapDesignerService)GlobalServiceRegister.getDefault().getService(IDbMapDesignerService.class);
          updateELTMapComponentCommand=service.getUpdateELTMapComponentCommand(targetNode,connection,oldELTValue,newELTValue);
          updateELTMapComponentCommand.execute();
        }
      }
    }
  }
  IElementParameter propertyTypeParam=elem.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
  IElementParameter repositoryTypeParam=elem.getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
  if (("String_Node_Str").equals(propName) && elem instanceof Node && propertyTypeParam != null && "String_Node_Str".equals(propertyTypeParam.getValue()) && repositoryTypeParam != null && !("String_Node_Str").equals(repositoryTypeParam.getValue())) {
    Node node=(Node)elem;
    for (    IElementParameter param : node.getElementParameters()) {
      String repositoryValue=param.getRepositoryValue();
      if ((repositoryValue != null) && (!param.getName().equals(EParameterName.PROPERTY_TYPE.getName())) && param.getFieldType() != EParameterFieldType.MEMO_SQL && !("String_Node_Str".equals(node.getComponent().getName()) && "String_Node_Str".equals(param.getRepositoryValue())) && !("String_Node_Str".equals(node.getComponent().getName()) && param.getName().equals(UpdatesConstants.MAPPING)) && !("String_Node_Str".equals(node.getComponent().getName()) && "String_Node_Str".equals(repositoryValue))) {
        param.setRepositoryValueUsed(true);
        if (!(EParameterName.DB_VERSION.getName()).equals(param.getName())) {
          param.setReadOnly(true);
        }
      }
    }
  }
  if (propName.contains(EParameterName.USE_DYNAMIC_JOB.getName()) && newValue.equals(false)) {
    IElementParameter processParam=elem.getElementParameter(EParameterName.PROCESS.getName());
    IElementParameter processTypeParameter=elem.getElementParameter(EParameterName.PROCESS_TYPE_PROCESS.getName());
    final String parentName=processParam.getName() + "String_Node_Str";
    elem.setPropertyValue(parentName + processTypeParameter.getName(),"String_Node_Str");
    elem.setPropertyValue(processParam.getName(),"String_Node_Str");
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
    boolean isSelectUseDynamic=false;
    IElementParameter useDynamicJobParameter=elem.getElementParameter(EParameterName.USE_DYNAMIC_JOB.getName());
    if (useDynamicJobParameter != null && useDynamicJobParameter instanceof IElementParameter) {
      Object useDynamicJobValue=useDynamicJobParameter.getValue();
      if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
        isSelectUseDynamic=(Boolean)useDynamicJobValue;
      }
    }
    if (isSelectUseDynamic) {
      StringBuffer labels=new StringBuffer("String_Node_Str");
      if (newValue != null) {
        String[] strValues=newValue.toString().split("String_Node_Str");
        for (int i=0; i < strValues.length; i++) {
          String strValue=strValues[i];
          ProcessItem processItem=ItemCacheManager.getProcessItem(strValue);
          if (processItem != null) {
            String label=processItem.getProperty().getLabel();
            if (i > 0) {
              labels.append("String_Node_Str");
            }
            labels.append(label);
          }
        }
      }
      currentParam.getParentParameter().setValue(labels.toString());
    }
 else {
      ProcessItem processItem=ItemCacheManager.getProcessItem((String)newValue);
      if (processItem != null) {
        currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
      }
    }
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_VERSION.getName())) {
    boolean isJobletComponent=false;
    IJobletProviderService service=null;
    if (PluginChecker.isJobLetPluginLoaded()) {
      service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    }
    if (elem instanceof Node) {
      if (service != null) {
        isJobletComponent=service.isJobletComponent((Node)elem);
      }
    }
    if (isJobletComponent) {
      String id=service.getJobletComponentItem((Node)elem).getId();
      String version=(String)newValue;
      IComponent newComponent=service.setPropertyForJobletComponent(id,version);
      reloadNode((Node)elem,newComponent);
    }
 else {
      IElementParameter processIdParam=currentParam.getParentParameter().getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
      ProcessItem processItem=ItemCacheManager.getProcessItem((String)processIdParam.getValue(),(String)newValue);
      if (processItem != null) {
        currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
      }
    }
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_CONTEXT.getName())) {
    if (elem instanceof Node) {
      Node node=(Node)elem;
      List<IContext> listContext=node.getProcess().getContextManager().getListContext();
      List<String> values=new ArrayList<String>();
      for (      IContext context : listContext) {
        values.add(context.getName());
      }
      currentParam.setListItemsDisplayName(values.toArray(new String[0]));
      currentParam.setListItemsValue(values.toArray(new String[0]));
      currentParam.setValue(newValue);
    }
  }
  if (propName.equals(EParameterName.VALIDATION_RULES.getName())) {
    if (elem instanceof INode) {
      ValidationRulesUtil.createRejectConnector((INode)elem);
      ValidationRulesUtil.updateRejectMetatable((INode)elem,null);
      if (newValue != null && (!(Boolean)newValue)) {
        ValidationRulesUtil.removeRejectConnector((INode)elem);
        ValidationRulesUtil.removeRejectConnection((INode)elem);
      }
    }
  }
  String dbType="String_Node_Str";
  if (newValue instanceof String) {
    dbType=(String)newValue;
  }
  IElementParameter schemaParameter=null;
  if (propName.equals(EParameterName.DB_TYPE.getName())) {
    IElementParameter elementParameter=elem.getElementParameter(EParameterName.DB_VERSION.getName());
    schemaParameter=elem.getElementParameter(EParameterName.SCHEMA_DB.getName());
    JobSettingVersionUtil.setDbVersion(elementParameter,dbType,true);
    DesignerUtilities.setSchemaDB(schemaParameter,newValue);
  }
 else   if (propName.equals(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName()))) {
    IElementParameter elementParameter=elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName()));
    schemaParameter=elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
    JobSettingVersionUtil.setDbVersion(elementParameter,dbType,true);
    DesignerUtilities.setSchemaDB(schemaParameter,newValue);
  }
  if (schemaParameter != null && !schemaParameter.isShow(elem.getElementParameters()) && !schemaParameter.getValue().equals("String_Node_Str")) {
    schemaParameter.setValue("String_Node_Str");
  }
  if (!toUpdate && (currentParam.getFieldType().equals(EParameterFieldType.RADIO) || currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST) || currentParam.getFieldType().equals(EParameterFieldType.OPENED_LIST)|| currentParam.getFieldType().equals(EParameterFieldType.CHECK)|| currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK)|| currentParam.getFieldType().equals(EParameterFieldType.COMPONENT_LIST))) {
    toUpdate=false;
    setDefaultValues(currentParam,elem);
  }
  if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
    toUpdate=true;
  }
  if (toUpdate) {
    elem.setPropertyValue(updataComponentParamName,Boolean.TRUE);
  }
  if (getNewValue() instanceof String && elem instanceof INode) {
    INode curNode=(INode)elem;
    String uniqueName=curNode.getUniqueName();
    IProcess process=curNode.getProcess();
    if (process != null && process instanceof IProcess2) {
      IProcess2 process2=(IProcess2)process;
      List<? extends INode> generatingNodes=null;
      if (process2.isProcessModified()) {
        process2.setProcessModified(false);
        generatingNodes=process2.getGeneratingNodes();
        if (generatingNodes != null) {
          for (          INode genNode : new ArrayList<INode>(generatingNodes)) {
            if (genNode.getUniqueName().equals(uniqueName)) {
              IElementParameter genParam=genNode.getElementParameter(propName);
              if (genParam != null) {
                genParam.setValue(newValue);
                break;
              }
            }
          }
        }
        process2.setProcessModified(true);
        codeViewUpdater.startIfExecutable(elem);
      }
    }
  }
  updateRelativeNodesIfNeeded(currentParam);
  checkProcess.startIfExecutable(elem);
  if (needUpdateMonitorConnection()) {
    ((Connection)elem).setMonitorConnection((Boolean)currentParam.getValue());
  }
  refreshMR(propName);
}