We've Moved!
Please note that we have moved to our New Forum site.
Eder Carneiro
Update Object Example
Well,
I'm new to the Genesys SDK. Anyway, I'm trying to modify or create some new 'option' in the config server. This is the sample that exists in the api docs:
ConfObjectDelta delta0 = new ConfObjectDelta(metadata, CfgObjectType.CFGApplication); ConfObject inDelta = (ConfObject) delta0.getOrCreatePropertyValue("deltaApplication"); inDelta.setPropertyValue("DBID", objCreated.getObjectDbid()); inDelta.setPropertyValue("name", "ConfObject-new-name"); ConfIntegerCollection delTenants = (ConfIntegerCollection) delta0.getOrCreatePropertyValue("deletedTenantDBIDs"); delTenants.add(105); RequestUpdateObject reqUpdate = RequestUpdateObject.create(); reqUpdate.setObjectDelta(delta0); Message resp = protocol.request(reqUpdate); if (resp == null) { // timeout } else if (resp instanceof EventObjectUpdated) { // the object has been updated } else if (resp instanceof EventError) { // fail((EventError) resp); } else { // unexpected server response }
Well, I cannot guess how it works, since there is no change in delta0. Changes are made in the ConfObject, but anyway the object used to request changes is the delta0. Can anyone explain how that works at all ?
I have a wrapper around the protocol and connection, where I defined this method:
Then from the client code (in this case a simple JUnit test):
Note that the getOrCreatePropertyValue method does not seem to work for KVList collections like "changedUserProperties", or "deletedUserProperties", it just returns null. So I had to create a new KeyValueCollection myself, set it as a property on the delta object with the expected attribute name - see https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgDeltaApplication
Cheers!
All Answers
I have a wrapper around the protocol and connection, where I defined this method:
Then from the client code (in this case a simple JUnit test):
Note that the getOrCreatePropertyValue method does not seem to work for KVList collections like "changedUserProperties", or "deletedUserProperties", it just returns null. So I had to create a new KeyValueCollection myself, set it as a property on the delta object with the expected attribute name - see https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgDeltaApplication
Cheers!