2

Could you please let me know what is the use of ChangeAwareList and ChangeAwareMap in atg? What problem does it try to solve. I tried reading the documentation but could not find any details regarding the same.

Hari
  • 237
  • 1
  • 10
  • 23

1 Answers1

2

ChangeAwareList and ChangeAwareMap ensure when the parent RepositoryItem has relationships added or removed, when the parent item is updated, that the new relationship are insert/deleted from the database.

If ChangeAwareList and ChangeAwareMap were not used, then when the parent item were being updated/stored to the Repository/database, then you would have to have some logic to loop through each of the existing relationships and compare them to the updated relationships to determine which relationships need to be removed from the database. This is more cumbersome and does not perform as well as the implementation that is "change aware".

This is an example of the Observer design pattern.

Matt Sidesinger
  • 2,124
  • 1
  • 22
  • 18
  • Thanks for the reply, so just confirm so the ChangeAwareSet, ChangeAwareMap is just to keep track of the changes. I have been seeing some examples where for reading from repository we are using ChangeAware collections, so just wondering why it should be used for reading. Also in some cases we were getting class cast exception when try to change to normal set and Map. – Hari Jul 15 '15 at 04:13