AnsweredAssumed Answered

Constaints on association? Override cm:contains association?

Question asked by jey on Jun 5, 2007
Latest reply on Jun 5, 2007 by jey
Hi,

Here is my problem:
I have define two sub-type of folder: client and project.
And I want a "client" space to contain ONLY "project" spaces…

Is it possible ? I really need this constraint, I want to prevent it containing anything else.

I am wondering if I can override the definition of the child-association cm:contains of a folder in my own type definition.

A folder is define like this:
<type name="cm:folder">
         <title>Folder</title>
         <parent>cm:cmobject</parent>
         <archive>true</archive>
         <associations>
            <child-association name="cm:contains">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>sys:base</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
               <duplicate>false</duplicate>
            </child-association>
         </associations>
      </type>

And I would like my "client" folder to contain "project" in stead of sys:base which is the parent cm:cmobject, which is the parent of folder, content, …

For example:
WARNING this is only what i EXPECT… this code doesn't work :D
<type name="custom:projectSpace">
         <title>ProjectSpace</title>
         <parent>cm:folder</parent>
         <properties>
            <property name="custom:Solution">
               <type>d:text</type>
               <constraints>
                  <constraint type="LIST">
                     <parameter name="allowedValues">
                        <list>
                           <value>Alfresco</value>
                           <value>Documentum</value>
                        </list>
                     </parameter>
                     <parameter name="caseSensitive">
                        <value>true</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
         </properties>
         <associations>
            <association name="custom:PM">
               <target>
                  <class>cm:person</class>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </association>
         </associations>
      </type>
    
     </type>
      <type name="custom:clientSpace">
      <title>ClientsSpace</title>
      <parent>cm:folder</parent>
      <associations>
         <child-association name="cm:contains">
            <source>
              <mandatory>false</mandatory>
              <many>true</many>
            </source>
            <target>
              <class>custom:projectSpace</class>
              <mandatory>false</mandatory>
              <many>true</many>
            </target>
            <duplicate>false</duplicate>
         </child-association>

       </associations>
   </type>

Is it possible to do something like this ?
Any idea of the direction I should look ???

For the moment I have set up a rule calling a custom action, on the addition of content to a client, which delete the added content if is type not "project" …
But this solution brings many trouble with webdav, cifs, and even web interface beacause it can't edit the property of a file that doesn't exist after the addition :-( …

All suggestion are welcom :-).

Thanks!

PS: sorry for indentation, it is correct in edition mod but it doesn't work in viewing… :-(

Outcomes