Open nicolas-raoul opened 9 years ago
This is currently listed as an enhancement, but it might also be a bug.
When I browse a folder in CMIS Workbench with documents including some that have the folder as a secondary parent, I can see all files including the once that have a secondary parent.
When I sync a folder using CmisSync the documents that have the folder as a secondary parent are not synced.
To reproduce you can either use the Link to action in Alfresco RM or execute a document.addNode(childNode);
I ran a code example using DotCMIS.dll (assuming it is used as CMIS library) and that returns the secondary parent nodes (being the doc and docx documents):
Listing records for customer John Smith...
Invoice 01 (2015-1429645065088).pdf
Invoice 02 (2015-1429645065662).pdf
Invoice 03 (2015-1429645065931).pdf
Invoice - Alf e183k (2015-1426890305211).doc
Background Check Policy (2015-1427796103168).docx
Code snippet:
private void getCustomerRecords(ISession session) {
System.Console.WriteLine("Listing records for customer John Smith...");
IFolder filePlan = (IFolder)session.GetObjectByPath("/Sites/rm/documentLibrary/Customers/John Smith");
foreach (ICmisObject cmisObject in filePlan.GetChildren())
{
System.Console.WriteLine(cmisObject.Name);
}
System.Console.WriteLine();
}
Also updating a document retrieved from the secondary parent location works using DotCMIS.
Thanks a lot for the investigation!
Here are the commands that CmisSync uses:
It looks exactly like your code, right? So I wonder what is the difference... Actually CmisSync uses this slightly modified version of DotCMIS: https://github.com/aegif/chemistry-dotcmis Might it be the reason? Sorry for the trouble but would you mind replacing the DotCMIS with this one and let us know whether it is different? Thank you very much!
Sorry for the newbie question, but are there cases where a folder is filed in one of its children? Such a case might cause an infinite loop in CmisSync.
I tested the same code but now with the DotCMIS.dll used by CmisSync and it also lists the documents with secondary parents and updates a document properly.
The error in CmisSync cient is recorded in the log as follows:
2015-04-23 00:46:53,049 [8] INFO CmisSync.Lib.Sync.CmisRepo+SynchronizedFolder [(null)] - Downloading: InvoiceAdmin.doc
2015-04-23 00:46:53,096 [8] ERROR CmisSync.Lib.Sync.CmisRepo+SynchronizedFolder [(null)] - Could not download file: \Sites\test\documentLibrary\Documents\InvoiceAdmin.doc
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Sites\test\documentLibrary\Documents\InvoiceAdmin.doc.sync'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.OpenWrite(String path)
at CmisSync.Lib.Sync.CmisRepo.SynchronizedFolder.DownloadStream(IContentStream contentStream, String filePath)
at CmisSync.Lib.Sync.CmisRepo.SynchronizedFolder.DownloadFile(IDocument remoteDocument, String localFolder)
Looks like it tries to sync using its primary path rather than the secondary path. The primary path is Documents and the secondary path is admin in my test cases. So it might be related to how metadata is stored in the local database?
@bpeters09 Could you please let me know what Alfresco add-on or setting you use to create secondary paths? I am beginning to investigate the matter and I trying to figure out what is the easiest way to create such nodes now that Alfresco Explorer is gone :-) Thanks a lot for your help!
@nicolas-raoul I usually use the JavaScript Console (js-console) to enter the JS code - see code behind the link in the first posting in this thread. But you should also be able to write the JS code, upload it to the data dictionary and execute it there (but not that handy...).
@nicolas-raoul the JavaScript call
space.addNode(childNode);
adds the childNode as a secondary parent to space. In the RM module the link to capability using secondary parents is exposed in the Share UI. Most of the time I use a simple rule to automatically add documents as a secondary parent to some other folder to have some sample content.
From the forum: