cancel
Showing results for 
Search instead for 
Did you mean: 

Mandatory Association with relaxed mode

lutz_horn
Champ in-the-making
Champ in-the-making
On http://docs.alfresco.com/4.2/concepts/metadata-model-assoc.html it says:

<blockquote>
As with mandatory properties, both enforced and relaxed modes are supported for the target end, allowing control over whether a transaction can commit or not based on missing associations.
</blockquote>

The XML Schema does not have any property to configure relaxed mode for a mandatory assoziation.

What am I missing? Is the documentation wrong in this point?
3 REPLIES 3

kaynezhang
World-Class Innovator
World-Class Innovator
Enforced and relaxed modes are configured using enforced attribute of mandatory sub element ,it is defined as following in modelschema.xsd

   <xs:complexType name="mandatoryDef" mixed="true">
      <xs:attribute name="enforced" use="optional" type="xs:boolean"/>    
   </xs:complexType>



In model definition ,it will be like following

<association name="**:***">
   <source>
      <mandatory>false</mandatory>
      <many>true</many>
   </source>
   <target>
      <class>**:***</class>
      <mandatory enforced="false">true</mandatory>
      <many>false</many>
   </target>
</association>

lutz_horn
Champ in-the-making
Champ in-the-making
Setting
enforced="true"
does not have any effect. This association (with dummy namespace and names)

<blockcode>
<association name="ns:assoc">
   <source>
      <mandatory>false</mandatory>
      <many>true</many>
   </source>
   <target>
      <class>cm:cmobject</class>
      <mandatory enforced="false">true</mandatory>                  
      <many>true</many>
   </target>
</association>
</blockcode>

produces this error:

<blockcode>
The association target multiplicity has been violated:
   Source Node: workspace://SpacesStore/ddf1f030-3e72-4a08-b21c-e5aee44b2d3b
   Association: Association[ class=ClassDef[name={http://example.com/model/ns/1.0}Aspect], name={http://example.com/model/ns/1.0}assocs, target class={http://www.alfresco.org/model/content/1.0}cmobject, source role=null, target role=null]
   Required target Multiplicity: 1..*
   Actual target Multiplicity: 0
</blockcode>

I can't find any working example of
<mandatory enforced="false">true</mandatory>
. Is this actually working?

lutz_horn
Champ in-the-making
Champ in-the-making
I consider this a bug and have created a ticket: https://issues.alfresco.com/jira/browse/ALF-21097