Problem while reading document content

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2006 04:15 PM
Hi All,
Version details : Alfresco 1.3 / Tomcat 5.5.12 / JDK 1.5
environment (an Alfresco bundle - downloaded from alfresco site)
We have 2 spaces in the repository
- test01
- test02
There is a simple workflow setup such that content will be move from test01 to test02.
There is rule setup on space test02, whenever a new file/content arrives in test02,
it will trigger an action which calls an external java application and passes the
node-uuid of the document to it.
The application will query back the repository using the uuid reference
via WebServices API and gets the file from repository and saves it to the local file system.
Here the problem is that whenever the application queries and get the file
it always ended up with NULL value. But if i try with node reference
of a document which is there on the repository some time before, then
i am able to get the file and other meta data associated with it.
It is failing every other case like if the application queries the repository
using the uuid sent by the action set on space test02.
I expect that the problem is due to immediate querying of the alfresco
where it is not yet done with storing the file completely in the repository.
Can anybody give me some idea of how to handle this.
Following is the code snap i used and the *ed is the line where it throws me the NULL value.
Thanks,
Pavan Ramadugula
Version details : Alfresco 1.3 / Tomcat 5.5.12 / JDK 1.5
environment (an Alfresco bundle - downloaded from alfresco site)
We have 2 spaces in the repository
- test01
- test02
There is a simple workflow setup such that content will be move from test01 to test02.
There is rule setup on space test02, whenever a new file/content arrives in test02,
it will trigger an action which calls an external java application and passes the
node-uuid of the document to it.
The application will query back the repository using the uuid reference
via WebServices API and gets the file from repository and saves it to the local file system.
Here the problem is that whenever the application queries and get the file
it always ended up with NULL value. But if i try with node reference
of a document which is there on the repository some time before, then
i am able to get the file and other meta data associated with it.
It is failing every other case like if the application queries the repository
using the uuid sent by the action set on space test02.
I expect that the problem is due to immediate querying of the alfresco
where it is not yet done with storing the file completely in the repository.
Can anybody give me some idea of how to handle this.
Following is the code snap i used and the *ed is the line where it throws me the NULL value.
AuthenticationUtils.startSession(user, pwd);
Store store = new Store(StoreEnum.workspace, "SpacesStore");
Reference reference = new Reference(store,uuid,null);
Predicate predicate = new Predicate(new Reference[]{reference}, store, null);
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
//At this line it is not able to get the nodes.
*** Node[] nodes = repositoryService.get(predicate);
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
Content[] readResult = contentService.read(predicate,Constants.PROP_CONTENT);
fileName = Calendar.getInstance().getTime().toString()+".out";
File filePath = new File(dirName,fileName);
ContentUtils.copyContentToFile(readResult[0],finalFilePath);
AuthenticationUtils.endSession();
Thanks,
Pavan Ramadugula
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2006 02:49 AM
i am not an expert but try this.I suggest you to query the file before you read so that you know if the file is there in Alfresco.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 08:28 AM
Yes, I tried that too, its not even able to find the node reference.
That seems to be the actual trouble.
Probably the alfresco's persistence layer has not updated the infomation of the document
by the time the java code is querying back using the WS API.
Thanks,
Pavan Ramadugula
That seems to be the actual trouble.
Probably the alfresco's persistence layer has not updated the infomation of the document
by the time the java code is querying back using the WS API.
Thanks,
Pavan Ramadugula
