cancel
Showing results for 
Search instead for 
Did you mean: 

external values for list constraint

kbonnet
Champ in-the-making
Champ in-the-making
Hi all,

I'm pretty sure i have seen this somewhere, but i can't find it anymore. I am looking for the following:

I have the following constraint in my custom content model:


      <constraint name="gov:cdocumenttype" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>Aangifte</value>
               <value>Aanvraag</value>
               <value>Advies</value>
               <value>Agenda</value>
            </list>
         </parameter>
      </constraint>

What i want is that these kind of value lists are read from another XML-file. And i think i saw it somewhere, but, as said, i cant find it anymore and i cant find it on the wiki. How to include the list values from another XML file? Can anyone help?

Kind regards,

Koen Bonnet
3 REPLIES 3

raweck
Champ on-the-rise
Champ on-the-rise
I think that you should write your own component-generator. Copy /Web-Client/source/java/org/alfresco/web/bean/generator/TextFieldGenerator.java to your own class and modify getListOfValuesConstraint function.

gavinc
Champ in-the-making
Champ in-the-making
There is no out-of-the-box solution for getting the list of allowable values from anywhere else, you have to define it inline within the model definition. There is a new feature request for this, but there are no scheduled plans for it at this time: http://issues.alfresco.com/browse/AR-677

The suggestion given is OK, as long as don't have any other clients as those clients would not be restricted to the values you define in the web client code. Defining them in the model ensures all clients have to enter valid data.

alexr
Champ in-the-making
Champ in-the-making
Hi Koen,

I don't know if this is still an issue for you but you can configure it.
At least in release 2.2 it is possible to have the constraints used in your custom model(s) defined in a
separate .xml file. This is done through a custom-model-context.xml file (e.g. extension/custom-model-context.xml.sample).
Specific entry should look something like this (for example if you have a Contezza model):
——————————–
   <!– Registration of new models –>
   <bean id="extension.dictionaryBootstrap"
      parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
      <property name="models">
         <list>
             <value>alfresco/extension/contezza-constraints.xml</value>            
             <value>alfresco/extension/contezza-custom-model.xml</value>
         </list>
      </property>
   </bean>
——————————–

Regards,

Alex
Your ex-colleague from Amstelveen  Smiley Very Happy

Hi all,

I'm pretty sure i have seen this somewhere, but i can't find it anymore. I am looking for the following:

I have the following constraint in my custom content model:


      <constraint name="gov:cdocumenttype" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>Aangifte</value>
               <value>Aanvraag</value>
               <value>Advies</value>
               <value>Agenda</value>
            </list>
         </parameter>
      </constraint>

What i want is that these kind of value lists are read from another XML-file. And i think i saw it somewhere, but, as said, i cant find it anymore and i cant find it on the wiki. How to include the list values from another XML file? Can anyone help?

Kind regards,

Koen Bonnet