cancel
Showing results for 
Search instead for 
Did you mean: 

Applying an aspect at object creation time

nickiemc
Champ in-the-making
Champ in-the-making
Has anyone had any success applying an aspect to an object at creation time?  I can successfully create a document and then apply an aspect, but I would like to minimize the number of calls to the web services, so I would like to apply the aspect during the initial creation.

I have tried creating a CMLAddAspect object and adding it to the CML object being passed into the Repository Services' update() method, however, I am not sure what to pass in as the Predicate "where" parameter or the String "where_id" parameter, since I do not know the id of the object which will be created.

Any help or suggestions would be greatly appreciated.
1 REPLY 1

openpj
Elite Collaborator
Elite Collaborator
I am not sure what to pass in as the Predicate "where" parameter or the String "where_id" parameter, since I do not know the id of the object which will be created.
You have to use a predicate as the "where" parameter using a reference created with only the path of the content.

A predicate is a group of nodes, inside of it, you have to set a Reference. In this Reference object you have to set the Path (XPath) of the new content that you are creating.

Reference and Predicate can be created using optional parameters, for the Reference you can use the UUID or you can use the Path of the content. In this case, you are creating new content so this means that you can't know the new UUID for the node. That's why you have to set the Reference using the Path for the new content.

Hope this helps.