Author: fmui
Date: Mon Jul 31 12:49:28 2017
New Revision: 1803530

URL: http://svn.apache.org/viewvc?rev=1803530&view=rev
Log:
code samples: added a few things

Modified:
    chemistry/docs/cmis-samples/trunk/cinder-chemistry/404.html
    chemistry/docs/cmis-samples/trunk/cinder-chemistry/base.html
    chemistry/docs/cmis-samples/trunk/cinder-chemistry/css/cinder.css
    chemistry/docs/cmis-samples/trunk/docs/index.md
    chemistry/docs/cmis-samples/trunk/docs/samples/lists.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/versions.md

Modified: chemistry/docs/cmis-samples/trunk/cinder-chemistry/404.html
URL: 
http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/cinder-chemistry/404.html?rev=1803530&r1=1803529&r2=1803530&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/cinder-chemistry/404.html (original)
+++ chemistry/docs/cmis-samples/trunk/cinder-chemistry/404.html Mon Jul 31 
12:49:28 2017
@@ -1,4 +1,4 @@
-{% extends "base.html" %}
+{% extends "main.html" %}
 
 {% block content %}
 

Modified: chemistry/docs/cmis-samples/trunk/cinder-chemistry/base.html
URL: 
http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/cinder-chemistry/base.html?rev=1803530&r1=1803529&r2=1803530&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/cinder-chemistry/base.html (original)
+++ chemistry/docs/cmis-samples/trunk/cinder-chemistry/base.html Mon Jul 31 
12:49:28 2017
@@ -24,7 +24,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">{% 
if config.site_description %}
     <meta name="description" content="{{ config.site_description }}">{% endif 
%} {% if config.site_author %}
-    <meta name="author" content="{{ config.site_author }}">{% endif %} {% if 
page.canonical_url %}
+    <meta name="author" content="{{ config.site_author }}">{% endif %}{% if 
page.canonical_url %}
     <link rel="canonical" href="{{ page.canonical_url }}">{% endif %}
     <link rel="shortcut icon" href="{{ base_url }}/img/favicon.ico">
 

Modified: chemistry/docs/cmis-samples/trunk/cinder-chemistry/css/cinder.css
URL: 
http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/cinder-chemistry/css/cinder.css?rev=1803530&r1=1803529&r2=1803530&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/cinder-chemistry/css/cinder.css (original)
+++ chemistry/docs/cmis-samples/trunk/cinder-chemistry/css/cinder.css Mon Jul 
31 12:49:28 2017
@@ -47,6 +47,9 @@ pre {
     letter-spacing: 0.0312em;
     color: #B1B7B9;
 }
+.nav {
+    font-weight: 400;
+}
 .navbar-default {
     background-color: #343838;
     border-bottom: 8px #EBF2F2 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=1803530&r1=1803529&r2=1803530&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/index.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/index.md Mon Jul 31 12:49:28 2017
@@ -53,7 +53,7 @@ To get started with OpenCMIS, download t
 
 #### Maven
 
-Replace `[OpenCMIS version]` with the latest version number, e.g. `1.0.0`.
+Replace `[OpenCMIS version]` with the latest version number, e.g. `1.1.0`.
 
 ```xml
 <dependency>
@@ -76,7 +76,7 @@ For Android:
 
 #### Gradle
 
-Replace `[OpenCMIS version]` with the latest version number, e.g. `1.0.0`.
+Replace `[OpenCMIS version]` with the latest version number, e.g. `1.1.0`.
 
 ```
 compile group: 'org.apache.chemistry.opencmis', name: 
'chemistry-opencmis-client-impl', version: '[OpenCMIS version]'

Modified: chemistry/docs/cmis-samples/trunk/docs/samples/lists.md
URL: 
http://svn.apache.org/viewvc/chemistry/docs/cmis-samples/trunk/docs/samples/lists.md?rev=1803530&r1=1803529&r2=1803530&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/lists.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/lists.md Mon Jul 31 12:49:28 
2017
@@ -2,6 +2,8 @@
 
 ## Iterating over a List
 
+The following code snippets iterate over the complete list. Please note, that 
OpenCMIS and PortCMIS may make multiple calls to the repository.
+
 OpenCMIS (Java)
 {: .opencmis }
 ```java
@@ -24,6 +26,12 @@ foreach (Something something in somethin
 
 ## Paging and Skipping
 
+Clients can request only an excerpt of a list by defining an offset and/or a 
page size.
+
+!!! note
+    For the best performance adjust the list batch size with an [Operation 
Context](operation-context/index.html#list-batch-size).
+
+
 OpenCMIS (Java)
 {: .opencmis }
 ```java

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=1803530&r1=1803529&r2=1803530&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/operation-context.md 
(original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/operation-context.md Mon Jul 
31 12:49:28 2017
@@ -161,6 +161,28 @@ IOperationContext oc = ...
 oc.OrderBy("cmis:createdBy DESC,cmis:name ASC");
 ```
 
+### List Batch Size
+
+Lists returned by, for instances, `getChildren` and `query` are requested by 
OpenCMIS and PortCMIS in batches. The default batch size is 100. If a folder 
has 1,000 children, the client will make 10 `getChildren` calls to the server 
while looping over the children.
+
+!!! note "Optimal Batch Size"
+    The optimal batch size depends on the use case. For applications that are 
using paging, the batch size should match the page size for the best 
performance. For applications that are processing all list items, the batch 
size should be as big as possible. The batch size maximum depends on the size 
of the list items (all items are loaded in main memory) and the server.
+
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+OperationContext oc = ...
+oc.setMaxItemsPerPage(10000); // 10,000 items per batch
+```
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IOperationContext oc = ...
+oc.MaxItemsPerPage = 10000; // 10,000 items per batch
+```
+
 ### 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.

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=1803530&r1=1803529&r2=1803530&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/properties.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/properties.md Mon Jul 31 
12:49:28 2017
@@ -49,7 +49,6 @@ BigInteger projectNumber = doc.getProper
 // multi value property values are always returned as lists
 List<String> colors = doc.getPropertyValue("project:colors");
 
-
 // there is detailed information about a property available for generic clients
 Property<String> nameProp = doc.getProperty("cmis:name");
 PropertyType namePropType = nameProp.getType();
@@ -247,6 +246,21 @@ properties.put("classifictaion", "public
 
 // update
 cmisObject.updateProperties(properties);
+```
+
+OpenCMIS (Java)
+{: .opencmis }
+```java
+// the convenient way...
+
+CmisObject cmisObject = ...
+
+// set secondary type property
+Map<String, Object> properties = new HashMap<String, Object>();
+properties.put("classifictaion", "public");
+
+// update with secondary type
+cmisObject.updateProperties(properties, 
Collections.singletonList("custom:classifictaion"), null);
 
 ```
 
@@ -299,6 +313,18 @@ properties.put(PropertyIds.SECONDARY_OBJ
 cmisObject.updateProperties(properties);
 ```
 
+OpenCMIS (Java)
+{: .opencmis }
+```java
+// the convenient way...
+
+CmisObject cmisObject = ...
+
+// remove secondary type
+cmisObject.updateProperties(null, null, 
Collections.singletonList("custom:classifictaion"));
+
+```
+
 PortCMIS (C#)
 {: .portcmis }
 ```csharp

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=1803530&r1=1803529&r2=1803530&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/queries.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/queries.md Mon Jul 31 
12:49:28 2017
@@ -21,6 +21,24 @@ for(QueryResult hit: results) {
 }
 ```
 
+
+PortCMIS (C#)
+{: .portcmis }
+```csharp
+IItemEnumerable<IQueryResult> results = Session.Query("SELECT * FROM 
cmis:document", false);
+
+foreach (IQueryResult hit in results) {
+    foreach (PropertyData property in hit.Properties) {
+
+        string queryName = property.QueryName;
+        object value = property.FirstValue;
+
+        Console.WriteLine(queryName + ": " + value);
+    }
+    Console.WriteLine("--------------------------------------");
+}
+```
+
 ## Querying Objects
 
 OpenCMIS (Java)
@@ -38,6 +56,7 @@ for (CmisObject cmisObject : results) {
 }
 ```
 
+
 ## Using a Query Statement
 
 Query statements are very similar to [prepared 
statements](https://en.wikipedia.org/wiki/Prepared_statement).
@@ -68,4 +87,16 @@ String statement = qs.toQueryString();
 
 // ... or execute the query directly
 ItemIterable<QueryResult> results = qs.query(false);
-```
\ No newline at end of file
+```
+
+
+## Query Performance
+
+Many aspects influence the query performance. Most of them are related to the 
server implementation and the server setup. Here are some generic hints how 
clients can influence the query performance.
+
+* Only select the properties you really need.  A query should never start with 
`SELECT *` . Some properties are more expensive than others. For instances, 
some repositories compile the `cmis:path` property on demand, which takes 
longer than returning a normal property such as `cmis:name`.
+* Do not order if it isn't required. Sorting the result set in the application 
may be faster.
+* Use an Operation context that disables 
[relationships](operation-context/index.html#relationships) 
(IncludeRelationships.NONE), 
[renditions](operation-context/index.html#rendition-filter) ("cmis:none"), and  
[allowable actions](operation-context/index.html#allowable-actions).
+* If you are using paging, use an Operation Context with a [batch size that 
matches the page size](operation-context/index.html#list-batch-size).
+* If you have to process all query results, use an Operation Context with a 
[big batch size](operation-context/index.html#list-batch-size).
+

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=1803530&r1=1803529&r2=1803530&view=diff
==============================================================================
--- chemistry/docs/cmis-samples/trunk/docs/samples/versions.md (original)
+++ chemistry/docs/cmis-samples/trunk/docs/samples/versions.md Mon Jul 31 
12:49:28 2017
@@ -28,6 +28,8 @@ The code snippets below show how to retr
 The returned list is ordered by creation date (**cmis:creationDate**). The 
newest version is on the top of the list, the first version on the bottom.
 If the version series is checked-out, a PWC exists and the user is allowed to 
see the PWC, then this PWC is the first entry in the list.
 
+Use an [Operation Context](operation-context/index.html) to define which 
details of the version objects should be returned. `getAllVersions` does not 
support paging. Only the complete version history can be requested.
+
 OpenCMIS (Java)
 {: .opencmis }
 ```java


Reply via email to