GENERIC!!! HELPER FUNCION FOR REPLACEMENT

update the var: DYNAMIC REPLACEMENT of VAR.

Every task must have matching command data and task result

@param task
the task
@param replaceVarKey
the replace var key
@param replaceVarValue
the replace var value
346108
public void updateRequestByAddingReplaceVarPair(
            ParallelTask task, String replaceVarKey, String replaceVarValue) {

        Map<String, NodeReqResponse> taskResult = task.getParallelTaskResult();

        for (Entry<String, NodeReqResponse> entry : taskResult.entrySet()) {
            NodeReqResponse nodeReqResponse = entry.getValue();

            nodeReqResponse.getRequestParameters()
                    .put(PcConstants.NODE_REQUEST_PREFIX_REPLACE_VAR
                            + replaceVarKey, replaceVarValue);
            nodeReqResponse.getRequestParameters().put(
                    PcConstants.NODE_REQUEST_WILL_EXECUTE,
                    Boolean.toString(true));

        }// end for loop

    }
913018
public static void setVarargsElement(JCTree tree, Type varargsElement) {
        switch (tree.getTag()) {
            case APPLY:
                ((JCMethodInvocation)tree).varargsElement = varargsElement;
                break;
            case NEWCLASS:
                ((JCNewClass)tree).varargsElement = varargsElement;
                break;
            case REFERENCE:
                ((JCMemberReference)tree).varargsElement = varargsElement;
                break;
            default:
                throw new AssertionError("Unexpected tree: " + tree);
        }
    }
786321
public void addVar(String varName)
	{
		VarDescrption varDesc = new VarDescrption();
		varDesc.setVarName(varName);
		this.current.getVars().put(varName, varDesc);
	}
509609
private synchronized void runTask(Task task) {
        if (taskThread == null) {
            taskThread = new TaskThread();
        }
        taskThread.runTask(task);
    }
596780
function replace(searchValue, replaceValue) {
        var O = requireObjectCoercible(this);
        var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
        return replacer !== undefined
          ? replacer.call(searchValue, O, replaceValue)
          : nativeReplace.call(String(O), searchValue, replaceValue);
      }
9324
function replace(searchValue, replaceValue) {
      var O = defined(this);
      var fn = searchValue == undefined ? undefined : searchValue[REPLACE];
      return fn !== undefined
        ? fn.call(searchValue, O, replaceValue)
        : $replace.call(String(O), searchValue, replaceValue);
    }
479885
void updateReplace() {

        boolean replace = m_replace.getValue().booleanValue();

        m_replaceResource.setVisible(replace ? SearchType.resourcetype.equals(m_searchType.getValue()) : replace);
        m_replacePattern.setVisible(
            replace
            ? !SearchType.resourcetype.equals(m_searchType.getValue())
                & !SearchType.renameContainer.equals(m_searchType.getValue())
            : replace);

        m_newName.setVisible(replace ? SearchType.renameContainer.equals(m_searchType.getValue()) : replace);
        m_oldName.setVisible(replace ? SearchType.renameContainer.equals(m_searchType.getValue()) : replace);

        m_workProject.setVisible(replace);

        m_search.setCaption(
            replace
            ? CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_REPLACE_0)
            : CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SEARCH_0));

    }
507492
private String replaceVars(final String langValue) {
        String ret = StringUtils.replace(langValue, "${servePath}", Latkes.getServePath());
        ret = StringUtils.replace(ret, "${staticServePath}", Latkes.getStaticServePath());

        return ret;
    }
852263
def resolve_variables(self, task):
        

        variables = {**task.variables, **self.project.variables}

        values = {}

        for variable in variables.values():
            value = self.variables.get(variable.name) or variable.default
            if value is None:
                raise LookupError(variable)
            values[variable.name] = value

        return values
67212
@Override
	protected void putVariables(Map<String, String> variables) {
		variables.put(ScopeFormat.SCOPE_OPERATOR_ID, String.valueOf(operatorID));
		variables.put(ScopeFormat.SCOPE_OPERATOR_NAME, operatorName);
		// we don't enter the subtask_index as the task group does that already
	}
418064
public void register(Task task) {
        Optional.ofNullable(task)
                .filter(t -> t.getTask() != null)
                .filter(t -> StringUtils.hasText(t.getName()))
                .ifPresent(t -> checkTaskMap.put(t.getName(), t));
    }
77986
public void updateText(int taskId, String text) {
		getResourceFactory().getApiResource("/task/" + taskId + "/text")
				.entity(new TaskText(text), MediaType.APPLICATION_JSON_TYPE)
				.put();
	}
1138081
public synchronized void updateVariableCache(Map<String, Object> variables) {
        boolean dirty = false;
        for (Map.Entry<String, Object> entry : variables.entrySet()) {
            String variableName = entry.getKey();
            // skip any variables defined in server.xml
            if (configVariables.containsKey(variableName)) {
                continue;
            }
            Object variableValue = entry.getValue();
            if (!isVariableCached(variableName, variableValue)) {
                variableCache.put(variableName, variableValue);
                dirty = true;
            }
        }
        if (dirty) {
            saveVariableCache();
        }
    }
399175
public void addTaskProperties(Task task)
    {
    	if (task == null)
    		return;
        this.put(TrxMessageHeader.USER_ID, task.getProperty(DBParams.USER_ID));
//?         BaseDatabase.addDBProperties(m_mapMessageHeader, task, null);	// Note: m_mapMessageHeader is guaranteed not null by previous call.
    }
1066851
function replaceVariables( value ) {

            return value.replace( options.variableRegex, function( match, key ) {

                if ( options.variables[ key ] === undefined ) {
                    grunt.log.warn( "No variable definition found for: " + key );
                    return "";
                }

                return options.variables[ key ];
            } );

        }
487457
public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) {
        try {
            return execute(listener, task.getServerIdentity(), task.getOperation());
        } catch (OperationFailedException e) {
            // Handle failures operation transformation failures
            final ServerIdentity identity = task.getServerIdentity();
            final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT);
            final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);
            listener.operationPrepared(result);
            recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT));
            return 1; // 1 ms timeout since there is no reason to wait for the locally stored result
        }

    }
260910
public int changePassword(Task task, String strUserName, String strCurrentPassword, String strNewPassword)
    {
        int iErrorCode = Constants.NORMAL_RETURN;
        org.jbundle.thin.base.remote.RemoteTask remoteTask = (org.jbundle.thin.base.remote.RemoteTask)this.getRemoteTask(null, strUserName, false);
        Map<String,Object> properties = new HashMap<String,Object>();
        properties.put(Params.USER_NAME, strUserName);
        properties.put(Params.PASSWORD, strCurrentPassword);
        properties.put("newPassword", strNewPassword);
        try {
            Object objReturn = remoteTask.doRemoteAction(ThinMenuConstants.CHANGE_PASSWORD, properties);
            if (objReturn instanceof Integer)
                iErrorCode = ((Integer)objReturn).intValue();
        } catch (Exception ex) {
            return task.setLastError(ex.getMessage());
        }
        return iErrorCode;
    }