CMIS-577: allow creation of unfiled objects (AtomPub)

git-svn-id: https://svn.apache.org/repos/asf/chemistry/dotcmis/trunk@1398230 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/DotCMIS/binding/atompub/atompub.cs b/DotCMIS/binding/atompub/atompub.cs
index 4e3cd3d..92ecbfd 100644
--- a/DotCMIS/binding/atompub/atompub.cs
+++ b/DotCMIS/binding/atompub/atompub.cs
@@ -1502,11 +1502,25 @@
             CheckCreateProperties(properties);

 

             // find the link

-            string link = LoadLink(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeChildren);

+            string link = null;

 

-            if (link == null)

+            if (folderId == null)

             {

-                ThrowLinkException(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeChildren);

+                link = LoadCollection(repositoryId, AtomPubConstants.CollectionUnfiled);

+

+                if (link == null)

+                {

+                    throw new CmisObjectNotFoundException("Unknown respository or unfiling not supported!");

+                }

+            }

+            else

+            {

+                link = LoadLink(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeChildren);

+

+                if (link == null)

+                {

+                    ThrowLinkException(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeChildren);

+                }

             }

 

             UrlBuilder url = new UrlBuilder(link);

@@ -1636,11 +1650,25 @@
             CheckCreateProperties(properties);

 

             // find the link

-            string link = LoadLink(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeChildren);

+            string link = null;

 

-            if (link == null)

+            if (folderId == null)

             {

-                ThrowLinkException(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeChildren);

+                link = LoadCollection(repositoryId, AtomPubConstants.CollectionUnfiled);

+

+                if (link == null)

+                {

+                    throw new CmisObjectNotFoundException("Unknown respository or unfiling not supported!");

+                }

+            }

+            else

+            {

+                link = LoadLink(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeChildren);

+

+                if (link == null)

+                {

+                    ThrowLinkException(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeChildren);

+                }

             }

 

             UrlBuilder url = new UrlBuilder(link);