cancel
Showing results for 
Search instead for 
Did you mean: 

Extend ListOfValuesConstraint and read values from txt file

uf766086
Champ in-the-making
Champ in-the-making
Hi all !!!

I'm trying to extend ListOfValuesConstraint to make some kind of dynamic list. The idea is to read the values from a txt file stored in the Data Dictionary space.

I have sucesfully created my own constraint, but don't know how to get an instance to NodeService so i could use a reader to get file content.

I have tried to get the spring context (so I can access to managed beans) using org.alfresco.util.ApplicationContextHelper but it generates an error on application start… It seems that constraints are created before Spring context is initialized…

Any idea?

Thx in advance
1 REPLY 1

uf766086
Champ in-the-making
Champ in-the-making
I think my problem is described here, but don't understand indications given:
You will need some support to give the constraint implementation access to the context. Create a bean that is ApplicationContextAware and use that to push the context (not a specific bean) onto a static member. You can then retrieve it statically from the constraint implementation at runtime.