- If this is a folder entry, it only specifies children link if it actually has children
- If this is a folder or document entry, it only specifies parent link if a parent exists.
There is a basic problem with this approach. Suppose that a folder is empty, i.e., has no children. How can I find out the URL to which I can POST an entry to create a document? Ideally, this should be solved in the manner proposed by hierarchy-ID where a link with rel="detail" is automatically created for folder type of entries. Thereby, if a folder is empty, its detail link would produce a feed with no entries, but include enough information to describe that the collection that produced the feed, i.e., the folder resource, is willing to receive new entries and the URL at which a POST request will result in a new document entry being added to the folder would also be disclosed. Here's what I mean in terms of concrete syntax:
<entry>
<title>Folder metadata</title>
<link rel="self" href="/a;metadata"/>
<link rel="edit" href="/a;metadata"/>
<link rel="children" href="/a/" title="document children collection"/>
<id>tag:example.org;2009:1</id>
...
</entry>
<feed>
<title>Folder contents</title>
<link rel="self" href="/a/"/>
<link rel="parent" href="/a;metadata"/>
<id>tag:example.org;2009:1-1</id>
...
<app:collection href="/a/">
<title>Folder collection</title>
</app:collection>
</feed>
This mechanism works in all cases (for parent and children relations), is auto-discoverable and hence works beautifully with standard AtomPub clients.
One thing to notice here is that I am using a link to the parent folder entry from the folder children feed. Since CMIS allows the possibility that an implementation may or may not allow multiple parents, the optimization for a single parent system is that the parent link returns an entry as opposed to a feed with a single parent entry. This makes it possible for a client to know that it cannot create more parents.
On a related note, I found that the parent link is optional for document entries. What does it mean for a document to not have a parent? It sounds like another major headache for clients (especially those who are synchronizing for disconnected use) to know under what conditions certain entries will outlive their parent folders.


2 comments:
The purpose of CMIS is to specify a standard way of exposing common ECM functionality via REST/Atom and WS.
In ECM, especially in the transactional content use cases, it is quite common for customers to have a repository with no folders at all. They find the relevant documents such as loan contracts or customer statements through search. Thus in the ECM domain documents can have 0..n parents.
The catch-22 case you bring is good and should be addressed.
@Albert -
The "catch-22" problem is not one that requires Sherlock Holmes to discover. Any good AtomPub programmer worth their salt ought to have spotted this problem.
I can deduce that the problem arose because of CMIS IV: Confusing feeds and collections. I look forward to seeing a resolution to both issues.
Post a Comment