cancel
Showing results for 
Search instead for 
Did you mean: 

Constraints are Getting Set During Server Start

anujs86
Champ in-the-making
Champ in-the-making
Hi,

Do any one know when does alfresco sets up constraints values ?
I think its at server start.

What if I want to add dynamic constraint fetching values from database?
If I have many drop down constraints in my application, it will take lot of time for server start.

Do any one knows solution to it?
7 REPLIES 7

mitpatoliya
Star Collaborator
Star Collaborator
Hi Anuj,

You can use custom constrain in that case.
Where you need to create a javaclass which will populate the drop down from the db.
https://forums.alfresco.com/en/viewtopic.php?f=4&t=11687

anujs86
Champ in-the-making
Champ in-the-making
Hi Anuj,

You can use custom constrain in that case.
Where you need to create a javaclass which will populate the drop down from the db.
https://forums.alfresco.com/en/viewtopic.php?f=4&t=11687

I went through it Mit.
Its generating its own component for drop downs.
Can't I use existing component and get the results?
I have more than one drop down and according to content type I need to get values.
I am getting handle in getAllowedValues() which gets called during run time but what I am not getting is for which property its getting called.

mitpatoliya
Star Collaborator
Star Collaborator
the property with which you have associated your custom constrain.

anujs86
Champ in-the-making
Champ in-the-making
Yes. But I have 4 properties defined in custom constraint class. So how come I know for which property getAllowedValues() get called?
According to property I need to fetch data from db.

mitpatoliya
Star Collaborator
Star Collaborator
then you require for different constrains classes and associated each of them sepratly.
I mean its quite logical any custom constrain will give certain set of values only.
So, better create 4 diff constrains.

anujs86
Champ in-the-making
Champ in-the-making
Thanks Mit.
Actually I did not want to do that, but now probably have to go that way only Smiley Happy

mitpatoliya
Star Collaborator
Star Collaborator
that is also the best practice.  😎