How change exception message in a child-association

cancel
Showing results for 
Search instead for 
Did you mean: 
zlucy82
Active Member II

How change exception message in a child-association

Hi, i have created this child-association in Alfresco:

<child-association name="da:mcAssociation">
<title>Association</title>
  <source>
    <mandatory>false</mandatory>
    <many>true</many>
   </source>
  <target>
   <class>cm:content</class>
   <mandatory>false</mandatory>
   <many>true</many>
  </target>
<duplicate>false</duplicate>
<propagateTimestamps>false</propagateTimestamps>
</child-association>‍‍‍‍‍‍‍‍‍‍‍‍‍‍


I have setted the "duplicate" tag to "false" because i don't want that duplicate node names are found within a set of children for the parent, so, when i tried to associated a duplicated child-node to a parent, i receive this exception:

"org.alfresco.service.cmr.repository.CyclicChildRelationshipException: Child Association Cycle detected hitting nodes: [1415]".

My goal is to change this exception message and customize it, is possible to change it?

Thank You.

4 Replies
angelborroy
Alfresco Employee

Re: How change exception message in a child-association

Do you want to show a customised message for the user in Share web application?

Hyland Developer Evangelist
zlucy82
Active Member II

Re: How change exception message in a child-association

I created a new custom content model containing my custom types and associations (type child-associations) and then i created a custom share action that runs a webscript to show this relations in alfresco share.

During the configuration of a node, a user can modify its properties and  can associate it with another node that becames its child. Since i have setted the tag duplicate to false, if the user try to associate a duplicate child, the system return an exception message that i want to customize. The exception is of the type "CyclicChildRelationshipException", maybe should i override this type of exception?

afaust
Master

Re: How change exception message in a child-association

A cyclic child relationship has nothing to do with the setting / value of duplicate. It is absolutely forbidden to have a cycle in your data structures. There is no way to override this type of exception without patching / overriding core services or out-of-the-box web scripts. There is also no way to override the exception message since this such a technical error that Alfresco actually embedded the message into the code instead of relying on a translate-able message resource.

zlucy82
Active Member II

Re: How change exception message in a child-association

Thank you Alex for your reply.
I want to avoid to have cycle in data structure, i want create associations between nodes but i don't want they create a cycle. The only way that i found to do this is to create the child-association as i write above. If there is another way, i appreciate  any suggests. Thanks.