cancel
Showing results for 
Search instead for 
Did you mean: 

List of Countries

john84
Champ in-the-making
Champ in-the-making
Hello,
I am designing my first Content model within an alfresco installation. Now I've an Aspect which should contain a property called Country. Is there a possibilty to do this like:

<property name="sia:Country">
  <type>d:country</type>
  <mandatory>true</mandatory>
</property>   

<!– INSTEAD OF –>
<property name="sia:Country">
  <type>d:text</type>
  <mandatory>true</mandatory>
</property>   

If not, I need to create a own type like "my:country" and then to do as follows:

<property name="sia:Country">
  <type>my:country</type>
  <mandatory>true</mandatory>
</property>   

Correct? But need I really to create a file for any country I want to show in the list, or is there I understood wrong  Smiley Surprisedops: ? How I manage these entities in the best manner on alfresco :?: ?

Thanks in advance
Johannes
3 REPLIES 3

jpotts
World-Class Innovator
World-Class Innovator
My guess is that you need to use a list constraint. A list constraint defines the allowable values for a property. So you'd have something like:

<constraints>
    <constraint name="sia:countryList" type="LIST">
        <parameter name="allowedValues">
            <list>
                    <value>China</value>
                     <value>Spain</value>
                     <value>Turkey</value>
                     …SNIP…
            </list>
        </parameter>
    </constraint>
</constraints>

<aspects>
    <aspect>
    …SNIP…
       <property name="sia:country">
            <type>d:text</type>
            <constraints>
                  <constraint ref="sia:countryList" />
            </constraints>
       </property>
    </aspect>
</aspects>

Obviously, the downside of managing this list in the model is that it is tough to change. If you want your constraint to be dynamic, either based on a Lucene query or a SQL query or a service or whatever, you should check out Jean Barmash's example on dynamic dropdowns: http://blogs.alfresco.com/wp/jbarmash/2008/08/08/dynamic-data-driven-drop-downs-for-list-properties/

Jeff

cheffilet
Champ in-the-making
Champ in-the-making
Whats about multingual-support? Is there any solution to retrieve a "translated" list-value from a constraint (e.g. via properties-file)?

jpotts
World-Class Innovator
World-Class Innovator
I'm not sure how to do that. This post is wondering the same thing: http://forums.alfresco.com/en/viewtopic.php?f=4&p=64661