Class Notifications

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Class Notifications

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:57 pm

by Anonymous >> Fri, 10 Mar 2006 4:03:29 GMT

Can anyone tell me why if I register for calls notification on a class that has an Integer Array as a data member and I update an element in that array a notification is not raised?

Ive gotten around it by setting a boolean flag on the class and the notification is raised.

But should not a notification be raised if I change an element in the array?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Class Notifications

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:57 pm

by Brendan Doolan >> Fri, 10 Mar 2006 9:17:20 GMT

I think this is because the class has a *reference* to an IntegerArray rather than the IntegerArray is *embedded* in the object in the way a Boolean property would be. When you change the IntegerArray by adding an element to it, the parent object is not changed so you won't receive a notification.

I haven't tried it but perhaps you could subclass IntegerArray and put a Class notification on this subclass. The type of your "problem property" of type IntegerArray can then be replaced by the subclass type and, if that is the only place you use the type, you ought to pick up changes to these IntegerArrays only.

Brendan

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Class Notifications

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:57 pm

by Murray Symon >> Sat, 11 Mar 2006 2:45:45 GMT

A further point to note is that you can define an IntegerArray as
either a reference or an attribute. There are pro's & cons to each.

1. If the IntegerArray is defined as an attribute it is embedded
within the owner class and is automatically created & initialised.
In this case you cannot share a reference to it as it is treated
as part of the owner object.

2. If the IntegerArray is created as a reference it is, as Brendan described, just a reference to an "external" IntegerArray object
which must be explicitly created and destroyed.
In this case the reference can be shared and used by other objects.

I don't know how you have defined the IntegerArray (some developers
don't even realise the difference), but if it is as a reference (#2)
then you could try re-defining it as an attribute. As an attribute
it is treated more as an integral part of the owner object, so the changes may be more likely to trigger a notification. Sorry, but I'm
not in a position to try a test case until next week, after the long weekend.

--
HTH
Murray Symon.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Class Notifications

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:57 pm

by Anonymous >> Mon, 13 Mar 2006 0:56:23 GMT

Hi,

The integer array is an attribute.
Doesnt make a difference with either.

Troy

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Class Notifications

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:57 pm

by Patwos >> Mon, 13 Mar 2006 21:46:06 GMT

If you want your system to scale well for large numbers of concurrent users, you're better off using targetted User Notifications rather than System Notifications. For example, if you're creating a large number of new "Widgets", a single User Notification could be generated at the end of the transaction agent that creates these Widgets rather than potentially several hundred System Notifications for the creation of each Widget.

In the case of adding/updating entries into your Integer Array, you could generate whatever User Notification is appropriate for your requirements.

Hope that helps,
Pat.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Class Notifications

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:57 pm

by allistar >> Sun, 12 Mar 2006 8:24:32 GMT

An IntegerArray is (depending on how you have defined it - exclusive or not) a separate object, and so a notification won't be fired for the parent object in this case.

Allistar.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Class Notifications

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:58 pm

by Anonymous >> Sun, 12 Mar 2006 23:33:19 GMT

I don't believe a notification is currently raised in this case. There is an existing Jade NFS requesting a notification event when collection members are added, removed, or keys are changed. I suppose changing a primitive array member is a related situation.

Cheers,
Robert


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 49 guests