How to change the value of global variable of a selected environment programmatically and keep the default value?
I tried to change the value of global variable like that:
public static void updateGlobalVariableValue(final String globalName,final String globalValue,final IEnvironment environment) throws Exception {
SecurityManagerFactory.getSecurityManager().executeAsSystem(new Callable<Void>() {
@Override
public Void call() throws Exception {
IGlobalVariable variable = environment.findGlobalVariable(globalName);
if (variable != null) {
variable.setValue(globalValue);
}
return null;
}
});
}
If in the selected environment, we didn't set the value of that variable, after execute my function, the default value of the global variable is changed.
Is it a bug of API or I did the wrong way?
Could you please show me the way to modify just the value of global variable in the selected environment and keep the default value?
Thank you very much,
Phu Nguyen