cancel
Showing results for 
Search instead for 
Did you mean: 

Uniqueness constraint over content based on custom aspect properties

arpa1986
Champ in-the-making
Champ in-the-making
Hi

I have defined a custom aspect that contains multiple properties.  Is it possible to enforce a no duplicate content based in the properties of the custom aspect?


Thanks,

Andres
5 REPLIES 5

romschn
Star Collaborator
Star Collaborator
What is your requirement and what are you trying to implement?

arpa1986
Champ in-the-making
Champ in-the-making
I configured a custom aspect, this aspect contains multiples properties.  I need create an uniqueness constraint based in the properties of my custom aspect.  When I upload a document, the uniqueness constraint should not allow upload document with the same properties of other documents.

Thanks

Andres

iamdhavaljoshi
Champ in-the-making
Champ in-the-making
I can suggest you work around to achevie the same. What you need to do is need to fire DB query on 'alf_node_properties' in query you can use qname_id in where clause and check if any node has already contains same property value for given qname_id. You can first find qname_id of your custom peroperty from 'alf_qname' table.

e.g.
SELECT * FROM alf_node_properties WHERE qname_id=2 AND string_value = '!!!000CD_123'

I am not sure about performance.


Thanks & Regards,
Dhaval Joshi
CIGNEX Datamatics

arpa1986
Champ in-the-making
Champ in-the-making
Is it posible configure this uniqueness constraint into XML configuration of alfrescon installation?

Thanks,


Andres

According to me there is no such configuration in xml for unqueness, You have write some custom code to implement it. But you can also try below given solution. I hope it will workl for you.

Solution:-

You can create custom table which will have all the fields for which you want no duplication. Fields are declared as not null and no duplicate. Create this custom table inside
Alfresco database.

Now implement nodeservice policy for create node and update node properties. Everytime when new node get created or property of node get updated, we need to push same inot custom table. Now we have
uniquness constraints implemented for each field so if there is duplicate entry it will throw duplicate value exception. Handle exception as per your business requirement.

According to me it's better possible solution.

Thanks & Regards,
Dhaval Joshi
CIGNEX Datamatics
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.