cancel
Showing results for 
Search instead for 
Did you mean: 

Using Alfresco in a Java Web Based Application

vramos89
Champ in-the-making
Champ in-the-making
HI, i'm new to Alfresco and i would like to know how can i move a file through a Java based API. I'm devoloping an application and when the user makes an action i want to move the file to another directory. I've been searching and i'm trying to use/understand the exaples given in this link: http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/sdk/samples/WebServic...

But i'm not able to compile the code. Netbeans tells me that my function should be throwable "Repository Fault" and then tells me that "Repository fault" is not throwable. I'm exactly using the given code.

Thanks,

Vanessa
3 REPLIES 3

jpotts
World-Class Innovator
World-Class Innovator
Hi, Vanessa!

Welcome to the Alfresco community. We're glad you're here.

I know we don't make this very clear anywhere, but we would strongly recommend that you use CMIS as the first choice for working with Alfresco from your application instead of the old Web Services API. CMIS isn't always the answer, but it does address a lot of CRUD functions, including moves.

In CMIS, doing a move is as easy as calling the move method on a fileable object (like a Document or a Folder) and passing in the source and target folders' object ID's. See the Apache Chemistry web page for some OpenCMIS examples.

With that said, your code should still compile. Have you tried downloading the binary distribution of the SDK instead of building it from source?

Jeff

nandhakumars
Champ in-the-making
Champ in-the-making
Hi Jeff,

Can please tell the exact web service for performing the move operation? I need to move the file from one folder to another folder from Cordys environment. I'm currently using CMIS web service for all my operations like Content, Authoring, Repository web serivces. So for the MOVE operation should I use UPDATE web service in Repoistory or any other web serivce? And also please provide a sample soap request also.

Thanks in Advance

Regards
Nandha

jspuchau
Champ in-the-making
Champ in-the-making
If you navigate to the CMIS family WebScript http://localhost:8080/alfresco/service/index/family/CMIS, you can find the following that there is a service which description is:

Create / Move a Folder or Document (createDocument, createFolder, createPolicy, moveObject)


POST /alfresco/service/cmis/i/{id}/children?sourceFolderId={sourceFolderId}&versioningState={versioningState?}
POST /alfresco/service/cmis/s/{store}/i/{id}/children?sourceFolderId={sourceFolderId}&versioningState={versioningState?}
POST /alfresco/service/cmis/p{path}/children?sourceFolderId={sourceFolderId}&versioningState={versioningState?}
POST /alfresco/service/cmis/s/{store}/p{path}/children?sourceFolderId={sourceFolderId}&versioningState={versioningState?}
POST /alfresco/service/api/node/{store_type}/{store_id}/{id}/children?sourceFolderId={sourceFolderId}&versioningState={versioningState?}
POST /alfresco/service/api/path/{store_type}/{store_id}/{nodepath}/children?sourceFolderId={sourceFolderId}&versioningState={versioningState?}

I hope this can help you enough.

Kind Reagrds,