cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Folder template and multivalued property

Lvit
Champ in-the-making
Champ in-the-making

Hi,

i have a custom model with a multiple value property like this:

<property name="mytype:myprop">
                    <title>MyProp</title>
                    <type>d:text</type>
                    <mandatory>false</mandatory>
                    <multiple>true</multiple>
                    <index enabled="true">
                        <tokenised>TRUE</tokenised>
                        <facetable>false</facetable>
                    </index>
                </property>

This property is filled by external Java code and the values is different for every documents. For example:

DOC1 --> ["VAL1", "VAL2", "VAL3"]

DOC2 --> ["VAL2", "VAL4", "VAL5", "VAL6"]

I created a simple smart folder template that create two subfolders for two single possible values of property:

{
	"name" : "Smart Folders Template",
	"nodes" : [{
		"id":"1",
		"name" : "Values",
		"description" : "Values",
		"nodes" : [{
				"id":"11",
				"name":"VAL1",
				"description":"VAL1",
				"search" : {
					"language" : "fts-alfresco",
					"query" : "(PATH:'/mypath//*') AND (=cm:content.mimetype:application/pdf) AND (=mytype:myprop:'VAL1')"
				}
			},
			{
				"id":"12",
				"name":"VAL2",
				"description":"VAL2",
				"search" : {
					"language" : "fts-alfresco",
					"query" : "(PATH:'/mypath//*') AND (=cm:content.mimetype:application/pdf) AND (=mytype:myprop:'VAL2')"
				}
			}
		]
	}
}

But this property has lot of possible values, and increase every day.

I want to have a smart folder template that automatically create a subfolders for every possible value of this property.

How can i do?

Thanks

2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator

You would have to develop a custom behaviour / policy which reacts to any property update on nodes on which the propery can be set. This behavior / policy would have to parse your smart folder template JSON, check if the value(s) of the multivalued property are already contained in there, and if not, modify the JSON and save it back to the template node.

Apart from such custom logic, there is no way (no configuration / dynamic templating in the JSON) to achieve this.

Lvit
Champ in-the-making
Champ in-the-making

There is no way to modify JSON template using Java OpenCMIS library or Alfresco API?

I could edit the template by an external Java code and automatically add new node..

Thank for the reply.