cancel
Showing results for 
Search instead for 
Did you mean: 

Associations and the 'Source' element

ferdware
Champ in-the-making
Champ in-the-making
I'm new to Alfresco and I have been diligently going through all the developer tutorials, however I do have one question that I can't seem to find the answer for.  It has to do with Associations and the 'Source'/'Target' elements.  Actually more the source element than the target.

If Document-A has a peer association with Document-B then how does the source directive come to play?  In my mind in order to have any association with anything should it always start with a source? The reason I ask is because in many examples I see the source set as source->mandatory->false.  What does this mean? How can you have a target without a source?

Also when set to source->many->true, I'm assuming that the target can have more than one reference, and when set to false only one reference?

If anyone out there can explain I would greatly appreciate it.

Thank You in Advance.
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

the use of the "source"/"target" elements can be a bit confusing because not all of the elements contained thereing actually refer to constraints on the association. An association always requires a source and a target. The "mandatory" information affects the source/target types more than it affects the association itself - e.g. if the "source" is mandatory, then no instance of the target type can exist without having an association linking to it from an instance of the source type. It is the same with "many", e.g. "source" => "many" = true means that multiple instances of the source type can have associations to the same instance of the target type.

The effect of "mandatory" is quite extreme and since there is no way to differentiate a "should" and "must" mandatory state (like you can do with mandatory / enforced-mandatory for properties) it is usually kept to "mandatory" = false.

Regards
Axel

ferdware
Champ in-the-making
Champ in-the-making
Thank You very much for your time to explain it to me. I now understand where and how to make use of the directive.

Best Regards.