cancel
Showing results for 
Search instead for 
Did you mean: 

Lazy properties: is there an example?

hbf
Champ on-the-rise
Champ on-the-rise
Hi,

I would like to equip my content-type with a property whose value is dynamically computed ("lazy evaluation"). Is this technique being used somewhere in Alfresco? Could somebody point me to some file for an example?

My goal is to refer to the property from the JavaScript API via
mynode.properties["my:propname"]
and behind the scences my Java code is called and performs the lazy evaluation.

Thanks for any hint,
Kaspar
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
It's an interesting idea (although may have some performance impact depending on how much calculation you perform lazily). You may be able to use Node Policies for this. It is possible to fire arbitary java code when nodes are created, deleted and properties set etc.
http://wiki.alfresco.com/wiki/Services_Framework#Component_Policies
http://wiki.alfresco.com/wiki/Policy_Component

Thanks,

Kevin

kevinr
Star Contributor
Star Contributor
You may find this article on Alfresco Behaviours interesting - it sounds more appropriate to what you want to do:
http://ecmarchitect.com/archives/2007/09/26/770

Kevin

rdanner
Champ in-the-making
Champ in-the-making
You may find this article on Alfresco Behaviours interesting - it sounds more appropriate to what you want to do:
http://ecmarchitect.com/archives/2007/09/26/770

Kevin

Calculated properties could have some interesting applications.  For example content ranking based on weighted values of other properties etc.

I've never really liked calculated fields in databases though they are neat but they are slow in large sets our when the calculation gets too complex.