Runtime tools : Core components : Contexts : Tasks : Working with contexts : Resetting context keyed collections
  
Resetting context keyed collections
To reset a context keyed collection so that part or all of the keyed collection re-initializes with values from external definition files, invoke the clearKeyedCollection method in the Context class. This method resets the current context's keyed collection based on the following rules:
If the dsedata.xml file contains the definition for the context keyed collection, the method uses the DataElement.readObject method to reinitialize the keyed collection.
If the dsetype.xml file contains the definition for the context keyed collection defined as a Type, the method uses the DSEType externalizer to re-initialize the type.
If neither the dsedata.xml file nor the dsetypes.xml file contains the definition and any of the two parameters or both are set to false, the method throws an IOException. Otherwise, the method does the following depending on the values of the parameters:
How clearKeyedCollection re-initializes the context keyed collection
keepKCollStatus = true
clearOnlyValues = true
Re-initializes only the values of the data elements inside the keyed collection. The method does not affect the data element attributes. If the keyed collection has dynamically added elements, this re-initialization does not change them in any way.
If the method does not find an external definition for the keyed collection, the method considers all the data elements as dynamic data elements and does not change them in any way. The method also retains the keyed collection attributes.
keepKCollStatus = true
clearOnlyValues = false
Re-initializes the attributes and values of the data elements in the keyed collection. The method does not re-initialize keyed collection attributes such as ErrorInfo, State, and Parameters. If the keyed collection has dynamically added elements, this re-initialization removes them.
If the method does not find an external definition for the keyed collection, it throws an IOException.
keepKCollStatus = false
clearOnlyValues = true
Re-initializes the attributes of the keyed collection and the data element values without changing the rest of the data element attributes. If the keyed collection has dynamically added elements, this re-initialization does not change them in any way.
If the method does not find an external definition for the keyed collection, it throws an IOException.
keepKCollStatus = false
clearOnlyValues = false
Re-initializes the context without preserving attributes and values. If the keyed collection has dynamically added elements, this re-initialization removes them.
If the method does not find an external definition for the keyed collection, it throws an IOException.
Go up to
Working with contexts