cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a constraint from user list

juschroeg
Champ in-the-making
Champ in-the-making
Dear all,

I am working on a custom aspect for our project and an approproate render to show in the document library. I managed to adapt the custom table renders in the share-document-library-config.xml to view my properties there. As we would like to link a document to a contactperson, which mostly will not be the person uploading the file, I would like to create a property that features the name of a user. As mentioned above, it wont be the person uploading, so it would be perfect if this property could be chosen by the user editing the metadata, from the users list. That way the name would show and in case someone needs further details on the background of the document, one could easily click and contact the person responsible.
Does anyone have some thoughts on my idea or can point me the right direction?

Thanks in advance
2 REPLIES 2

juschroeg
Champ in-the-making
Champ in-the-making
I figured the way to go for my above described issue, is to create a <a href="http://wiki.alfresco.com/wiki/Constraints">constraint</a> in my custom model. But I am unsure about the right values to set and could not figure it out by trial and error. Can anyone send me the right path creating a constraint from the User list?

Thanks for your support

juschroeg
Champ in-the-making
Champ in-the-making
I checked the out-of-the-box content model and found the cm:userNameConstraint. As it says in <a href="http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html#constrain...">Jeff Potts Custom Content Model Tutorial</a>, it should be sufficient to refer to the given cm constraint, But so far I have not managed to get my own Aspect property to allow only values from the Usernamelist.


<?xml version="1.0" encoding="UTF-8"?>

<!– Custom Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

<model name="cu:referenceModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>  
   <description>Custom Model</description>
   <author></author>
   <version>1.0</version>

   <imports>
        <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="reference.model" prefix="cu"/>
   </namespaces>

<constraints>

<constraint name="cu:publishing_allowed" type="LIST">
<parameter name="allowedValues">
<list>
<value>Ja</value>
<value>Nein</value>
</list>
</parameter>
</constraint>

</constraints>

<types>
</types>

    <aspects>
<aspect name="cu:projectreference">
<title>Projektreferenz</title>

<properties>

<property name="cu:year">
<title>Jahr</title>
<type>d:text</type>
<protected>false</protected>
<mandatory>false</mandatory>
<multiple>false</multiple>
</property>

<property name="cu:contactperson">
<title>Ansprechpartner</title>
<type>d:text</type>
<constraints>
<constraint ref="cm:userNameConstraint" />
</constraints>
</property>

<property name="cu:publishable">
<title>Veröffentlichung erlaubt</title>
<type>d:text</type>
<constraints>
<constraint ref="cu:publishing_allowed"/>
</constraints>
</property>

</properties>

</aspect>
</aspects> 

</model>