You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2012/08/29 12:27:43 UTC
svn commit: r1378495 - in /chemistry/dotcmis/trunk/DotCMIS:
binding/atompub/atompub.cs client/client-impl.cs client/client-intf.cs
client/client-objects.cs
Author: fmui
Date: Wed Aug 29 10:27:42 2012
New Revision: 1378495
URL: http://svn.apache.org/viewvc?rev=1378495&view=rev
Log:
Following up with OpenCMIS bug fixes and enhancements
Modified:
chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs
chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs
chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs
chemistry/dotcmis/trunk/DotCMIS/client/client-objects.cs
Modified: chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs?rev=1378495&r1=1378494&r2=1378495&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs Wed Aug 29 10:27:42 2012
@@ -1902,8 +1902,21 @@ namespace DotCMIS.Binding.AtomPub
public IFailedToDeleteData DeleteTree(string repositoryId, string folderId, bool? allVersions, UnfileObject? unfileObjects,
bool? continueOnFailure, ExtensionsData extension)
{
- // find the link
- String link = LoadLink(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeDescendants);
+ // find the down link
+ String link = LoadLink(repositoryId, folderId, AtomPubConstants.RelDown, null);
+
+ if (link != null)
+ {
+ // found only a children link, but no descendants link
+ // -> try folder tree link
+ link = null;
+ }
+ else
+ {
+ // found no or two down links
+ // -> get only the descendants link
+ link = LoadLink(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeDescendants);
+ }
if (link == null)
{
@@ -1912,6 +1925,11 @@ namespace DotCMIS.Binding.AtomPub
if (link == null)
{
+ link = LoadLink(repositoryId, folderId, AtomPubConstants.RelFolderTree, AtomPubConstants.MediatypeFeed);
+ }
+
+ if (link == null)
+ {
ThrowLinkException(repositoryId, folderId, AtomPubConstants.RelDown, AtomPubConstants.MediatypeDescendants);
}
Modified: chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs?rev=1378495&r1=1378494&r2=1378495&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs Wed Aug 29 10:27:42 2012
@@ -173,10 +173,14 @@ namespace DotCMIS.Client.Impl
public class Session : ISession
{
private static HashSet<Updatability> CreateUpdatability = new HashSet<Updatability>();
+ private static HashSet<Updatability> CreateAndCheckoutUpdatability = new HashSet<Updatability>();
static Session()
{
CreateUpdatability.Add(Updatability.OnCreate);
CreateUpdatability.Add(Updatability.ReadWrite);
+ CreateAndCheckoutUpdatability.Add(Updatability.OnCreate);
+ CreateAndCheckoutUpdatability.Add(Updatability.ReadWrite);
+ CreateAndCheckoutUpdatability.Add(Updatability.WhenCheckedOut);
}
protected static IOperationContext FallbackContext = new OperationContext(null, false, true, false, IncludeRelationshipsFlag.None, null, true, null, true, 100);
@@ -678,7 +682,8 @@ namespace DotCMIS.Client.Impl
throw new ArgumentException("Properties must not be empty!");
}
- string newId = Binding.GetObjectService().CreateDocument(RepositoryId, ObjectFactory.ConvertProperties(properties, null, CreateUpdatability),
+ string newId = Binding.GetObjectService().CreateDocument(RepositoryId, ObjectFactory.ConvertProperties(properties, null,
+ (versioningState == VersioningState.CheckedOut ? CreateAndCheckoutUpdatability : CreateUpdatability)),
(folderId == null ? null : folderId.Id), contentStream, versioningState, ObjectFactory.ConvertPolicies(policies),
ObjectFactory.ConvertAces(addAces), ObjectFactory.ConvertAces(removeAces), null);
@@ -717,7 +722,9 @@ namespace DotCMIS.Client.Impl
}
string newId = Binding.GetObjectService().CreateDocumentFromSource(RepositoryId, source.Id,
- ObjectFactory.ConvertProperties(properties, type, CreateUpdatability), (folderId == null ? null : folderId.Id),
+ ObjectFactory.ConvertProperties(properties, type,
+ (versioningState == VersioningState.CheckedOut ? CreateAndCheckoutUpdatability : CreateUpdatability)),
+ (folderId == null ? null : folderId.Id),
versioningState, ObjectFactory.ConvertPolicies(policies), ObjectFactory.ConvertAces(addAces),
ObjectFactory.ConvertAces(removeAces), null);
@@ -838,6 +845,51 @@ namespace DotCMIS.Client.Impl
return new CollectionEnumerable<IRelationship>(new PageFetcher<IRelationship>(DefaultContext.MaxItemsPerPage, fetchPageDelegate));
}
+ // delete
+ public void Delete(IObjectId objectId)
+ {
+ Delete(objectId, true);
+ }
+
+ public void Delete(IObjectId objectId, bool allVersions)
+ {
+ if (objectId == null || objectId.Id == null)
+ {
+ throw new ArgumentException("Invalid object id!");
+ }
+
+ Binding.GetObjectService().DeleteObject(RepositoryId, objectId.Id, allVersions, null);
+ RemoveObjectFromCache(objectId);
+ }
+
+ // content stream
+ public IContentStream GetContentStream(IObjectId docId)
+ {
+ return GetContentStream(docId, null, null, null);
+ }
+
+ public IContentStream GetContentStream(IObjectId docId, string streamId, long? offset, long? length)
+ {
+ if (docId == null || docId.Id == null)
+ {
+ throw new ArgumentException("Invalid document id!");
+ }
+
+ // get the content stream
+ IContentStream contentStream = null;
+ try
+ {
+ contentStream = Binding.GetObjectService().GetContentStream(RepositoryId, docId.Id, streamId, offset, length, null);
+ }
+ catch (CmisConstraintException)
+ {
+ // no content stream
+ return null;
+ }
+
+ return contentStream;
+ }
+
// permissions
public IAcl GetAcl(IObjectId objectId, bool onlyBasicPermissions)
Modified: chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs?rev=1378495&r1=1378494&r2=1378495&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs Wed Aug 29 10:27:42 2012
@@ -259,8 +259,15 @@ namespace DotCMIS.Client
IItemEnumerable<IRelationship> GetRelationships(IObjectId objectId, bool includeSubRelationshipTypes,
RelationshipDirection? relationshipDirection, IObjectType type, IOperationContext context);
- // permissions
+ // delete
+ void Delete(IObjectId objectId);
+ void Delete(IObjectId objectId, bool allVersions);
+
+ // content stream
+ IContentStream GetContentStream(IObjectId docId);
+ IContentStream GetContentStream(IObjectId docId, string streamId, long? offset, long? length);
+ // permissions
IAcl GetAcl(IObjectId objectId, bool onlyBasicPermissions);
IAcl ApplyAcl(IObjectId objectId, IList<IAce> addAces, IList<IAce> removeAces, AclPropagation? aclPropagation);
void ApplyPolicy(IObjectId objectId, params IObjectId[] policyIds);
@@ -854,6 +861,12 @@ namespace DotCMIS.Client
IContentStream GetContentStream(string streamId);
/// <summary>
+ /// Gets the content stream identified by the given stream id with the given offset and length.
+ /// </summary>
+ /// <returns>the content stream or <c>null</c> if the stream id is not associated with content</returns>
+ IContentStream GetContentStream(string streamId, long? offset, long? length);
+
+ /// <summary>
/// Sets a new content stream for this document.
/// </summary>
/// <param name="contentStream">the content stream</param>
Modified: chemistry/dotcmis/trunk/DotCMIS/client/client-objects.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/client/client-objects.cs?rev=1378495&r1=1378494&r2=1378495&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/client/client-objects.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/client/client-objects.cs Wed Aug 29 10:27:42 2012
@@ -200,7 +200,7 @@ namespace DotCMIS.Client.Impl
Lock();
try
{
- Binding.GetObjectService().DeleteObject(RepositoryId, ObjectId, allVersions, null);
+ Session.Delete(this, allVersions);
}
finally
{
@@ -931,14 +931,15 @@ namespace DotCMIS.Client.Impl
return GetContentStream(null);
}
- public IContentStream GetContentStream(String streamId)
+ public IContentStream GetContentStream(string streamId)
{
- IContentStream contentStream;
- try
- {
- contentStream = Binding.GetObjectService().GetContentStream(RepositoryId, ObjectId, streamId, null, null, null);
- }
- catch (CmisConstraintException)
+ return GetContentStream(streamId, null, null);
+ }
+
+ public IContentStream GetContentStream(string streamId, long? offset, long? length)
+ {
+ IContentStream contentStream = Session.GetContentStream(this, streamId, offset, length);
+ if (contentStream == null)
{
// no content stream
return null;