Pass property values on to child-nodes

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

Pass property values on to child-nodes

Jump to solution

TL;DR

We need to pass on properties from a folder to all its' child-nodes. For example, if the folder A has the property id with the value 42, all child-nodes of that folder should inherit the same property with the same value.

Currently, we have implemented this with a folder-rule that executes a script whenever a new file enters the folder. The script then copies all the property values from the folder to the new node. Is there a better way?

 

Long Story

Most of our documents can be summarized to higher-level collections. One good example is a manufacturing contract. The relevant documents for this contract are not only the scanned contract itself but all meeting-protocols, emails, blueprints, etc. We call these higher-level collections records. In the above case, all those files together would be a manufacturing contract record.

To implement this, we're planning to use the following structure:

  • Every record has its' own folder.
  • In each record folder, there are all the documents that belong to that record.
  • Since there is some metadata that is the same for the whole record, e.g., record-ID, machine-type, these properties are set on the record-folder.
  • Other metadata is document-specific, e.g., a list of participants of meeting-protocols. This metadata is set on the respective documents.

The problem we face with this approach is the partition of metadata. Some properties are now set on the record-folder only. Others are set on the documents. If we try to launch a simple search like "list all blueprints of part XY that belongs to the record-ID 12345", we're already in a situation where AFTS doesn't offer us the required search options.

To avoid this problem, we decided that all properties set on a record-folder should be passed down to all its' child nodes. For example, the record-ID should be set for every document and folder that lies within the respective record folder. Currently, we implemented this via a folder rule that executes a script.

Is there a better way to do so? Or should we choose another approach for our problem?

1 Solution

Accepted Solutions
jpotts
Professional

Re: Pass property values on to child-nodes

Jump to solution

I see nothing wrong with the rule-based approach. If you wanted to use behaviors instead, you could, but if rules are working fine, I see no reason to change.

Obviously if the collection of files in a "manufacturing contract record" grows sufficiently large, the performance of your rule might start to suffer. If you told me that the number of items you need to copy the properties to was indeterminate or the folder tree below the parent was vast, I would recommend strongly against using this approach and instead would suggest using a different system entirely to maintain these relationships.

Another indicator this is a bad idea would be if there are a huge number of properties in the parent that need to be copied or if those will change frequently. But it sounds like it might just be the record ID and that probably never changes.

So, I think you are probably okay doing what you are doing.

If someone asked how to implement this requirement without using this approach, I would suggest creating a database (or JSON document store) and putting a thin API in front of it. Then I would add actions in Alfresco that are essentially "Add to Contract Record" and "Remove from Contract Record" that make calls to the API and pass in a node ref or other identifier. That other system would be in charge of maintaining and reporting on the relationships. You could even do small customizations to the Share or ADF-based UI that would query and list the relationships (like "Show Other Docs in this Record..." kind of thing).

The more your requirements start to sound "relational" the more you should be relying on other, non-Alfresco, systems as part of your solution.

View solution in original post

1 Reply
jpotts
Professional

Re: Pass property values on to child-nodes

Jump to solution

I see nothing wrong with the rule-based approach. If you wanted to use behaviors instead, you could, but if rules are working fine, I see no reason to change.

Obviously if the collection of files in a "manufacturing contract record" grows sufficiently large, the performance of your rule might start to suffer. If you told me that the number of items you need to copy the properties to was indeterminate or the folder tree below the parent was vast, I would recommend strongly against using this approach and instead would suggest using a different system entirely to maintain these relationships.

Another indicator this is a bad idea would be if there are a huge number of properties in the parent that need to be copied or if those will change frequently. But it sounds like it might just be the record ID and that probably never changes.

So, I think you are probably okay doing what you are doing.

If someone asked how to implement this requirement without using this approach, I would suggest creating a database (or JSON document store) and putting a thin API in front of it. Then I would add actions in Alfresco that are essentially "Add to Contract Record" and "Remove from Contract Record" that make calls to the API and pass in a node ref or other identifier. That other system would be in charge of maintaining and reporting on the relationships. You could even do small customizations to the Share or ADF-based UI that would query and list the relationships (like "Show Other Docs in this Record..." kind of thing).

The more your requirements start to sound "relational" the more you should be relying on other, non-Alfresco, systems as part of your solution.

View solution in original post