cancel
Showing results for 
Search instead for 
Did you mean: 

Adding an association

mizage
Champ in-the-making
Champ in-the-making
I have added a new aspect to ws:indexPage, which is an assocation.  Everything works fine as long as it's a new index page, meaning that it was created after I altered the content model.
If I try to alter an older index page, I get the following warning (shouldn't it be an error?):

10:26:58,464 WARN  [org.alfresco.repo.forms.processor.node.NodeFormProcessor] Ignoring field 'assoc_cis_groupedLinkList_removed' as an association definition can not be found
10:26:58,467 WARN  [org.alfresco.repo.forms.processor.node.NodeFormProcessor] Ignoring field 'assoc_cis_groupedLinkList_added' as an association definition can not be found


<!—new aspects for ws:indexPage—>
<type name="ws:indexPage">
  <!–the rest hidden—>
   <mandatory-aspects>
       <aspect>cis:associatedGroupedLinks</aspect>
    </mandatory-aspects>
</type>



<!–custom aspect—>
       <aspect name="cis:associatedGroupedLinks">
         <title>Associated Grouped Links</title>
         <associations>
            <association name="cis:groupedLinkList">
               <title>Associated Grouped Links</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cis:groupedLinks</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
      </aspect>

Is there an issue in my aspect definition?
5 REPLIES 5

bremmington
Champ on-the-rise
Champ on-the-rise
No, this is just the form processor that's handling the edit form submission warning you that the node being edited doesn't appear to have this particular association defined.

mizage
Champ in-the-making
Champ in-the-making
My issue is that when I add an article to an existing node (via the newly created aspect) it doesn't save the association to the article. But with a new node (created after the model was altered)
it does save the association to the article. Sorry if I'm not being clear.

bremmington
Champ on-the-rise
Champ on-the-rise
How are you trying to add the association on the "old" node? If the aspect isn't applied to that node then you won't be able to add an association of that type. Does it work if you add the aspect to the old node before trying to add the association?

mizage
Champ in-the-making
Champ in-the-making
Sometimes it's easier to show!

Open a ws:indexPage (one created before the model was altered):

[img]http://www.acthiv.org/2010slides/indexOldMeta.png[/img]
[img]http://www.acthiv.org/2010slides/indexOldMeta2.png[/img]
[img]http://www.acthiv.org/2010slides/indexOldMeta3.png[/img]

Then after saving, re-open and the assocation has not been saved:

[img]http://www.acthiv.org/2010slides/indexOldMeta4.png[/img]

Now if I do the same with a ws:indexPage created after I altered the model, the association is saved. No problems.

bremmington
Champ on-the-rise
Champ on-the-rise
This is due to your revised form definition showing the "generic links" even though the node being edited doesn't have that association available (since it doesn't have your custom aspect on it). I suggest that you write a little webscript that finds all nodes of type ws:indexPage that don't have your custom aspect applied and adds your custom aspect to each one that doesn't already have it. You can then execute that webscript to fix up your content, and that will resolve this problem.