cancel
Showing results for 
Search instead for 
Did you mean: 

Valeur d'une association

hlander10
Champ in-the-making
Champ in-the-making
Bonjour,

J'ai un champs Sites et une association "Enfants" : déclarer ainsi dans mon modèle
<?xml version="1.0" encoding="UTF-8"?>


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

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

   <!– Optional meta-data about the model –>  
   <description>se 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 contrat.model should be changed to reflect your own
   namespace –>
  
   <namespaces>
               <namespace uri="se.model" prefix="se"/>
   </namespaces>

   <aspects>
           <!– Definition of new Content Aspect: Individu Details –>
      <aspect name="se:Details">
         <title>TITRE SE</title>
               <properties>
                  <property name="se:Sites">
                       <title>Sites</title>
                       <type>d:text</type>
                       <constraints>
                                 <constraint type="LIST">
                                    <parameter name="allowedValues">
                                        <list>
                                           <value>A</value>
                                           <value>B</value>
                                        </list>
                              </parameter>
                          </constraint>
                    </constraints>      
                  </property>                              
         </properties>
         <associations>
         <association name="se:Enfants">
             <source>
                <role>cm:referencedBy</role>
                     <mandatory>false</mandatory>
                     <many>true</many>
                </source>
                <target>
               <class>cm:content</class>
               <role>se:Enfants</role>
               <mandatory>false</mandatory>
               <many>true</many>
            </target>
         </association>
      </associations>
    </aspect>
    </aspects>
</model>

Donc lorsque j'ajoute un document, j'ai bien enfant avec les trois zones :
1. Rechercher et sélectionner des éléments.
2.Choisir et ajoutés
3.Eléments sélectionnés

J'ai ensuite un script js, qui doit travailler en fonction des valeurs des champs.
Pour récupérer les valeurs de site je fais
var listeSites = document.properties["se:Sites"];

Mais comment faire pour récupérer les valeurs Enfants, j'ai fais
var listeEnfants = document.properties["se:Enfants"];

Mais listeEnfants  est toujours null
12 REPLIES 12

rivarola
Champ on-the-rise
Champ on-the-rise
Maintenant que se:Enfants est une child-association et plus une association, ce n'est plus la méthode createAssociation qu'il faut utiliser…

dgenard
Champ on-the-rise
Champ on-the-rise
Bonjour,
l'API javascript permet de copier un document et tous ses enfants en une seule opération (deep copy en anglais).
Voir la méthode copy(ScriptNode destination, boolean deepCopy)
détaillée sur http://wiki.alfresco.com/wiki/3.1_JavaScript_API#Modifying_and_Creating_API

Denis

hlander10
Champ in-the-making
Champ in-the-making
merci pour ces informations … je n'ai toujours pas trouvé la méthode pour copier une child-association
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.