Configuration Keys - enabled by default

The scenario for this issue was that a layer is deployed to a customer with a whole bunch of objects in, but the customer only actually wants a few of those objects. They've all been set up with different configuration keys so the thing to do is just set only the ones that are needed.

Now the problem starts, the layer contains lots of different config keys and the customer only wants a selection, when you import the layer, all the keys are enabled by default! configuration keys are always enabled by default, actually when you export a configuration it only takes note of the keys that are disabled. Due to this logic it's not possible to easily customise the system to stop the new keys being enabled.

So instead I knocked up some code to disable config keys by layer:

void clicked()
{

DictConfigurationKey dictConfigurationKey;
configurationKeyId configurationKeyId;
int i;
Dictionary dictionary = new Dictionary();
;

if (Box::yesNo("@SYS60031",DialogButton::No,"@SYS26854") == DialogButton::Yes)
{
set = new ConfigurationKeySet();
set.loadSystemSetup();
ttsbegin;
for (i=dictionary.configurationKeyCnt(); i; i--)
{
configurationKeyId = dictionary.configurationKeyCnt2Id(i);
dictConfigurationKey = new DictConfigurationKey(configurationKeyId);
//Check config key is licensed.
if (dictConfigurationKey.enabled())
{
//set the id range appropriately here to disable keys from a certain layer
If (dictConfigurationKey.id() > 50000 && dictConfigurationKey.id() < 60000)
{
set.enabled(dictConfigurationKey.id(), false);
}
}
}
SysDictConfigurationKey::save(set.pack());
ttscommit;

element.drawTree();
}
super();

}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.