Modified: chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs?rev=1740350&r1=1740349&r2=1740350&view=diff ============================================================================== --- chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs (original) +++ chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlUtils.cs Thu Apr 21 16:29:04 2016 @@ -31,16 +31,16 @@ using PortCMIS.Exceptions; namespace PortCMIS.Binding.AtomPub { - class XmlUtils + internal class XmlUtils { // -------------- // --- writer --- // -------------- - /** - * Creates a new XML writer. - */ + /// <summary> + /// Creates a new XML writer. + /// </summary> public static XmlWriter createWriter(Stream stream) { XmlWriterSettings settings = new XmlWriterSettings(); @@ -48,10 +48,10 @@ namespace PortCMIS.Binding.AtomPub return XmlWriter.Create(stream, settings); } - /** - * Starts a XML document. - */ - public static void startXmlDocument(XmlWriter writer, string rootLocalName, string rootNamespace) + /// <summary> + /// Starts a XML document. + /// </summary> + public static void StartXmlDocument(XmlWriter writer) { // writer.setPrefix(XmlConstants.PREFIX_ATOM, XmlConstants.NAMESPACE_ATOM); // writer.setPrefix(XmlConstants.PREFIX_CMIS, XmlConstants.NAMESPACE_CMIS); @@ -61,19 +61,18 @@ namespace PortCMIS.Binding.AtomPub writer.WriteStartDocument(); } - /** - * Ends a XML document. - */ - public static void endXmlDocument(XmlWriter writer) + /// <summary> + /// Ends a XML document. + /// </summary> + public static void EndXmlDocument(XmlWriter writer) { writer.WriteEndDocument(); - writer.Dispose(); } - /** - * Writes a String tag. - */ - public static void write(XmlWriter writer, string prefix, string ns, string tag, string value) + /// <summary> + /// Writes a String tag. + /// </summary> + public static void Write(XmlWriter writer, string prefix, string ns, string tag, string value) { if (value == null) { @@ -92,23 +91,23 @@ namespace PortCMIS.Binding.AtomPub writer.WriteEndElement(); } - /** - * Writes an Integer tag. - */ - public static void write(XmlWriter writer, string prefix, string ns, string tag, BigInteger? value) + /// <summary> + /// Writes an Integer tag. + /// </summary> + public static void Write(XmlWriter writer, string prefix, string ns, string tag, BigInteger? value) { if (value == null) { return; } - write(writer, prefix, ns, tag, ((BigInteger)value).ToString("#", CultureInfo.InvariantCulture)); + Write(writer, prefix, ns, tag, ((BigInteger)value).ToString("#", CultureInfo.InvariantCulture)); } - /** - * Writes a Decimal tag. - */ - public static void write(XmlWriter writer, String prefix, String ns, String tag, decimal? value) + /// <summary> + /// Writes a Decimal tag. + /// </summary> + public static void Write(XmlWriter writer, String prefix, String ns, String tag, decimal? value) { if (value == null) { @@ -127,10 +126,10 @@ namespace PortCMIS.Binding.AtomPub writer.WriteEndElement(); } - /** - * Writes a DateTime tag. - */ - public static void write(XmlWriter writer, String prefix, String ns, String tag, DateTime? value) + /// <summary> + /// Writes a DateTime tag. + /// </summary> + public static void Write(XmlWriter writer, String prefix, String ns, String tag, DateTime? value) { if (value == null) { @@ -149,30 +148,30 @@ namespace PortCMIS.Binding.AtomPub writer.WriteEndElement(); } - /** - * Writes a Boolean tag. - */ - public static void write(XmlWriter writer, string prefix, string ns, string tag, bool? value) + /// <summary> + /// Writes a Boolean tag. + /// </summary> + public static void Write(XmlWriter writer, string prefix, string ns, string tag, bool? value) { if (value == null) { return; } - write(writer, prefix, ns, tag, (bool)value ? "true" : "false"); + Write(writer, prefix, ns, tag, (bool)value ? "true" : "false"); } - /** - * Writes an Enum tag. - */ - public static void write(XmlWriter writer, String prefix, String ns, String tag, Enum value) + /// <summary> + /// Writes an Enum tag. + /// </summary> + public static void Write(XmlWriter writer, String prefix, String ns, String tag, Enum value) { if (value == null) { return; } - write(writer, prefix, ns, tag, value.GetCmisValue()); + Write(writer, prefix, ns, tag, value.GetCmisValue()); } @@ -180,10 +179,10 @@ namespace PortCMIS.Binding.AtomPub // ---- parser --- // --------------- - /** - * Creates a new XML parser with OpenCMIS default settings. - */ - public static XmlReader createParser(Stream stream) + /// <summary> + /// Creates a new XML parser with OpenCMIS default settings. + /// </summary> + public static XmlReader CreateParser(Stream stream) { XmlReaderSettings settings = new XmlReaderSettings(); settings.MaxCharactersInDocument = 0; @@ -191,29 +190,27 @@ namespace PortCMIS.Binding.AtomPub return XmlReader.Create(stream, settings); } - /** - * Moves the parser to the next element. - */ - public static bool next(XmlReader parser) + /// <summary> + /// Moves the parser to the next element. + /// </summary> + public static bool Next(XmlReader parser) { return parser.Read(); } - /** - * Skips a tag or subtree. - */ - public static void skip(XmlReader parser) + /// <summary> + /// Skips a tag or subtree. + /// </summary> + public static void Skip(XmlReader parser) { parser.Skip(); } - /** - * Moves the parser to the next start element. - * - * @return <code>true</code> if another start element has been found, - * <code>false</code> otherwise - */ - public static bool findNextStartElemenet(XmlReader parser) + /// <summary> + /// Moves the parser to the next start element. + /// <returns><c>true</c> if another start element has been found, <c>false</c> otherwise</returns> + /// </summary> + public static bool FindNextStartElemenet(XmlReader parser) { while (true) { @@ -231,49 +228,52 @@ namespace PortCMIS.Binding.AtomPub } } - /** - * Parses a tag that contains text. - */ - public static String readText(XmlReader parser, int maxLength) + /// <summary> + /// Parses a tag that contains text. + /// </summary> + public static String ReadText(XmlReader parser, int maxLength) { StringBuilder sb = new StringBuilder(); - next(parser); - - while (true) + if (!parser.IsEmptyElement) { - XmlNodeType nodeType = parser.NodeType; - if (nodeType == XmlNodeType.EndElement) - { - break; - } - else if (nodeType == XmlNodeType.Text || nodeType == XmlNodeType.CDATA) - { - char[] buffer = new char[8 * 1024]; + Next(parser); - int len; - while ((len = parser.ReadValueChunk(buffer, 0, buffer.Length)) > 0) + while (true) + { + XmlNodeType nodeType = parser.NodeType; + if (nodeType == XmlNodeType.EndElement) { - if (sb.Length + len > maxLength) + break; + } + else if (nodeType == XmlNodeType.Text || nodeType == XmlNodeType.CDATA) + { + char[] buffer = new char[8 * 1024]; + + int len; + while ((len = parser.ReadValueChunk(buffer, 0, buffer.Length)) > 0) { - throw new CmisInvalidArgumentException("String limit exceeded!"); - } + if (sb.Length + len > maxLength) + { + throw new CmisInvalidArgumentException("String limit exceeded!"); + } - sb.Append(buffer, 0, len); + sb.Append(buffer, 0, len); + } + } + else if (nodeType == XmlNodeType.Element) + { + throw new CmisInvalidArgumentException("Unexpected tag: " + parser.Name); } - } - else if (nodeType == XmlNodeType.Element) - { - throw new CmisInvalidArgumentException("Unexpected tag: " + parser.Name); - } - if (!next(parser)) - { - break; + if (!Next(parser)) + { + break; + } } } - next(parser); + Next(parser); return sb.ToString(); }
Modified: chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlWalker.cs URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlWalker.cs?rev=1740350&r1=1740349&r2=1740350&view=diff ============================================================================== --- chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlWalker.cs (original) +++ chemistry/portcmis/trunk/PortCMIS/binding/atompub/XmlWalker.cs Thu Apr 21 16:29:04 2016 @@ -32,67 +32,69 @@ using System.Globalization; namespace PortCMIS.Binding.AtomPub { - internal abstract class XMLWalker<T> + internal abstract class XmlWalker<T> { - - public T walk(XmlReader parser) + public T Walk(XmlReader parser) { - T result = prepareTarget(parser, parser.LocalName, parser.NamespaceURI); - - XmlUtils.next(parser); + T result = PrepareTarget(parser, parser.LocalName, parser.NamespaceURI); - // walk through all tags - while (true) + if (!parser.IsEmptyElement) { - XmlNodeType nodeType = parser.NodeType; - if (nodeType == XmlNodeType.Element) + XmlUtils.Next(parser); + + // walk through all tags + while (true) { - if (!read(parser, parser.LocalName, parser.NamespaceURI, result)) + XmlNodeType nodeType = parser.NodeType; + if (nodeType == XmlNodeType.Element) { - if (result is IExtensionsData) + if (!Read(parser, parser.LocalName, parser.NamespaceURI, result)) { - handleExtension(parser, (IExtensionsData)result); - } - else - { - XmlUtils.skip(parser); + if (result is IExtensionsData) + { + HandleExtension(parser, (IExtensionsData)result); + } + else + { + XmlUtils.Skip(parser); + } } } - } - else if (nodeType == XmlNodeType.EndElement) - { - break; - } - else - { - if (!XmlUtils.next(parser)) + else if (nodeType == XmlNodeType.EndElement) { break; } + else + { + if (!XmlUtils.Next(parser)) + { + break; + } + } } } - XmlUtils.next(parser); + XmlUtils.Next(parser); return result; } - protected bool isCmisNamespace(string ns) + protected bool IsCmisNamespace(string ns) { return XmlConstants.NAMESPACE_CMIS == ns; } - protected bool isAtomNamespace(string ns) + protected bool IsAtomNamespace(string ns) { return XmlConstants.NAMESPACE_ATOM == ns; } - protected bool isTag(string name, string tag) + protected bool IsTag(string name, string tag) { return name == tag; } - protected void handleExtension(XmlReader parser, IExtensionsData extData) + protected void HandleExtension(XmlReader parser, IExtensionsData extData) { IList<ICmisExtensionElement> extensions = extData.Extensions; if (extensions == null) @@ -101,15 +103,15 @@ namespace PortCMIS.Binding.AtomPub extData.Extensions = extensions; } - if (extensions.Count + 1 > XMLConstraints.MAX_EXTENSIONS_WIDTH) + if (extensions.Count + 1 > XmlConstraints.MaxExtensionsWidth) { throw new CmisInvalidArgumentException("Too many extensions!"); } - extensions.Add(handleExtensionLevel(parser, 0)); + extensions.Add(HandleExtensionLevel(parser, 0)); } - private ICmisExtensionElement handleExtensionLevel(XmlReader parser, int level) + private ICmisExtensionElement HandleExtensionLevel(XmlReader parser, int level) { string localname = parser.Name; string ns = parser.NamespaceURI; @@ -127,7 +129,7 @@ namespace PortCMIS.Binding.AtomPub } } - XmlUtils.next(parser); + XmlUtils.Next(parser); while (true) { @@ -141,7 +143,7 @@ namespace PortCMIS.Binding.AtomPub string s = parser.Value; if (s != null) { - if (sb.Length + s.Length > XMLConstraints.MAX_STRING_LENGTH) + if (sb.Length + s.Length > XmlConstraints.MaxStringLength) { throw new CmisInvalidArgumentException("String limit exceeded!"); } @@ -150,7 +152,7 @@ namespace PortCMIS.Binding.AtomPub } else if (nodeType == XmlNodeType.Element) { - if (level + 1 > XMLConstraints.MAX_EXTENSIONS_DEPTH) + if (level + 1 > XmlConstraints.MaxExtensionsDepth) { throw new CmisInvalidArgumentException("Extensions tree too deep!"); } @@ -160,23 +162,23 @@ namespace PortCMIS.Binding.AtomPub children = new List<ICmisExtensionElement>(); } - if (children.Count + 1 > XMLConstraints.MAX_EXTENSIONS_WIDTH) + if (children.Count + 1 > XmlConstraints.MaxExtensionsWidth) { throw new CmisInvalidArgumentException("Extensions tree too wide!"); } - children.Add(handleExtensionLevel(parser, level + 1)); + children.Add(HandleExtensionLevel(parser, level + 1)); continue; } - if (!XmlUtils.next(parser)) + if (!XmlUtils.Next(parser)) { break; } } - XmlUtils.next(parser); + XmlUtils.Next(parser); CmisExtensionElement element = new CmisExtensionElement() { @@ -197,7 +199,7 @@ namespace PortCMIS.Binding.AtomPub return element; } - protected IList<S> addToList<S>(IList<S> list, S value) + protected IList<S> AddToList<S>(IList<S> list, S value) { if (list == null) { @@ -208,28 +210,31 @@ namespace PortCMIS.Binding.AtomPub return list; } - protected string readText(XmlReader parser) + protected string ReadText(XmlReader parser) { - return XmlUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH); + return XmlUtils.ReadText(parser, XmlConstraints.MaxStringLength); } - protected bool? readBoolean(XmlReader parser) + protected bool? ReadBoolean(XmlReader parser) { - parser.MoveToContent(); + string value = ReadText(parser); - try + if (value == "true" || value == "1") { - return parser.ReadContentAsBoolean(); + return true; } - catch (Exception e) + + if (value == "false" || value == "0") { - throw new CmisInvalidArgumentException("Invalid boolean value!", e); + return false; } + + throw new CmisInvalidArgumentException("Invalid boolean value!"); } - protected BigInteger readInteger(XmlReader parser) + protected BigInteger ReadInteger(XmlReader parser) { - string value = readText(parser); + string value = ReadText(parser); try { @@ -241,13 +246,13 @@ namespace PortCMIS.Binding.AtomPub } } - protected decimal readDecimal(XmlReader parser) + protected decimal ReadDecimal(XmlReader parser) { - parser.MoveToContent(); + string value = ReadText(parser); try { - return parser.ReadContentAsDecimal(); + return Decimal.Parse(value); } catch (Exception e) { @@ -255,9 +260,9 @@ namespace PortCMIS.Binding.AtomPub } } - protected DateTime readDateTime(XmlReader parser) + protected DateTime ReadDateTime(XmlReader parser) { - string value = readText(parser); + string value = ReadText(parser); DateTime result = DateTimeHelper.ParseISO8601(value); if (result == null) @@ -268,22 +273,22 @@ namespace PortCMIS.Binding.AtomPub return result; } - protected E readEnum<E>(XmlReader parser) + protected E ReadEnum<E>(XmlReader parser) { - return readText(parser).GetCmisEnum<E>(); + return ReadText(parser).GetCmisEnum<E>(); } - protected abstract T prepareTarget(XmlReader parser, string localname, string ns); + protected abstract T PrepareTarget(XmlReader parser, string localname, string ns); - protected abstract bool read(XmlReader parser, string localname, string ns, T target); + protected abstract bool Read(XmlReader parser, string localname, string ns, T target); } - internal class XMLConstraints + internal class XmlConstraints { - public const int MAX_STRING_LENGTH = 100 * 1024; + public const int MaxStringLength = 100 * 1024; - public const int MAX_EXTENSIONS_WIDTH = 500; - public const int MAX_EXTENSIONS_DEPTH = 20; + public const int MaxExtensionsWidth = 500; + public const int MaxExtensionsDepth = 20; } } \ No newline at end of file Modified: chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserBinding.cs URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserBinding.cs?rev=1740350&r1=1740349&r2=1740350&view=diff ============================================================================== --- chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserBinding.cs (original) +++ chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserBinding.cs Thu Apr 21 16:29:04 2016 @@ -41,6 +41,9 @@ using System.Threading.Tasks; namespace PortCMIS.Binding.Browser { + /// <summary> + /// Extended Repository Info for the Browser Binding. + /// </summary> public class RepositoryInfoBrowserBinding : RepositoryInfo { public string RepositoryUrl { get; set; } @@ -70,7 +73,7 @@ namespace PortCMIS.Binding.Browser this.session = session as BindingSession; if (this.session == null) { - throw new ArgumentException("Inavlid binding session!"); + throw new ArgumentException("Invalid binding session!"); } repositoryService = new RepositoryService(this.session); @@ -272,7 +275,7 @@ namespace PortCMIS.Binding.Browser if (Stream.Stream != null) { StreamContent streamContent = new StreamContent(Stream.Stream); - streamContent.Headers.ContentType = new MediaTypeHeaderValue(Stream.MimeType ?? "applictaion/octet-stream"); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(Stream.MimeType ?? "application/octet-stream"); content.Add(streamContent, "content", Stream.FileName ?? "content"); } @@ -975,9 +978,9 @@ namespace PortCMIS.Binding.Browser return repInfos; } - /** - * Retrieves a type definition. - */ + /// <summary> + /// Retrieves a type definition. + /// </summary> public ITypeDefinition GetTypeDefinitionInternal(string repositoryId, string typeId) { // build URL @@ -1149,7 +1152,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetObjectUrl(repositoryId, folderId, BindingConstants.SelectorChildren); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamOrderBy, orderBy); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamRelationships, includeRelationships); @@ -1176,7 +1179,7 @@ namespace PortCMIS.Binding.Browser // build URL UrlBuilder url = GetObjectUrl(repositoryId, folderId, BindingConstants.SelectorDecendants); url.AddParameter(BindingConstants.ParamDepth, depth); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamRelationships, includeRelationships); url.AddParameter(BindingConstants.ParamRenditionfilter, renditionFilter); @@ -1200,7 +1203,7 @@ namespace PortCMIS.Binding.Browser // build URL UrlBuilder url = GetObjectUrl(repositoryId, folderId, BindingConstants.SelectorFolderTree); url.AddParameter(BindingConstants.ParamDepth, depth); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamRelationships, includeRelationships); url.AddParameter(BindingConstants.ParamRenditionfilter, renditionFilter); @@ -1223,7 +1226,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetObjectUrl(repositoryId, objectId, BindingConstants.SelectorParents); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamRelationships, includeRelationships); url.AddParameter(BindingConstants.ParamRenditionfilter, renditionFilter); @@ -1244,7 +1247,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetObjectUrl(repositoryId, folderId, BindingConstants.SelectorParent); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamSuccinct, SuccinctParameter); url.AddParameter(BindingConstants.ParamDateTimeFormat, DateTimeFormatParameter); @@ -1264,7 +1267,7 @@ namespace PortCMIS.Binding.Browser // build URL UrlBuilder url = (folderId != null ? GetObjectUrl(repositoryId, folderId, BindingConstants.SelectorCheckedout) : GetRepositoryUrl(repositoryId, BindingConstants.SelectorCheckedout)); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamOrderBy, orderBy); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamRelationships, includeRelationships); @@ -1472,7 +1475,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetObjectUrl(repositoryId, objectId, BindingConstants.SelectorProperties); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamSuccinct, SuccinctParameter); url.AddParameter(BindingConstants.ParamDateTimeFormat, DateTimeFormatParameter); @@ -1513,7 +1516,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetObjectUrl(repositoryId, objectId, BindingConstants.SelectorObject); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamRelationships, includeRelationships); url.AddParameter(BindingConstants.ParamRenditionfilter, renditionFilter); @@ -1537,7 +1540,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetPathUrl(repositoryId, path, BindingConstants.SelectorObject); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamRelationships, includeRelationships); url.AddParameter(BindingConstants.ParamRenditionfilter, renditionFilter); @@ -1921,7 +1924,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetObjectUrl(repositoryId, objectId, BindingConstants.SelectorObject); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamRelationships, includeRelationships); url.AddParameter(BindingConstants.ParamRenditionfilter, renditionFilter); @@ -1946,7 +1949,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetObjectUrl(repositoryId, objectId, BindingConstants.SelectorProperties); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamReturnVersion, (!major ? ReturnVersion.Latest : ReturnVersion.LatestMajor)); url.AddParameter(BindingConstants.ParamSuccinct, SuccinctParameter); url.AddParameter(BindingConstants.ParamDateTimeFormat, DateTimeFormatParameter); @@ -1971,7 +1974,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetObjectUrl(repositoryId, objectId, BindingConstants.SelectorVersions); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamSuccinct, SuccinctParameter); url.AddParameter(BindingConstants.ParamDateTimeFormat, DateTimeFormatParameter); @@ -2029,7 +2032,7 @@ namespace PortCMIS.Binding.Browser UrlBuilder url = GetRepositoryUrl(repositoryId, BindingConstants.SelectorContentChanges); url.AddParameter(BindingConstants.ParamChangeLogToken, changeLogToken); url.AddParameter(BindingConstants.ParamProperties, includeProperties); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamPolicyIds, includePolicyIds); url.AddParameter(BindingConstants.ParamAcl, includeAcl); url.AddParameter(BindingConstants.ParamMaxItems, maxItems); @@ -2071,7 +2074,7 @@ namespace PortCMIS.Binding.Browser url.AddParameter(BindingConstants.ParamSubRelationshipTypes, includeSubRelationshipTypes); url.AddParameter(BindingConstants.ParamRelationshipDirection, relationshipDirection); url.AddParameter(BindingConstants.ParamTypeId, typeId); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamAllowableActions, includeAllowableActions); url.AddParameter(BindingConstants.ParamMaxItems, maxItems); url.AddParameter(BindingConstants.ParamSkipCount, skipCount); @@ -2160,7 +2163,7 @@ namespace PortCMIS.Binding.Browser { // build URL UrlBuilder url = GetObjectUrl(repositoryId, objectId, BindingConstants.SelectorPolicies); - url.AddParameter(BindingConstants.Paramfilter, filter); + url.AddParameter(BindingConstants.ParamFilter, filter); url.AddParameter(BindingConstants.ParamSuccinct, SuccinctParameter); url.AddParameter(BindingConstants.ParamDateTimeFormat, DateTimeFormatParameter); Modified: chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConverter.cs URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConverter.cs?rev=1740350&r1=1740349&r2=1740350&view=diff ============================================================================== --- chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConverter.cs (original) +++ chemistry/portcmis/trunk/PortCMIS/binding/browser/BrowserConverter.cs Thu Apr 21 16:29:04 2016 @@ -42,9 +42,9 @@ namespace PortCMIS.Binding.Browser Change } - /** - * Converts a repository info object. - */ + /// <summary> + /// Converts a repository info object. + /// </summary> internal static JsonObject Convert(IRepositoryInfo repositoryInfo, string repositoryUrl, string rootUrl, bool addExtendedDatetimeExtensionFeature) { @@ -150,9 +150,9 @@ namespace PortCMIS.Binding.Browser return jsonFeature; } - /** - * Converts a capabilities object. - */ + /// <summary> + /// Converts a capabilities object. + /// </summary> internal static JsonObject Convert(IRepositoryCapabilities capabilities) { if (capabilities == null) @@ -241,9 +241,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an Acl capabilities object. - */ + /// <summary> + /// Converts an Acl capabilities object. + /// </summary> internal static JsonObject Convert(IAclCapabilities capabilities) { if (capabilities == null) @@ -724,7 +724,7 @@ namespace PortCMIS.Binding.Browser throw new CmisRuntimeException("Invalid property type '" + id + "'! Cardinality not set!"); } - // set specfic values + // set specific values switch (propertyType) { case PropertyType.String: @@ -827,9 +827,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts choices. - */ + /// <summary> + /// Converts choices. + /// </summary> private static IList<IChoice<string>> ConvertChoicesString(JsonArray choices) { if (choices == null) @@ -874,9 +874,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts choices. - */ + /// <summary> + /// Converts choices. + /// </summary> private static IList<IChoice<bool?>> ConvertChoicesBoolean(JsonArray choices) { if (choices == null) @@ -925,9 +925,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts choices. - */ + /// <summary> + /// Converts choices. + /// </summary> private static IList<IChoice<BigInteger?>> ConvertChoicesInteger(JsonArray choices) { if (choices == null) @@ -975,9 +975,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts choices. - */ + /// <summary> + /// Converts choices. + /// </summary> private static IList<IChoice<decimal?>> ConvertChoicesDecimal(JsonArray choices) { if (choices == null) @@ -1025,9 +1025,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts choices. - */ + /// <summary> + /// Converts choices. + /// </summary> private static IList<IChoice<DateTime?>> ConvertChoicesDateTime(JsonArray choices) { if (choices == null) @@ -1075,9 +1075,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an object. - */ + /// <summary> + /// Converts an object. + /// </summary> internal static JsonObject Convert(IObjectData objectData, ITypeCache typeCache, PropertyMode propertyMode, bool succinct, DateTimeFormat dateTimeFormat) { if (objectData == null) @@ -1192,9 +1192,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a bag of properties. - */ + /// <summary> + /// Converts a bag of properties. + /// </summary> internal static JsonObject Convert(IProperties properties, string objectId, ITypeCache typeCache, PropertyMode propertyMode, bool succinct, DateTimeFormat dateTimeFormat) { if (properties == null) @@ -1247,9 +1247,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a property. - */ + /// <summary> + /// Converts a property. + /// </summary> internal static object Convert(IPropertyData property, IPropertyDefinition propDef, bool succinct, DateTimeFormat dateTimeFormat) { if (property == null) @@ -1365,9 +1365,9 @@ namespace PortCMIS.Binding.Browser } } - /** - * Converts allowable actions. - */ + /// <summary> + /// Converts allowable actions. + /// </summary> internal static JsonObject Convert(IAllowableActions allowableActions) { if (allowableActions == null) @@ -1391,9 +1391,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an Acl. - */ + /// <summary> + /// Converts an Acl. + /// </summary> internal static JsonObject Convert(IAcl acl) { if (acl == null || acl.Aces == null) @@ -1438,9 +1438,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a rendition. - */ + /// <summary> + /// Converts a rendition. + /// </summary> internal static JsonObject Convert(IRenditionData rendition) { if (rendition == null) @@ -1464,9 +1464,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a query object list. - */ + /// <summary> + /// Converts a query object list. + /// </summary> internal static JsonObject Convert(IObjectList list, ITypeCache typeCache, PropertyMode propertyMode, bool succinct, DateTimeFormat dateTimeFormat) { @@ -1506,9 +1506,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an object in a folder list. - */ + /// <summary> + /// Converts an object in a folder list. + /// </summary> internal static JsonObject Convert(IObjectInFolderData objectInFolder, ITypeCache typeCache, bool succinct, DateTimeFormat dateTimeFormat) { @@ -1526,9 +1526,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a folder list. - */ + /// <summary> + /// Converts a folder list. + /// </summary> internal static JsonObject Convert(IObjectInFolderList objectInFolderList, ITypeCache typeCache, bool succinct, DateTimeFormat dateTimeFormat) { @@ -1559,9 +1559,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a folder container. - */ + /// <summary> + /// Converts a folder container. + /// </summary> internal static JsonObject Convert(IObjectInFolderContainer container, ITypeCache typeCache, bool succinct, DateTimeFormat dateTimeFormat) { if (container == null) @@ -1588,9 +1588,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an object parent. - */ + /// <summary> + /// Converts an object parent. + /// </summary> internal static JsonObject Convert(IObjectParentData parent, ITypeCache typeCache, bool succinct, DateTimeFormat dateTimeFormat) { if ((parent == null) || (parent.Object == null)) @@ -1610,9 +1610,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a type definition. - */ + /// <summary> + /// Converts a type definition. + /// </summary> internal static JsonObject Convert(ITypeDefinition type, DateTimeFormat dateTimeFormat) { if (type == null) @@ -1680,9 +1680,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a property type definition. - */ + /// <summary> + /// Converts a property type definition. + /// </summary> internal static JsonObject Convert(IPropertyDefinition propertyDefinition, DateTimeFormat dateTimeFormat) { if (propertyDefinition == null) @@ -1809,9 +1809,9 @@ namespace PortCMIS.Binding.Browser target.Add(BrowserConstants.JsonPropertyTypeChoice, ConvertChoices(choices, cardinality, dateTimeFormat)); } - /** - * Converts choices. - */ + /// <summary> + /// Converts choices. + /// </summary> private static JsonArray ConvertChoices<T>(IList<IChoice<T>> choices, Cardinality? cardinality, DateTimeFormat dateTimeFormat) { if (choices == null) @@ -1855,9 +1855,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a type definition list. - */ + /// <summary> + /// Converts a type definition list. + /// </summary> internal static JsonObject Convert(ITypeDefinitionList list, DateTimeFormat dateTimeFormat) { if (list == null) @@ -1887,9 +1887,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a type definition list. - */ + /// <summary> + /// Converts a type definition list. + /// </summary> internal static ITypeDefinitionList ConvertTypeChildren(JsonObject json) { if (json == null) @@ -1922,9 +1922,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a type definition container. - */ + /// <summary> + /// Converts a type definition container. + /// </summary> internal static JsonObject Convert(ITypeDefinitionContainer container, DateTimeFormat dateTimeFormat) { if (container == null) @@ -1951,9 +1951,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a type definition list. - */ + /// <summary> + /// Converts a type definition list. + /// </summary> internal static IList<ITypeDefinitionContainer> ConvertTypeDescendants(JsonArray json) { if (json == null) @@ -1996,9 +1996,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an object. - */ + /// <summary> + /// Converts an object. + /// </summary> internal static IObjectData ConvertObject(JsonObject json, ITypeCache typeCache) { if (json == null) @@ -2052,9 +2052,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an object. - */ + /// <summary> + /// Converts an object. + /// </summary> internal static IList<IObjectData> ConvertObjects(List<object> json, ITypeCache typeCache) { if (json == null) @@ -2075,9 +2075,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an Acl. - */ + /// <summary> + /// Converts an Acl. + /// </summary> internal static IAcl ConvertAcl(JsonObject json) { if (json == null) @@ -2099,7 +2099,8 @@ namespace PortCMIS.Binding.Browser { Ace ace = new Ace(); - ace.IsDirect = GetBoolean(entry, BrowserConstants.JsonAceIsDirect); + bool? isDirect = GetBoolean(entry, BrowserConstants.JsonAceIsDirect); + ace.IsDirect = (isDirect != null ? (bool) isDirect : true); JsonArray jsonPermissions = GetJsonArray(entry, BrowserConstants.JsonAcePermissions); if (jsonPermissions != null) @@ -2143,9 +2144,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts allowable actions. - */ + /// <summary> + /// Converts allowable actions. + /// </summary> internal static AllowableActions ConvertAllowableActions(JsonObject json) { if (json == null) @@ -2174,9 +2175,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a list of policy ids. - */ + /// <summary> + /// Converts a list of policy ids. + /// </summary> internal static PolicyIdList ConvertPolicyIds(JsonObject json) { if (json == null) @@ -2206,9 +2207,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts properties. - */ + /// <summary> + /// Converts properties. + /// </summary> internal static IProperties ConvertProperties(JsonObject json, JsonObject extJson) { if (json == null) @@ -2302,9 +2303,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts properties. - */ + /// <summary> + /// Converts properties. + /// </summary> internal static IProperties ConvertSuccinctProperties(JsonObject json, JsonObject extJson, ITypeCache typeCache) { if (json == null) @@ -2618,9 +2619,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a rendition. - */ + /// <summary> + /// Converts a rendition. + /// </summary> internal static IRenditionData ConvertRendition(JsonObject json) { if (json == null) @@ -2644,9 +2645,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a list of renditions. - */ + /// <summary> + /// Converts a list of renditions. + /// </summary> internal static IList<IRenditionData> ConvertRenditions(List<object> json) { if (json == null) @@ -2668,9 +2669,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a object list. - */ + /// <summary> + /// Converts a object list. + /// </summary> internal static ObjectInFolderList ConvertObjectInFolderList(JsonObject json, ITypeCache typeCache) { if (json == null) @@ -2704,9 +2705,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an object in a folder. - */ + /// <summary> + /// Converts an object in a folder. + /// </summary> internal static ObjectInFolderData ConvertObjectInFolder(JsonObject json, ITypeCache typeCache) { if (json == null) @@ -2724,9 +2725,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a descendants tree. - */ + /// <summary> + /// Converts a descendants tree. + /// </summary> internal static IList<IObjectInFolderContainer> ConvertDescendants(JsonArray json, ITypeCache typeCache) { if (json == null) @@ -2748,9 +2749,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a descendant. - */ + /// <summary> + /// Converts a descendant. + /// </summary> internal static IObjectInFolderContainer ConvertDescendant(JsonObject json, ITypeCache typeCache) { if (json == null) @@ -2783,9 +2784,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts an object parents list. - */ + /// <summary> + /// Converts an object parents list. + /// </summary> internal static IList<IObjectParentData> ConvertObjectParents(JsonArray json, ITypeCache typeCache) { if (json == null) @@ -2814,9 +2815,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts a object list. - */ + /// <summary> + /// Converts a object list. + /// </summary> internal static IObjectList ConvertObjectList(JsonObject json, ITypeCache typeCache, bool isQueryResult) { if (json == null) @@ -2861,9 +2862,9 @@ namespace PortCMIS.Binding.Browser // ----------------------------------------------------------------- - /** - * Converts FailedToDelete ids. - */ + /// <summary> + /// Converts FailedToDelete ids. + /// </summary> internal static JsonObject Convert(IFailedToDeleteData ftd) { if (ftd == null) @@ -2889,9 +2890,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts FailedToDelete ids. - */ + /// <summary> + /// Converts FailedToDelete ids. + /// </summary> internal static IFailedToDeleteData ConvertFailedToDelete(JsonObject json) { if (json == null) @@ -2924,9 +2925,9 @@ namespace PortCMIS.Binding.Browser // ----------------------------------------------------------------- - /** - * Converts bulk update data. - */ + /// <summary> + /// Converts bulk update data. + /// </summary> internal static JsonObject Convert(IBulkUpdateObjectIdAndChangeToken oc) { if (oc == null) @@ -2945,9 +2946,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts bulk update data lists. - */ + /// <summary> + /// Converts bulk update data lists. + /// </summary> internal static IList<IBulkUpdateObjectIdAndChangeToken> ConvertBulkUpdate(JsonArray json) { if (json == null) @@ -2969,9 +2970,9 @@ namespace PortCMIS.Binding.Browser return result; } - /** - * Converts bulk update data. - */ + /// <summary> + /// Converts bulk update data. + /// </summary> internal static IBulkUpdateObjectIdAndChangeToken ConvertBulkUpdate(JsonObject json) { if (json == null) @@ -3277,7 +3278,7 @@ namespace PortCMIS.Binding.Browser break; } - throw new CmisRuntimeException("Unkown property type!"); + throw new CmisRuntimeException("Unknown property type!"); } internal static JsonArray GetJsonArrayFromList<T>(IList<T> list) Modified: chemistry/portcmis/trunk/PortCMIS/binding/browser/json/Json.cs URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/binding/browser/json/Json.cs?rev=1740350&r1=1740349&r2=1740350&view=diff ============================================================================== --- chemistry/portcmis/trunk/PortCMIS/binding/browser/json/Json.cs (original) +++ chemistry/portcmis/trunk/PortCMIS/binding/browser/json/Json.cs Thu Apr 21 16:29:04 2016 @@ -17,11 +17,6 @@ * under the License. */ -/** - * This JSON parser implemenation is based on - * JSON.simple <http://code.google.com/p/json-simple/>. - */ - using System; using System.Collections; using System.Collections.Generic; @@ -32,6 +27,10 @@ using System.Numerics; using System.Text; using System.Threading.Tasks; +/// <summary> +/// This JSON parser implementation is based on +/// JSON.simple <http://code.google.com/p/json-simple/>. +/// </summary> namespace PortCMIS.Binding.Browser.Json { /// <summary> @@ -681,7 +680,7 @@ namespace PortCMIS.Binding.Browser.Json sb.Append("Unexpected exception at position ").Append(Position).Append(": ").Append(UnexpectedObject); break; default: - sb.Append("Unkown error at position ").Append(Position).Append('.'); + sb.Append("Unknown error at position ").Append(Position).Append('.'); break; } return sb.ToString(); @@ -858,7 +857,7 @@ namespace PortCMIS.Binding.Browser.Json // error messages for the codes above private static readonly string[] ZZ_ERROR_MSG = { - "Unkown internal scanner error", + "Unknown internal scanner error", "Error: could not match input", "Error: pushback value was too large" }; @@ -901,10 +900,10 @@ namespace PortCMIS.Binding.Browser.Json /** the current lexical state */ private int zzLexicalState = YyInitial; - /** - * this buffer contains the current text to be matched and is the source of - * the yytext() string - */ + /// <summary> + /// this buffer contains the current text to be matched and is the source of + /// the yytext() string + /// </summary> private char[] zzBuffer = new char[ZzBufferSize]; /** the textposition at the last accepting state */ @@ -916,10 +915,9 @@ namespace PortCMIS.Binding.Browser.Json /** startRead marks the beginning of the yytext() string in the buffer */ private int zzStartRead; - /** - * endRead marks the last character in the buffer, that has been read from - * input - */ + /// <summary> + /// endRead marks the last character in the buffer, that has been read from input + /// </summary> private int zzEndRead; /** the number of characters up to the start of the matched text */ Modified: chemistry/portcmis/trunk/PortCMIS/client/ClientImpl.cs URL: http://svn.apache.org/viewvc/chemistry/portcmis/trunk/PortCMIS/client/ClientImpl.cs?rev=1740350&r1=1740349&r2=1740350&view=diff ============================================================================== --- chemistry/portcmis/trunk/PortCMIS/client/ClientImpl.cs (original) +++ chemistry/portcmis/trunk/PortCMIS/client/ClientImpl.cs Thu Apr 21 16:29:04 2016 @@ -35,10 +35,17 @@ namespace PortCMIS.Client.Impl /// </summary> public class SessionFactory : ISessionFactory { + /// <summary> + /// This is a factory. + /// </summary> private SessionFactory() { } + /// <summary> + /// Creates a new factory object. + /// </summary> + /// <returns>a factory object</returns> public static SessionFactory NewInstance() { return new SessionFactory(); @@ -172,6 +179,7 @@ namespace PortCMIS.Client.Impl this.cache = cache; } + /// <inheritdoc/> public ISession CreateSession() { return sessionFactory.CreateSession(parameters, objectFactory, authenticationProvider, cache); @@ -362,12 +370,14 @@ namespace PortCMIS.Client.Impl // types + /// <inheritdoc/> public IObjectType GetTypeDefinition(string typeId) { ITypeDefinition typeDefinition = Binding.GetRepositoryService().GetTypeDefinition(RepositoryId, typeId, null); return ObjectFactory.ConvertTypeDefinition(typeDefinition); } + /// <inheritdoc/> public IItemEnumerable<IObjectType> GetTypeChildren(string typeId, bool includePropertyDefinitions) { IRepositoryService service = Binding.GetRepositoryService(); @@ -394,6 +404,7 @@ namespace PortCMIS.Client.Impl return new CollectionEnumerable<IObjectType>(new PageFetcher<IObjectType>(DefaultContext.MaxItemsPerPage, fetchPageDelegate)); } + /// <inheritdoc/> public IList<ITree<IObjectType>> GetTypeDescendants(string typeId, int depth, bool includePropertyDefinitions) { IList<ITypeDefinitionContainer> descendants = Binding.GetRepositoryService().GetTypeDescendants( @@ -425,11 +436,13 @@ namespace PortCMIS.Client.Impl // navigation + /// <inheritdoc/> public IFolder GetRootFolder() { return GetRootFolder(DefaultContext); } + /// <inheritdoc/> public IFolder GetRootFolder(IOperationContext context) { IFolder rootFolder = GetObject(RepositoryInfo.RootFolderId, context) as IFolder; @@ -441,11 +454,13 @@ namespace PortCMIS.Client.Impl return rootFolder; } + /// <inheritdoc/> public IItemEnumerable<IDocument> GetCheckedOutDocs() { return GetCheckedOutDocs(DefaultContext); } + /// <inheritdoc/> public IItemEnumerable<IDocument> GetCheckedOutDocs(IOperationContext context) { INavigationService service = Binding.GetNavigationService(); @@ -480,11 +495,13 @@ namespace PortCMIS.Client.Impl return new CollectionEnumerable<IDocument>(new PageFetcher<IDocument>(DefaultContext.MaxItemsPerPage, fetchPageDelegate)); } + /// <inheritdoc/> public ICmisObject GetObject(IObjectId objectId) { return GetObject(objectId, DefaultContext); } + /// <inheritdoc/> public ICmisObject GetObject(IObjectId objectId, IOperationContext context) { if (objectId == null || objectId.Id == null) @@ -495,11 +512,13 @@ namespace PortCMIS.Client.Impl return GetObject(objectId.Id, context); } + /// <inheritdoc/> public ICmisObject GetObject(string objectId) { return GetObject(objectId, DefaultContext); } + /// <inheritdoc/> public ICmisObject GetObject(string objectId, IOperationContext context) { if (objectId == null) @@ -539,11 +558,13 @@ namespace PortCMIS.Client.Impl return result; } + /// <inheritdoc/> public ICmisObject GetObjectByPath(string path) { return GetObjectByPath(path, DefaultContext); } + /// <inheritdoc/> public ICmisObject GetObjectByPath(string path, IOperationContext context) { if (path == null) @@ -583,11 +604,13 @@ namespace PortCMIS.Client.Impl return result; } + /// <inheritdoc/> public ICmisObject GetObjectByPath(string parentPath, string name) { return GetObjectByPath(parentPath, name, DefaultContext); } + /// <inheritdoc/> public ICmisObject GetObjectByPath(string parentPath, string name, IOperationContext context) { if (parentPath == null || parentPath.Length < 1) @@ -614,11 +637,13 @@ namespace PortCMIS.Client.Impl return GetObjectByPath(path.ToString(), context); } + /// <inheritdoc/> public IDocument GetLatestDocumentVersion(string objectId) { return GetLatestDocumentVersion(objectId, DefaultContext); } + /// <inheritdoc/> public IDocument GetLatestDocumentVersion(string objectId, IOperationContext context) { if (objectId == null) @@ -629,16 +654,19 @@ namespace PortCMIS.Client.Impl return GetLatestDocumentVersion(CreateObjectId(objectId), false, context); } + /// <inheritdoc/> public IDocument GetLatestDocumentVersion(IObjectId objectId) { return GetLatestDocumentVersion(objectId, false, DefaultContext); } + /// <inheritdoc/> public IDocument GetLatestDocumentVersion(IObjectId objectId, IOperationContext context) { return GetLatestDocumentVersion(objectId, false, context); } + /// <inheritdoc/> public IDocument GetLatestDocumentVersion(IObjectId objectId, bool major, IOperationContext context) { if (objectId == null || objectId.Id == null) @@ -748,11 +776,13 @@ namespace PortCMIS.Client.Impl // discovery + /// <inheritdoc/> public IItemEnumerable<IQueryResult> Query(string statement, bool searchAllVersions) { return Query(statement, searchAllVersions, DefaultContext); } + /// <inheritdoc/> public IItemEnumerable<IQueryResult> Query(string statement, bool searchAllVersions, IOperationContext context) { IDiscoveryService service = Binding.GetDiscoveryService(); @@ -785,6 +815,7 @@ namespace PortCMIS.Client.Impl return new CollectionEnumerable<IQueryResult>(new PageFetcher<IQueryResult>(DefaultContext.MaxItemsPerPage, fetchPageDelegate)); } + /// <inheritdoc/> public IItemEnumerable<ICmisObject> QueryObjects(string typeId, string where, bool searchAllVersions, IOperationContext context) { if (typeId == null || typeId.Trim().Length == 0) @@ -1077,11 +1108,14 @@ namespace PortCMIS.Client.Impl } // delete + + /// <inheritdoc/> public void Delete(IObjectId objectId) { Delete(objectId, true); } + /// <inheritdoc/> public void Delete(IObjectId objectId, bool allVersions) { if (objectId == null || objectId.Id == null) @@ -1093,12 +1127,33 @@ namespace PortCMIS.Client.Impl RemoveObjectFromCache(objectId); } + /// <inheritdoc/> + public IList<string> DeleteTree(IObjectId folderId, bool allVersions, UnfileObject? unfile, bool continueOnFailure) + { + if (folderId == null || folderId.Id == null) + { + throw new ArgumentException("Invalid object ID!", "folderId"); + } + + IFailedToDeleteData failed = Binding.GetObjectService().DeleteTree(RepositoryId, folderId.Id, allVersions, unfile, continueOnFailure, null); + + if (failed == null || failed.Ids == null || failed.Ids.Count == 0) + { + RemoveObjectFromCache(folderId); + } + + return failed != null ? failed.Ids : null; + } + // content stream + + /// <inheritdoc/> public IContentStream GetContentStream(IObjectId docId) { return GetContentStream(docId, null, null, null); } + /// <inheritdoc/> public IContentStream GetContentStream(IObjectId docId, string streamId, long? offset, long? length) { if (docId == null || docId.Id == null) @@ -1201,7 +1256,7 @@ namespace PortCMIS.Client.Impl } } - public class QueryStatement : IQueryStatement + internal class QueryStatement : IQueryStatement { private ISession session; private string statement;
