chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1749154 - in /chemistry/docs/cmis-samples/trunk: ./ docs/ docs/css/ docs/samples/
Date Sun, 19 Jun 2016 11:42:59 GMT
Author: fmui
Date: Sun Jun 19 11:42:58 2016
New Revision: 1749154

URL: http://svn.apache.org/viewvc?rev=1749154&view=rev
Log:
more CMIS Samples

Added:
    chemistry/docs/cmis-samples/trunk/docs/samples/capabilities.md
    chemistry/docs/cmis-samples/trunk/docs/samples/move-objects.md
    chemistry/docs/cmis-samples/trunk/docs/samples/retrieve-objects.md
Removed:
    chemistry/docs/cmis-samples/trunk/docs/css/codehilite.css
    chemistry/docs/cmis-samples/trunk/docs/samples/retrieving-objects.md
Modified:
    chemistry/docs/cmis-samples/trunk/docs/css/chemistry.css
    chemistry/docs/cmis-samples/trunk/docs/index.md
    chemistry/docs/cmis-samples/trunk/docs/samples/access-control.md
    chemistry/docs/cmis-samples/trunk/docs/samples/changelog.md
    chemistry/docs/cmis-samples/trunk/docs/samples/content.md
    chemistry/docs/cmis-samples/trunk/docs/samples/create-objects.md
    chemistry/docs/cmis-samples/trunk/docs/samples/exceptions.md
    chemistry/docs/cmis-samples/trunk/docs/samples/operation-context.md
    chemistry/docs/cmis-samples/trunk/docs/samples/properties.md
    chemistry/docs/cmis-samples/trunk/docs/samples/queries.md
    chemistry/docs/cmis-samples/trunk/docs/samples/types.md
    chemistry/docs/cmis-samples/trunk/docs/samples/versions.md
    chemistry/docs/cmis-samples/trunk/mkdocs.yml

Modified: chemistry/docs/cmis-samples/trunk/docs/css/chemistry.css
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/css/chemistry.css?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/css/chemistry.css (original)
+++ chemistry/docs/cmis-samples/trunk/docs/css/chemistry.css Sun Jun 19 11:42:58 2016
@@ -30,6 +30,19 @@
     border-radius: 5px;    
 }
 
+.spec {
+    color: white;   
+    background-color: #008cba;
+    border-color: #0079a1;
+    font-weight: bold;
+    font-size: 0.8em;
+    padding-left: 10px;
+    padding-right: 10px;
+    border-style: solid;
+    border-width: 1px;
+    border-radius: 5px; 
+}
+
 .admonition {
     border-width: 1px;
     border-style: solid;

Modified: chemistry/docs/cmis-samples/trunk/docs/index.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/index.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/index.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/index.md Sun Jun 19 11:42:58 2016
@@ -16,6 +16,11 @@ This is a collection of code samples for
 - [Apache Chemistry OpenCMIS][opencmis] - a CMIS library for Java
 - [Apache Chemistry PortCMIS][portcmis] - a CMIS library for.Net
 
+
+!!! note "Under Development"
+    This sample collection is under development. Some areas are only sparely covered or not
covered at all, yet.
+    Also some code samples lack a meaningful description. If you want help, please see the
[about page](about/index.html).
+
 ---
 
 ## Apache Chemistry™
@@ -83,7 +88,11 @@ compile group: 'org.apache.chemistry.ope
 
 [PortCMIS][portcmis] is a CMIS client library for .Net. It is a Portable Class Library that
runs on servers, desktops, and Windows Mobile.
 
-To get started with PortCMIS, download the [PortCMIS client binaries](https://chemistry.apache.org/dotnet/portcmis.html).
You have the choice of either plain DLLs or NUPGK packages. It is also availabe on [nuget](https://www.nuget.org/packages/PortCMIS/).
+To get started with PortCMIS, download the [PortCMIS client binaries](https://chemistry.apache.org/dotnet/portcmis.html).
You have the choice of either plain DLLs or NUPGK packages. It is also availabe on [nuget](https://www.nuget.org/packages/PortCMIS/):
+
+```
+PM> Install-Package PortCMIS 
+```
 
 
 ### DotCMIS

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/access-control.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/access-control.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/access-control.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/access-control.md Sun Jun 19 11:42:58 2016
@@ -5,4 +5,14 @@
 
 ## Working with ACLs
 
-## Working with Policies
\ No newline at end of file
+<span class="spec">Spec 2.1.12</span>
+
+ 
+## Working with Policies
+
+<span class="spec">Spec 2.1.7</span>
+
+
+
+*[ACL]: Access Control List
+*[ACE]: Access Control Entry
\ No newline at end of file

Added: chemistry/docs/cmis-samples/trunk/docs/samples/capabilities.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/capabilities.md?rev=1749154&view=auto
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/capabilities.md (added)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/capabilities.md Sun Jun 19 11:42:58 2016
@@ -0,0 +1,57 @@
+# Getting Repository Capabilities
+
+<span class="cmis">CMIS 1.0</span>
+<span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.1.1</span>
+
+## Query Capability
+
+Check whether the repository supports queries or not.
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+RepositoryInfo info = session.getRepositoryInfo();
+
+CapabilityQuery capabilityQuery = info.getCapabilities().getQueryCapability(); 
+boolean supportsQuery = capabilityQuery != null && capabilityQuery != CapabilityQuery.NONE;
+```
+
+## ACL Capability
+
+Check whether the repository supports ACLs or not.
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+RepositoryInfo info = session.getRepositoryInfo();
+
+CapabilityAcl capabilityAcl = info.getCapabilities().getAclCapability();
+boolean supportsAcls = capabilityAcl != null && capabilityAcl != CapabilityAcl.NONE;
+boolean manageAcls = capabilityAcl == CapabilityAcl.MANAGE; // supports applyACL()
+```
+
+## Multi-Filing Capability
+
+Check whether the repository supports multi-filing or not.
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+RepositoryInfo info = session.getRepositoryInfo();
+
+boolean supportsMultiFiling = Boolean.TRUE.equals(info.getCapabilities().isMultifilingSupported());
+```
+
+## Unfiling Capability
+
+Check whether the repository supports unfiling or not.
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+RepositoryInfo info = session.getRepositoryInfo();
+
+boolean supportsUnfiling = Boolean.TRUE.equals(info.getCapabilities().isUnfilingSupported());
+```
+

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/changelog.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/changelog.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/changelog.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/changelog.md Sun Jun 19 11:42:58 2016
@@ -1 +1,23 @@
-# Retrieving the Change Log
\ No newline at end of file
+# Retrieving the Change Log
+
+<span class="cmis">CMIS 1.0</span>
+<span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.15</span>
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+// get the first 1000 change events
+ChangeEvents events = session.getContentChanges(null, true, 1000);
+
+if (events != null && events.getChangeEvents() != null) {
+    for (ChangeEvent event : events.getChangeEvents()) {
+        String objectId = event.getObjectId();
+        if (event.getChangeType() == ChangeType.DELETED) {
+            // handle delete
+        } else {
+            // get object and handle create, update, and security events
+        }
+    }
+}
+```
\ No newline at end of file

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/content.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/content.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/content.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/content.md Sun Jun 19 11:42:58 2016
@@ -1,5 +1,10 @@
 # Working with Content
 
+<span class="cmis">CMIS 1.0</span>
+<span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.4.2</span>
+
+
 ## Content Streams
 
 Content Stream objects are used to send and fetch content. They contain a file name, a [MIME
type](#mime-types), the stream length, and the stream.
@@ -160,7 +165,7 @@ document.SetContentStream(contentStream,
 <span class="cmis">CMIS 1.1</span>
 
 !!! warning
-    Some repositories  don't support documents without content. Check the repository capabilities
if that's the case or check the
+    Some repositories  don't support documents without content. Check the [repository capabilities](capabilities/index.html)
if that's the case or check the
     [Allowable Actions](allowable-actions/index.html) of the document.
 
 
@@ -214,6 +219,7 @@ document.AppendContentStream(contentStre
 
 <span class="cmis">CMIS 1.0</span>
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.4.2</span>
 
 Renditions are alternative versions of a document. For example, a rendition could be a PDF
of an Office document. Thumbnails are a special kind of renditions and could also exist for
non-document objects.  
 CMIS only supports server managed renditions. A CMIS client cannot upload, modify, or delete
a rendition.

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/create-objects.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/create-objects.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/create-objects.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/create-objects.md Sun Jun 19 11:42:58 2016
@@ -8,6 +8,7 @@ Depending on the object type, more prope
 
 <span class="cmis">CMIS 1.0</span>
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.5</span>
 
 A folder is always a filed object. That is, you always need a parent folder.
 
@@ -43,6 +44,7 @@ IFolder newFolder = parent.CreateFolder(
 
 <span class="cmis">CMIS 1.0</span>
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.4</span>
 
 Documents can be filed and unfiled. The following samples show how to create a filed document.
Use the session object to create an unfiled document.
 
@@ -103,10 +105,31 @@ properties[PropertyIds.ObjectTypeId] = "
 IDocument newDoc = parent.CreateDocument(properties, contentStream, VersioningState.None);
 ```
 
+### Creating a Documet from Source (Copy Content)
+
+OpenCMIS (Java)
+{: .opencmis }
+```Java
+Folder folder = ...
+Document doc = ...
+
+doc.copy(folder); // create a copy of the document in this folder
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IFolder folder = ...
+IDocument doc = ...
+
+doc.Copy(folder); // create a copy of the document in this folder
+```
+
 ## Creating a Relationship
 
 <span class="cmis">CMIS 1.0</span>
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.6</span>
 
 Relationships are always unfiled objects. The ID of the source object and the ID of the target
object must be provided.
 See the [page about types](types/index.html) how to discover relationship types and their
properties.
@@ -146,6 +169,7 @@ IObjectId newRelId = session.CreateRelat
 
 <span class="cmis">CMIS 1.0</span>
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.7</span>
 
 Policies can be filed and unfiled. The following samples show how to create a filed policy.
Use the session object to create an unfiled policy.
 
@@ -185,6 +209,7 @@ IPolicy newPolicy = parent.CreatePolicy(
 ## Creating an Item
 
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.8</span>
 
 Items can be filed and unfiled. The following samples show how to create a filed item. Use
the session object to create an unfiled item.
 

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/exceptions.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/exceptions.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/exceptions.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/exceptions.md Sun Jun 19 11:42:58 2016
@@ -1,7 +1,11 @@
 # Exceptions
 
+<span class="cmis">CMIS 1.0</span>
+<span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.2.1.4</span>
+
 Exceptions are divided into three groups: general exceptions, specific exceptions, and implementation
exceptions.  
-General exceptions and specific exceptions are defined in the CMIS specification (e.g. in
the CMIS 1.1 spec, section 2.2.1.4).
+General exceptions and specific exceptions are defined in the CMIS specification.
 Implementation exceptions are exceptions introduced by OpenCMIS and PortCMIS. Those exceptions
handle connection and authentication problems.
 
 
@@ -85,6 +89,11 @@ The operation is attempting to perform a
 
 ## Implementation Exceptions
 
+### base
+
+The OpenCMIS and PortCMIS exceptions are all derived from the CMIS base exception. If you
want handle all CMIS exceptions at once, catch the `CmisBaseException`.
+
+
 ### connection
 
 The client could not connect to the repository for some reason. Check if you need to configure
a proxy server.

Added: chemistry/docs/cmis-samples/trunk/docs/samples/move-objects.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/move-objects.md?rev=1749154&view=auto
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/move-objects.md (added)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/move-objects.md Sun Jun 19 11:42:58 2016
@@ -0,0 +1,71 @@
+# Moving Objects
+
+<span class="cmis">CMIS 1.0</span>
+<span class="cmis">CMIS 1.1</span>
+
+
+## Moving Between Folders
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+Folder sourceFolder = ...
+Folder targetFolder = ...
+Document doc = ...
+
+doc.move(sourceFolder, targetFolder);
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IFolder sourceFolder = ...
+IFolder targetFolder = ...
+IDocument doc = ...
+
+doc.Move(sourceFolder, targetFolder);
+```
+
+## Adding and Removing from Folder
+
+
+### Adding to Folder
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+Folder folder = ...
+Document doc = ...
+
+doc.addToFolder(folder, true); // add all versions to folder
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IFolder folder = ...
+IDocument doc = ...
+
+doc.AddToFolder(folder, true); // add all versions to folder
+```
+
+
+### Removing from Folder
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+Folder folder = ...
+Document doc = ...
+
+doc.removeFromFolder(folder);
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IFolder folder = ...
+IDocument doc = ...
+
+doc.RemoveFromFolder(folder);
+```
\ No newline at end of file

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/operation-context.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/operation-context.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/operation-context.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/operation-context.md Sun Jun 19 11:42:58
2016
@@ -1,13 +1,185 @@
 # Understanding the Operation Context
 
-The amount of metadata and associated information retrieved during an OpenCMIS operation
could be large, so certain OpenCMIS methods return a sensible subset of the information by
default, and provide additional methods that take an OperationContext. An OperationContext
allows you to tune the amount of information returned by setting property filters, rendition
filters, or by setting flags to include path segments, ACLs, Allowable Actions, Policies,
and Relationships. The OperationContext is also used to control paging and caching in an operation.
+The amount of metadata and associated information retrieved during an OpenCMIS or PortCMIS
operation could be large, so certain methods return a sensible subset of the information by
default, and provide additional methods that take an OperationContext. An OperationContext
allows you to tune the amount of information returned by setting property filters, rendition
filters, or by setting flags to include path segments, ACLs, Allowable Actions, Policies,
and Relationships. The OperationContext is also used to control paging and caching in an operation.
 
-## Property Filter
+### Property Filter
 
-## Caching
+<span class="spec">Spec 2.2.1.2.1</span>
 
-## Rendition Filter
+The property filter defines which properties the repository must return. Only select the
properties you really need to keep the transferred data as small as possible. The repository
may return more properties than specified.
 
+!!! note "Query Names"
+    The property filter is a collection of query names, not property IDs. The query names
and property IDs of all properties defined in the CMIS specifation are same and therefore
interchangeable. That might not be the case for custom types. 
+
+!!! note "Minimal Property Filter"
+    OpenCMIS and PortCMIS need at least the properties **cmis:objectId**, **cmis:baseTypeId**,
and **cmis:objectTypeId** to create objects.
+    The default operation context implementation adds these properties automatically if they
are missing in the property filter.
+    
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+oc.setFilterString("cmis:objectId,cmis:name,cmis:createdBy");
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = ...
+oc.FilterString = "cmis:objectId,cmis:name,cmis:createdBy";
+```
+
+
+### Allowable Actions
+
+<span class="spec">Spec 2.2.1.2.6</span>
+
+Calculating the Allowable Actions of an object can be very expensive for a repository. Don't
request them if you don't need them.
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+oc.setIncludeAllowableActions(false); // don't request Allowable Actions
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = ...
+oc.IncludeAllowableActions = false; // don't request Allowable Actions
+```
+
+
+### ACLs
+
+<span class="spec">Spec 2.2.1.2.5</span>
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+oc.setIncludeAcls(true); // request ACLs
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = ...
+oc.IncludeAcls = true; // request ACLs
+```
+
+
+### Relationships
+
+<span class="spec">Spec 2.2.1.2.2</span>
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+oc.setIncludeRelationships(IncludeRelationships.BOTH); // request source and target relationships
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = ...
+oc.IncludeRelationships = IncludeRelationships.Both; // request source and target relationships
+```
+
+
+### Policies
+
+<span class="spec">Spec 2.2.1.2.3</span>
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+oc.setIncludePolicies(true); // request policies
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = ...
+oc.IncludePolicies = true; // request policies
+```
+
+
+### Rendition Filter
+
+<span class="spec">Spec 2.2.1.2.4</span>
+
+The rendition filter defines which rendition details should be returned by the repository.
This filter is a comma separated list of rendition kinds (e.g. **cmis:thumbnail**) and MIME
types. 
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+oc.setRenditionFilterString("cmis:thumbnail,image/*");
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = ...
+oc.RenditionFilterString = "cmis:thumbnail,image/*";
+```
+
+Rendition filer examples:
+
+- `*` (include all renditions)
+- `cmis:thumbnail` (include only thumbnails)
+- `image/*` (include all image renditions)
+- `application/pdf,application/x-shockwave-flash` (include web ready renditions)
+- `cmis:none` (exclude all renditions)
+
+
+### Order By
+
+<span class="spec">Spec 2.2.1.2.7</span>
+
+The list of objects returned by `getChildren`, `getCheckedOutDocs`, and `queryObjects` can
be ordered. This is a comma separated list of query names, followed by an optional ascending
modifier "ASC" or descending modifier "DESC" for each query name. If the modifier is not stated,
"ASC" is assumed.
+
+!!! note "Query Names"
+    Similar to the property filter this is a collection of query names, not property IDs.
+
+    
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+oc.setOrderBy("cmis:createdBy DESC,cmis:name ASC");
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = ...
+oc.OrderBy("cmis:createdBy DESC,cmis:name ASC");
+```
+
+### Caching
+
+All objects retrieved by `getObject` and `getObjectByPath` are cached by default. If caching
is turned off by an Operation Context, objects are not looked up in the cache and are not
put into the cache. The methods getObject and getObjectByPath make a round-trip to the repository
and get up-to-date data.
+
+See also the section about the [object cache](retrieve-objects/index.html#understanding-the-object-cache).
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+oc.setCacheEnabled(false); // no caching please
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = ...
+oc.CacheEnabled = false; // no caching please
+```
 
 
 ## Creating Operation Context Objects

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/properties.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/properties.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/properties.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/properties.md Sun Jun 19 11:42:58 2016
@@ -21,4 +21,5 @@ CMIS Data Type | OpenCMIS (Java)
 
 ## Secondary Types
 
-<span class="cmis">CMIS 1.1</span>
\ No newline at end of file
+<span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.19</span>
\ No newline at end of file

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/queries.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/queries.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/queries.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/queries.md Sun Jun 19 11:42:58 2016
@@ -2,11 +2,12 @@
 
 <span class="cmis">CMIS 1.0</span>
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.14</span>
 
 OpenCMIS (Java)
 {: .opencmis }
 ```java
-ItemIterable<QueryResult> results = session.query("SELECTFROM cmis:document", false);
+ItemIterable<QueryResult> results = session.query("SELECT * FROM cmis:document", false);
 
 for(QueryResult hit: results) {  
     for(PropertyData<?> property: hit.getProperties()) {
@@ -20,8 +21,28 @@ for(QueryResult hit: results) {
 }
 ```
 
+## Querying Objects
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+
+// find all folders starting with 'a' or 'A'
+ItemIterable<CmisObject> results =
+    session.queryObjects("cmis:folder", "cmis:name LIKE 'a%' OR cmis:name LIKE 'A%'", false,
oc);
+
+for (CmisObject cmisObject : results) {
+    Folder folder = (Folder) cmisObject; // it can only be a folder
+    System.out.println(folder.getName());
+}
+```
+
 ## Using a Query Statement
 
+Query statements are very similar to [prepared statements](https://en.wikipedia.org/wiki/Prepared_statement).
+
+
 OpenCMIS (Java)
 {: .opencmis }
 ```java
@@ -44,5 +65,5 @@ qs.setString(8, "bob", "tom", "lisa");
 
 String statement = qs.toQueryString();
 
-ItemIterable<QueryResult> results = session.query(statement, false);
+ItemIterable<QueryResult> results = statement.query(false);
 ```
\ No newline at end of file

Added: chemistry/docs/cmis-samples/trunk/docs/samples/retrieve-objects.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/retrieve-objects.md?rev=1749154&view=auto
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/retrieve-objects.md (added)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/retrieve-objects.md Sun Jun 19 11:42:58
2016
@@ -0,0 +1,214 @@
+# Retrieving Objects
+
+<span class="cmis">CMIS 1.0</span>
+<span class="cmis">CMIS 1.1</span>
+
+
+## Getting the Root Folder
+
+All repositories have to provide a root folder. It's the entry point for [browsing](#getting-folder-children)
the repository content. The root folder might be completely empty and useless for repositories
that only support unfiled objects.
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+Folder rootFolder = session.getRootFolder();
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IFolder rootFolder = Session.GetRootFolder();
+```
+
+
+## Getting Objects by ID
+
+All objects in a repository must have a unique object ID and can be retrieved by this ID.
If the user has no permissions to see the object, an [objectNotFound](exceptions/index.html)
exception is thrown.
+
+Use an [Operation Context](operation-context/index.html) to define which details of the object
should be returned.
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+CmisObject cmisObject = session.getObject(id);
+
+if (cmisObject instanceof Document) {
+    Document document = (Document) cmisObject;
+} else if (cmisObject instanceof Folder) {
+    Folder folder = (Folder) cmisDocument;
+} else {
+    ...
+}
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+ICmisObject cmisObject = Session.GetObject(id);
+
+if (cmisObject is IDocument) {
+    IDocument document = cmisObject as IDocument;
+} else if (cmisObject is IFolder) {
+    IFolder folder = cmisDocument as IFolder;
+} else {
+    ...
+}
+```
+
+## Getting Objects by Path
+
+ A filed object has one or more paths and can be retrieved by this path. If the user has
no permissions to see the object, an [objectNotFound](exceptions/index.html) exception is
thrown.
+
+Most repositories use the **cmis:name** property of the folders and the object to assemble
the path. But it is possible that the path segments don’t match the names.
+
+Use an [Operation Context](operation-context/index.html) to define which details of the object
should be returned.
+
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+String path = "/User Homes/customer1/document.odt";
+CmisObject cmisObject = session.getObjectByPath(path);
+
+// get the object ID
+String id = cmisObject.getId();
+
+// we know it is a filable object, we just retrieved it by path
+FileableCmisObject fileableCmisObject = (FileableCmisObject) cmisObject;
+
+// get all paths, there must be at least one
+List<String> paths = fileableCmisObject.getPaths();
+
+// get all parent folders, there must be at least one
+List<Folder> parents = fileableCmisObject.getParents();
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+string path = "/User Homes/customer1/document.odt";
+ICmisObject cmisObject = Session.GetObjectByPath(path);
+
+// get the object ID
+string id = cmisObject.Id;
+
+// we know it is a filable object, we just retrieved it by path
+IFileableCmisObject fileableCmisObject = cmisObject as IFileableCmisObject;
+
+// get all paths, there must be at least one
+IList<string> paths = fileableCmisObject.Paths;
+
+// get all parent folders, there must be at least one
+IList<IFolder> parents = fileableCmisObject.Parents;
+```
+
+
+## Getting Folder Children
+
+The page about [lists](lists/index.html) explains how paging works.
+
+Use an [Operation Context](operation-context/index.html) to define which details of the objects
should be returned.
+
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+Folder folder = ...
+
+for (CmisObject child: folder.getChildren()) {
+    System.out.println(child.getName());
+}
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IFolder folder = ...
+
+foreach (ICmisObject child in folder.GetChildren()) {
+    Console.WriteLine(child.Name);
+}
+```
+
+
+## Understanding the Object Cache
+
+By default, OpenCMIS and PortCMIS cache objects. That is, the object returned by `getObject()`
or `getObjectbyPath()`
+can be stale. There are multiple ways to deal with that.
+
+### Refresh the object data that is returned from `getObject()`
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+CmisObject cmisObject = session.getObject(id);
+cmisObject.refresh(); // contacts the repository and refreshes the object
+cmisObject.refreshIfOld(60 * 1000); // ... or refreshes the object only if the data is older
than a minute
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+ICmisObject cmisObject = Session.GetObject(id);
+cmisObject.Refresh(); // contacts the repository and refreshes the object
+cmisObject.RefreshIfOld(60 * 1000); // ... or refreshes the object only if the data is older
than a minute
+```
+
+
+### Turn off the session cache completely
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+session.getDefaultContext().setCacheEnabled(false);
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+Session.DefaultContext.CacheEnabled = false;
+```
+
+
+### Turn off caching for this `getObject()` call
+
+See also the page about the [Operation Context](operation-context/index.html).
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = session.createOperationContext();
+oc.setCacheEnabled(false);
+
+CmisObject cmisObject = session.getObject(id, oc);
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = session.CreateOperationContext();
+oc.CacheEnabled = false;
+
+ICmisObject cmisObject = Session.GetObject(id, oc);
+```
+
+
+### Clear the session cache
+
+This is not recommended!
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+session.clear();
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+Session.Clear();
+```
+
+
+*[unfiled]: An object is called "unfiled" if it doesn't reside in a folder. Folders cannot
be unfiled.
+*[filed]: An object is called "filed" if it resides in one or more folders.

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/types.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/types.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/types.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/types.md Sun Jun 19 11:42:58 2016
@@ -4,6 +4,10 @@
 
 <span class="cmis">CMIS 1.0</span>
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.3</span>
+
+
+### Getting a Specific Type Definition
 
 OpenCMIS (Java)
 {: .opencmis }
@@ -35,9 +39,43 @@ if (type is IDocumentType) {
 }
 ```
 
+
+### Checking whether a Specific Type Definition Exists
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+boolean typeExists = true;
+
+try {
+    session.getTypeDefinition("my:Type");
+}
+catch (CmisObjectNotFoundException e) {
+    typeExists = false;
+}
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+bool typeExists = true;
+
+try {
+    session.GetTypeDefinition("my:Type");
+}
+catch (CmisObjectNotFoundException) {
+    typeExists = false;
+}
+```
+
+
+### Browsing Type Definitions
+
+
 ## Creating, Updating, and Deleting Types
 
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.10</span>
 
 !!! note "Reading and Writing Type Definitions"
     The class `TypeUtils` in OpenCMIS provides methods to read and write

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/versions.md
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/versions.md?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/versions.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/versions.md Sun Jun 19 11:42:58 2016
@@ -2,6 +2,7 @@
 
 <span class="cmis">CMIS 1.0</span>
 <span class="cmis">CMIS 1.1</span>
+<span class="spec">Spec 2.1.13</span>
 
 Only documents can be versioned and only if the type of the document is marked as versionable.
 

Modified: chemistry/docs/cmis-samples/trunk/mkdocs.yml
URL: http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/mkdocs.yml?rev=1749154&r1=1749153&r2=1749154&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/mkdocs.yml (original)
+++ chemistry/docs/cmis-samples/trunk/mkdocs.yml Sun Jun 19 11:42:58 2016
@@ -2,6 +2,7 @@ site_name: 'Apache Chemistry Samples'
 site_author: 'Apache Chemistry'
 theme_dir: 'cinder-chemistry'
 use_directory_urls: false
+strict: true
 markdown_extensions:
     - extra
     - smarty
@@ -14,9 +15,10 @@ pages:
     - Home: 'index.md'
     - Samples:
         - 'Creating a Session': 'samples/create-session.md'
-        - 'Retrieving Objects': 'samples/retrieving-objects.md'
+        - 'Retrieving Objects': 'samples/retrieve-objects.md'
         - 'Creating Objects': 'samples/create-objects.md'
         - 'Updating Objects': 'samples/update-objects.md'
+        - 'Moving Object': 'samples/move-objects.md'
         - 'Deleting Objects': 'samples/delete-objects.md'
         - 'Working with Content': 'samples/content.md'
         - 'Working with Versions': 'samples/versions.md'
@@ -29,5 +31,6 @@ pages:
         - 'Getting Extensions': 'samples/extensions.md'
         - 'Retrieving the Change Log': 'samples/changelog.md'
         - 'Working with Types': 'samples/types.md'
+        - 'Getting Repository Capabilities': 'samples/capabilities.md'
         - 'CMIS Exceptions': 'samples/exceptions.md'
     - About: 'about.md'
\ No newline at end of file



Mime
View raw message