update node properties via web services
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2010 10:05 AM
Hello 
I'm trying to write a class which get a content via a lucene query, very if the content has a custom aspect and then update a specific property inside this aspect.
I'm new to the web service api. I've read the sample codes in the SDK but there are some points I don't understand…
Here is my current code :
I don't know what to do with my Content object. Could you give me a hand please ?
Thank you.

I'm trying to write a class which get a content via a lucene query, very if the content has a custom aspect and then update a specific property inside this aspect.
I'm new to the web service api. I've read the sample codes in the SDK but there are some points I don't understand…
Here is my current code :
// get the corresponding nodeRef in the Repository Query query = new Query(Constants.QUERY_LANG_LUCENE, "+TYPE:\"mcm:resource\" AND +PATH:\"/app:company_home/custom:company_home//*\" AND +@mcm\\:xpath:\"" + docXpath + "\""); QueryResult queryResult = repositoryService.query(STORE, query, false); // Display the results ResultSet resultSet = queryResult.getResultSet(); ResultSetRow[] rows = resultSet.getRows(); if (rows != null){ // Get the id of the first result String firstResultId = rows[0].getNode().getId(); Reference reference = new Reference(STORE, firstResultId, null); // Read the node from the respository Content[] readResult = contentService.read( new Predicate(new Reference[]{reference}, STORE, null), Constants.PROP_CONTENT); Content content = readResult[0];
I don't know what to do with my Content object. Could you give me a hand please ?

Thank you.
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2010 02:24 AM
Hi,
You can find information about the Content object here http://wiki.alfresco.com/wiki/Content_Web_Service#Content
What do you want to do with the Content object?
Cheers,
Roy
You can find information about the Content object here http://wiki.alfresco.com/wiki/Content_Web_Service#Content
What do you want to do with the Content object?
Cheers,
Roy
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2010 04:07 AM
Hi 
I would like to check if my content has the aspect tag:taggable ( or has the property tag:tags which is part of the tag:taggable aspect), add it if it's not the case and then set the property tag:tags.
I've changed a part of the code :
Regarding performances is it better to use CMLupdate or Content object ?

I would like to check if my content has the aspect tag:taggable ( or has the property tag:tags which is part of the tag:taggable aspect), add it if it's not the case and then set the property tag:tags.
I've changed a part of the code :
if (rows != null){ // Create a reference to the node to manage its content String firstResultId = rows[0].getNode().getId(); Reference reference = new Reference(STORE, firstResultId, null); Predicate p = new Predicate(new Reference[]{reference},STORE,null); // get tags and tags'xpaths as arrays String[] tags = getTagsFromXpathAsArray(docTagsList); String[] xpaths = getTagsXpathsAsArray(docTagsList); // create CMLUpdate instances to update corresponding properties. CMLUpdate updateTagsXpaths = new CMLUpdate( new NamedValue[]{Utils.createNamedValue(TAG_XPATH_PROP, xpaths)},p,null); CMLUpdate updateTags = new CMLUpdate( new NamedValue[]{Utils.createNamedValue(TAG_TAGS_PROP, tags)},p,null); // create a CML instance and execute updates. CML cml = new CML(); cml.setUpdate(new CMLUpdate[]{updateTagsXpaths,updateTags}); UpdateResult[] result = repositoryService.update(cml); System.out.println("tags successfully copied…");}
Regarding performances is it better to use CMLupdate or Content object ?
