Api to update the 'Content Type' of the document

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2008 06:19 AM
Hi,
I need to know whether alfresco provides any Webservice Api's to Update both Content Type and its Properties of the document.
Below scenario explains what exactly I need to do….
1. Add a content with content type as 'X' (child of cm:content) .
2. Update the content type from 'X' to 'Y' (child of cm:content)
I tried to use CMLUpdate() Api to update both content type and its Properties, but its not working .
Please help me.
Thanks,
Mahesh
I need to know whether alfresco provides any Webservice Api's to Update both Content Type and its Properties of the document.
Below scenario explains what exactly I need to do….
1. Add a content with content type as 'X' (child of cm:content) .
2. Update the content type from 'X' to 'Y' (child of cm:content)
I tried to use CMLUpdate() Api to update both content type and its Properties, but its not working .
Please help me.
Thanks,
Mahesh
Labels:
- Labels:
-
Archive
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2009 04:36 AM
I have the same question!
I don't find a web service that could solve this problem.
And I have think about to define a rule in the space to convert a type A to a type B. Is it possible?
Or anyone have other suggestions???
Regards
Marco
I don't find a web service that could solve this problem.
And I have think about to define a rule in the space to convert a type A to a type B. Is it possible?
Or anyone have other suggestions???
Regards
Marco

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2009 11:58 AM
I'd got the same question, but i couldn't find answer.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 10:02 AM
I finally find the solution to update a document its name contentformat etc here is the code
public Reference updateFile(String uuid, String fileName, byte[] bytes){ Content content = new Content(); try { content = findContentWithUUID(uuid); // Set content Reference reference = content.getNode(); NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, fileName)}; CMLUpdate update = new CMLUpdate(properties, new Predicate( new Reference[] { reference }, STORE, null), "id2"); CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_VERSIONABLE, null, new Predicate( new Reference[] { reference }, STORE, null), "id1"); CML cml = new CML(); cml.setUpdate(new CMLUpdate[]{update}); cml.setAddAspect(new CMLAddAspect[]{addAspect}); //update document properties name UpdateResult[] updateResults = getRepositoryService().update(cml); ContentFormat format = new ContentFormat( findMimeType(fileName.substring(fileName.lastIndexOf(".")+1)), "UTF-8"); //update the content of document Content content2 = getContentService().write(content.getNode(), Constants.PROP_CONTENT, bytes, format); System.out.println(content2.getLength() + fileName + " updated…"); } catch (Exception e) { e.printStackTrace(); } return reference; }
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2010 09:56 AM
Icandir, can you share your "findMimeType()" method implementation details? Thanks..
