chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r918984 - in /incubator/chemistry/trunk/opencmis/opencmis-client: opencmis-client-api/src/main/java/org/apache/opencmis/client/api/ opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ opencmis-client-impl/src/main/j...
Date Thu, 04 Mar 2010 13:31:46 GMT
Author: fmui
Date: Thu Mar  4 13:31:45 2010
New Revision: 918984

URL: http://svn.apache.org/viewvc?rev=918984&view=rev
Log:
more client API and bug fixes

Added:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryProperty.java   (with props)
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryResult.java   (with props)
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryPropertyImpl.java   (with props)
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryResultImpl.java   (with props)
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RenditionImpl.java   (with props)
Modified:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Property.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Rendition.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentPropertyImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionUtil.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyDiscoverTest.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java Thu Mar  4 13:31:45 2010
@@ -128,6 +128,10 @@
       RelationshipDirection relationshipDirection, ObjectType type, OperationContext context,
       int itemsPerPage);
 
+  // renditions
+
+  List<Rendition> getRenditions();
+
   // policy service
 
   void applyPolicy(Policy policy);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Document.java Thu Mar  4 13:31:45 2010
@@ -27,8 +27,6 @@
  */
 public interface Document extends FileableCmisObject {
 
-  List<Rendition> getRenditions();
-
   // object service
 
   ContentStream getContentStream();

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Property.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Property.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Property.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Property.java Thu Mar  4 13:31:45 2010
@@ -34,24 +34,24 @@
 
   // property
 
-  public boolean isMultiValued();
+  boolean isMultiValued();
 
-  public PropertyType getType();
+  PropertyType getType();
 
-  public PropertyDefinition<T> getDefinition();
+  PropertyDefinition<T> getDefinition();
 
-  public String getId();
+  String getId();
 
-  public String getLocalName();
+  String getLocalName();
 
-  public String getDisplayName();
+  String getDisplayName();
 
-  public String getQueryName();
+  String getQueryName();
 
-  public String getValueAsString();
+  String getValueAsString();
 
-  public T getValue();
+  T getValue();
 
-  public List<T> getValues();
+  List<T> getValues();
 
 }

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryProperty.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryProperty.java?rev=918984&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryProperty.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryProperty.java Thu Mar  4 13:31:45 2010
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.api;
+
+import java.util.List;
+
+/**
+ * Query Property.
+ */
+public interface QueryProperty<T> {
+
+  String getId();
+
+  String getQueryName();
+
+  T getValue();
+
+  List<T> getValues();
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryResult.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryResult.java?rev=918984&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryResult.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryResult.java Thu Mar  4 13:31:45 2010
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.api;
+
+import java.util.List;
+
+/**
+ * Query result.
+ */
+public interface QueryResult {
+
+  List<QueryProperty<?>> getProperties();
+
+  <T> QueryProperty<T> getPropertyById(String id);
+
+  <T> QueryProperty<T> getPropertyByQueryName(String queryName);
+
+  <T> T getPropertyValueById(String id);
+
+  <T> T getPropertyValueByQueryName(String queryName);
+
+  <T> List<T> getPropertyMultivalueById(String id);
+
+  <T> List<T> getPropertyMultivalueByQueryName(String queryName);
+
+  AllowableActions getAllowableActions();
+
+  List<Relationship> getRelationships();
+
+  List<Rendition> getRenditions();
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/QueryResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Rendition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Rendition.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Rendition.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Rendition.java Thu Mar  4 13:31:45 2010
@@ -23,11 +23,9 @@
  */
 public interface Rendition {
 
-  ContentStream getContentStream();
-
   String getMimeType();
 
-  int getLength();
+  long getLength();
 
   String getKind();
 
@@ -39,4 +37,7 @@
 
   Document getRenditionDocument();
 
+  Document getRenditionDocument(OperationContext context);
+
+  ContentStream getContentStream();
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/Session.java Thu Mar  4 13:31:45 2010
@@ -152,7 +152,10 @@
   /**
    * Discovery service <code>query</code>.
    */
-  PagingList<CmisObject> query(String statement, boolean searchAllVersions, int itemsPerPage);
+  PagingList<QueryResult> query(String statement, boolean searchAllVersions, int itemsPerPage);
+
+  PagingList<QueryResult> query(String statement, boolean searchAllVersions,
+      OperationContext context, int itemsPerPage);
 
   /**
    * Discovery service <code>getContentChanges</code>.

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java Thu Mar  4 13:31:45 2010
@@ -31,6 +31,7 @@
 import org.apache.opencmis.client.api.Folder;
 import org.apache.opencmis.client.api.Policy;
 import org.apache.opencmis.client.api.Property;
+import org.apache.opencmis.client.api.QueryResult;
 import org.apache.opencmis.client.api.Relationship;
 import org.apache.opencmis.commons.enums.VersioningState;
 import org.apache.opencmis.commons.provider.ObjectData;
@@ -76,4 +77,6 @@
       List<Ace> addACEs, List<Ace> removeACEs);
 
   CmisObject convertObject(ObjectData objectData);
+
+  QueryResult convertQueryResult(ObjectData objectData);
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java Thu Mar  4 13:31:45 2010
@@ -34,7 +34,9 @@
 import org.apache.opencmis.client.api.Policy;
 import org.apache.opencmis.client.api.Property;
 import org.apache.opencmis.client.api.Relationship;
+import org.apache.opencmis.client.api.Rendition;
 import org.apache.opencmis.client.api.objecttype.ObjectType;
+import org.apache.opencmis.client.api.repository.ObjectFactory;
 import org.apache.opencmis.client.api.util.PagingList;
 import org.apache.opencmis.client.runtime.util.AbstractPagingList;
 import org.apache.opencmis.commons.PropertyIds;
@@ -48,6 +50,7 @@
 import org.apache.opencmis.commons.provider.ObjectData;
 import org.apache.opencmis.commons.provider.ObjectList;
 import org.apache.opencmis.commons.provider.RelationshipService;
+import org.apache.opencmis.commons.provider.RenditionData;
 
 /**
  * Base class for all persistent session object impl classes.
@@ -58,6 +61,7 @@
   private ObjectType objectType;
   private Map<String, Property<?>> properties;
   private AllowableActions allowableActions;
+  private List<Rendition> renditions;
   private Acl acl;
   private List<Policy> policies;
   private List<Relationship> relationships;
@@ -93,13 +97,21 @@
 
       // handle allowable actions
       if (objectData.getAllowableActions() != null) {
-        this.allowableActions = SessionUtil.convertAllowableActions(getSession(), objectData
+        this.allowableActions = SessionUtil.convertAllowableActions(session, objectData
             .getAllowableActions());
       }
 
+      // handle renditions
+      if (objectData.getRenditions() != null) {
+        this.renditions = new ArrayList<Rendition>();
+        for (RenditionData rd : objectData.getRenditions()) {
+          this.renditions.add(SessionUtil.convertRendition(session, getId(), rd));
+        }
+      }
+
       // handle ACL
       if (objectData.getAcl() != null) {
-        acl = SessionUtil.convertAcl(getSession(), objectData.getAcl());
+        acl = SessionUtil.convertAcl(session, objectData.getAcl());
       }
 
       // handle policies
@@ -116,9 +128,12 @@
       // handle relationships
       if (objectData.getRelationships() != null) {
         relationships = new ArrayList<Relationship>();
+        ObjectFactory of = session.getObjectFactory();
         for (ObjectData rod : objectData.getRelationships()) {
-          relationships.add(new PersistentRelationshipImpl(getSession(), SessionUtil
-              .getTypeFromObjectData(getSession(), rod), rod));
+          CmisObject relationship = of.convertObject(rod);
+          if (relationship instanceof Relationship) {
+            relationships.add((Relationship) relationship);
+          }
         }
       }
     }
@@ -438,6 +453,17 @@
     return this.allowableActions;
   }
 
+  // --- renditions ---
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.CmisObject#getRenditions()
+   */
+  public List<Rendition> getRenditions() {
+    return this.renditions;
+  }
+
   // --- ACL ---
 
   /*

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java Thu Mar  4 13:31:45 2010
@@ -28,7 +28,6 @@
 import org.apache.opencmis.client.api.OperationContext;
 import org.apache.opencmis.client.api.Policy;
 import org.apache.opencmis.client.api.Property;
-import org.apache.opencmis.client.api.Rendition;
 import org.apache.opencmis.client.api.objecttype.ObjectType;
 import org.apache.opencmis.client.api.repository.ObjectFactory;
 import org.apache.opencmis.commons.PropertyIds;
@@ -203,10 +202,4 @@
   public void deleteContentStream() {
     throw new CmisRuntimeException("not implemented");
   }
-
-  // renditions
-
-  public List<Rendition> getRenditions() {
-    throw new CmisRuntimeException("not implemented");
-  }
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java Thu Mar  4 13:31:45 2010
@@ -151,8 +151,7 @@
    * @seeorg.apache.opencmis.client.api.Folder#getCheckedOutDocs(org.apache.opencmis.client.api.
    * OperationContext, int)
    */
-  public PagingList<Document> getCheckedOutDocs(final OperationContext context,
-      final int itemsPerPage) {
+  public PagingList<Document> getCheckedOutDocs(OperationContext context, final int itemsPerPage) {
     if (itemsPerPage < 1) {
       throw new IllegalArgumentException("itemsPerPage must be > 0!");
     }
@@ -160,6 +159,7 @@
     final String objectId = getObjectId();
     final NavigationService nagivationService = getProvider().getNavigationService();
     final ObjectFactory objectFactory = getSession().getObjectFactory();
+    final OperationContext ctxt = new OperationContextImpl(context);
 
     return new AbstractPagingList<Document>() {
 
@@ -169,10 +169,9 @@
 
         // get checked out documents for this folder
         ObjectList checkedOutDocs = nagivationService.getCheckedOutDocs(getRepositoryId(),
-            objectId, context.getFullFilter(), context.getOrderBy(), context
-                .getIncludeAllowableActions(), context.getIncludeRelationships(), context
-                .getRenditionFilter(), BigInteger.valueOf(getMaxItemsPerPage()), BigInteger
-                .valueOf(skipCount), null);
+            objectId, ctxt.getFullFilter(), ctxt.getOrderBy(), ctxt.getIncludeAllowableActions(),
+            ctxt.getIncludeRelationships(), ctxt.getRenditionFilter(), BigInteger
+                .valueOf(getMaxItemsPerPage()), BigInteger.valueOf(skipCount), null);
 
         // convert objects
         List<Document> page = new ArrayList<Document>();
@@ -214,7 +213,7 @@
    * org.apache.opencmis.client.api.Folder#getChildren(org.apache.opencmis.client.api.OperationContext
    * , int)
    */
-  public PagingList<CmisObject> getChildren(final OperationContext context, final int itemsPerPage) {
+  public PagingList<CmisObject> getChildren(OperationContext context, final int itemsPerPage) {
     if (itemsPerPage < 1) {
       throw new IllegalArgumentException("itemsPerPage must be > 0!");
     }
@@ -222,6 +221,7 @@
     final String objectId = getObjectId();
     final NavigationService navigationService = getProvider().getNavigationService();
     final ObjectFactory objectFactory = getSession().getObjectFactory();
+    final OperationContext ctxt = new OperationContextImpl(context);
 
     return new AbstractPagingList<CmisObject>() {
 
@@ -231,8 +231,8 @@
 
         // get the children
         ObjectInFolderList children = navigationService.getChildren(getRepositoryId(), objectId,
-            context.getFullFilter(), context.getOrderBy(), context.getIncludeAllowableActions(),
-            context.getIncludeRelationships(), context.getRenditionFilter(), context
+            ctxt.getFullFilter(), ctxt.getOrderBy(), ctxt.getIncludeAllowableActions(), ctxt
+                .getIncludeRelationships(), ctxt.getRenditionFilter(), ctxt
                 .getIncludePathSegments(), BigInteger.valueOf(getMaxItemsPerPage()), BigInteger
                 .valueOf(skipCount), null);
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentPropertyImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentPropertyImpl.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentPropertyImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentPropertyImpl.java Thu Mar  4 13:31:45 2010
@@ -63,14 +63,6 @@
       throw new IllegalArgumentException("Type must be set!");
     }
 
-    if (values == null) {
-      throw new IllegalArgumentException("Values must be set!");
-    }
-
-//    if (values.isEmpty()) {
-//      throw new IllegalArgumentException("Values must not be empyt!");
-//    }
-
     this.type = type;
     this.values = values;
   }
@@ -101,14 +93,14 @@
 
   public T getValue() {
     if (this.values.size() == 0) {
-        return null;
+      return null;
     }
     return this.values.get(0);
   }
 
   public String getValueAsString() {
     if (this.values.size() == 0) {
-        return null;
+      return null;
     }
     switch (this.type.getPropertyType()) {
     default:
@@ -118,7 +110,7 @@
 
   public List<T> getValues() {
     if (this.values.size() == 0) {
-        return null;
+      return null;
     }
     return this.values;
   }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java Thu Mar  4 13:31:45 2010
@@ -36,6 +36,7 @@
 import org.apache.opencmis.client.api.OperationContext;
 import org.apache.opencmis.client.api.PersistentSession;
 import org.apache.opencmis.client.api.Property;
+import org.apache.opencmis.client.api.QueryResult;
 import org.apache.opencmis.client.api.Session;
 import org.apache.opencmis.client.api.objecttype.ObjectType;
 import org.apache.opencmis.client.api.repository.ObjectFactory;
@@ -63,6 +64,7 @@
 import org.apache.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl;
 import org.apache.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
 import org.apache.opencmis.commons.provider.CmisProvider;
+import org.apache.opencmis.commons.provider.DiscoveryService;
 import org.apache.opencmis.commons.provider.NavigationService;
 import org.apache.opencmis.commons.provider.ObjectData;
 import org.apache.opencmis.commons.provider.ObjectList;
@@ -229,14 +231,14 @@
    * @seeorg.apache.opencmis.client.api.Session#getCheckedOutDocs(org.apache.opencmis.client.api.
    * OperationContext, int)
    */
-  public PagingList<Document> getCheckedOutDocs(final OperationContext context,
-      final int itemsPerPage) {
+  public PagingList<Document> getCheckedOutDocs(OperationContext context, final int itemsPerPage) {
     if (itemsPerPage < 1) {
       throw new IllegalArgumentException("itemsPerPage must be > 0!");
     }
 
     final NavigationService nagivationService = getProvider().getNavigationService();
     final ObjectFactory objectFactory = getObjectFactory();
+    final OperationContext ctxt = new OperationContextImpl(context);
 
     return new AbstractPagingList<Document>() {
 
@@ -246,8 +248,8 @@
 
         // get all checked out documents
         ObjectList checkedOutDocs = nagivationService.getCheckedOutDocs(getRepositoryId(), null,
-            context.getFullFilter(), context.getOrderBy(), context.getIncludeAllowableActions(),
-            context.getIncludeRelationships(), context.getRenditionFilter(), BigInteger
+            ctxt.getFullFilter(), ctxt.getOrderBy(), ctxt.getIncludeAllowableActions(), ctxt
+                .getIncludeRelationships(), ctxt.getRenditionFilter(), BigInteger
                 .valueOf(getMaxItemsPerPage()), BigInteger.valueOf(skipCount), null);
 
         // convert objects
@@ -517,8 +519,57 @@
    * 
    * @see org.apache.opencmis.client.api.Session#query(java.lang.String, boolean, int)
    */
-  public PagingList<CmisObject> query(String statement, boolean searchAllVersions, int itemsPerPage) {
-    throw new CmisRuntimeException("not implemented");
+  public PagingList<QueryResult> query(final String statement, final boolean searchAllVersions,
+      final int itemsPerPage) {
+    return query(statement, searchAllVersions, getDefaultContext(), itemsPerPage);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Session#query(java.lang.String, boolean,
+   * org.apache.opencmis.client.api.OperationContext, int)
+   */
+  public PagingList<QueryResult> query(final String statement, final boolean searchAllVersions,
+      OperationContext context, final int itemsPerPage) {
+
+    final DiscoveryService discoveryService = getProvider().getDiscoveryService();
+    final ObjectFactory of = getObjectFactory();
+    final OperationContext ctxt = new OperationContextImpl(context);
+
+    // set up PagingList object
+    return new AbstractPagingList<QueryResult>() {
+
+      @Override
+      protected FetchResult fetchPage(int pageNumber) {
+        int skipCount = pageNumber * getMaxItemsPerPage();
+
+        // fetch the data
+        ObjectList resultList = discoveryService.query(getRepositoryId(), statement,
+            searchAllVersions, ctxt.getIncludeAllowableActions(), ctxt.getIncludeRelationships(),
+            ctxt.getRenditionFilter(), BigInteger.valueOf(getMaxItemsPerPage()), BigInteger
+                .valueOf(skipCount), null);
+
+        // convert type definitions
+        List<QueryResult> page = new ArrayList<QueryResult>();
+        if (resultList.getObjects() != null) {
+          for (ObjectData objectData : resultList.getObjects()) {
+            if (objectData == null) {
+              continue;
+            }
+
+            page.add(of.convertQueryResult(objectData));
+          }
+        }
+
+        return new FetchResult(page, resultList.getNumItems(), resultList.hasMoreItems());
+      }
+
+      @Override
+      public int getMaxItemsPerPage() {
+        return itemsPerPage;
+      }
+    };
   }
 
   public String setExtensionContext(String context) {

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryPropertyImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryPropertyImpl.java?rev=918984&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryPropertyImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryPropertyImpl.java Thu Mar  4 13:31:45 2010
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.opencmis.client.api.QueryProperty;
+
+/**
+ * Implementation of <code>QueryProperty</code>.
+ */
+public class QueryPropertyImpl<T> implements QueryProperty<T>, Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private String id;
+  private String queryName;
+  private List<T> values;
+
+  /**
+   * Constructor.
+   */
+  public QueryPropertyImpl(String id, String queryName, List<T> values) {
+    this.id = id;
+    this.queryName = queryName;
+    this.values = values;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryProperty#getId()
+   */
+  public String getId() {
+    return this.id;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryProperty#getQueryName()
+   */
+  public String getQueryName() {
+    return this.queryName;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryProperty#getValue()
+   */
+  public T getValue() {
+    return this.values.get(0);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryProperty#getValues()
+   */
+  public List<T> getValues() {
+    return this.values;
+  }
+
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryPropertyImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryResultImpl.java?rev=918984&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryResultImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryResultImpl.java Thu Mar  4 13:31:45 2010
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.opencmis.client.api.AllowableActions;
+import org.apache.opencmis.client.api.CmisObject;
+import org.apache.opencmis.client.api.QueryProperty;
+import org.apache.opencmis.client.api.QueryResult;
+import org.apache.opencmis.client.api.Relationship;
+import org.apache.opencmis.client.api.Rendition;
+import org.apache.opencmis.client.api.Session;
+import org.apache.opencmis.client.api.repository.ObjectFactory;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.RenditionData;
+
+/**
+ * Implementation of <code>QueryResult</code>.
+ */
+public class QueryResultImpl implements QueryResult, Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private Map<String, QueryProperty<?>> propertiesById;
+  private Map<String, QueryProperty<?>> propertiesByQueryName;
+  private AllowableActions allowableActions;
+  private List<Relationship> relationships;
+  private List<Rendition> renditions;
+
+  /**
+   * Constructor.
+   */
+  public QueryResultImpl(Session session, ObjectData objectData) {
+    if (objectData != null) {
+
+      // handle properties
+      if (objectData.getProperties() != null) {
+        propertiesById = new LinkedHashMap<String, QueryProperty<?>>();
+        propertiesByQueryName = new LinkedHashMap<String, QueryProperty<?>>();
+
+        List<QueryProperty<?>> queryProperties = SessionUtil.convertQueryProperties(session,
+            objectData.getProperties());
+
+        for (QueryProperty<?> property : queryProperties) {
+          propertiesById.put(property.getId(), property);
+          propertiesByQueryName.put(property.getQueryName(), property);
+        }
+      }
+
+      // handle allowable actions
+      if (objectData.getAllowableActions() != null) {
+        this.allowableActions = SessionUtil.convertAllowableActions(session, objectData
+            .getAllowableActions());
+      }
+
+      // handle relationships
+      if (objectData.getRelationships() != null) {
+        relationships = new ArrayList<Relationship>();
+        ObjectFactory of = session.getObjectFactory();
+        for (ObjectData rod : objectData.getRelationships()) {
+          CmisObject relationship = of.convertObject(rod);
+          if (relationship instanceof Relationship) {
+            relationships.add((Relationship) relationship);
+          }
+        }
+      }
+
+      // handle renditions
+      if (objectData.getRenditions() != null) {
+        this.renditions = new ArrayList<Rendition>();
+        for (RenditionData rd : objectData.getRenditions()) {
+          this.renditions.add(SessionUtil.convertRendition(session, null, rd));
+        }
+      }
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryResult#getProperties()
+   */
+  public List<QueryProperty<?>> getProperties() {
+    return new ArrayList<QueryProperty<?>>(propertiesById.values());
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryResult#getPropertyById(java.lang.String)
+   */
+  @SuppressWarnings("unchecked")
+  public <T> QueryProperty<T> getPropertyById(String id) {
+    return (QueryProperty<T>) propertiesById.get(id);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryResult#getPropertyByQueryName(java.lang.String)
+   */
+  @SuppressWarnings("unchecked")
+  public <T> QueryProperty<T> getPropertyByQueryName(String queryName) {
+    return (QueryProperty<T>) propertiesByQueryName.get(queryName);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryResult#getPropertyValueById(java.lang.String)
+   */
+  public <T> T getPropertyValueById(String id) {
+    QueryProperty<T> property = getPropertyById(id);
+    if (property == null) {
+      return null;
+    }
+
+    return property.getValue();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryResult#getPropertyValueByQueryName(java.lang.String)
+   */
+  public <T> T getPropertyValueByQueryName(String queryName) {
+    QueryProperty<T> property = getPropertyByQueryName(queryName);
+    if (property == null) {
+      return null;
+    }
+
+    return property.getValue();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryResult#getPropertyMultivalueById(java.lang.String)
+   */
+  public <T> List<T> getPropertyMultivalueById(String id) {
+    QueryProperty<T> property = getPropertyById(id);
+    if (property == null) {
+      return null;
+    }
+
+    return property.getValues();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.client.api.QueryResult#getPropertyMultivalueByQueryName(java.lang.String)
+   */
+  public <T> List<T> getPropertyMultivalueByQueryName(String queryName) {
+    QueryProperty<T> property = getPropertyByQueryName(queryName);
+    if (property == null) {
+      return null;
+    }
+
+    return property.getValues();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryResult#getAllowableActions()
+   */
+  public AllowableActions getAllowableActions() {
+    return allowableActions;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryResult#getRelationships()
+   */
+  public List<Relationship> getRelationships() {
+    return relationships;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.QueryResult#getRenditions()
+   */
+  public List<Rendition> getRenditions() {
+    return renditions;
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/QueryResultImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RenditionImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RenditionImpl.java?rev=918984&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RenditionImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RenditionImpl.java Thu Mar  4 13:31:45 2010
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime;
+
+import java.io.Serializable;
+
+import org.apache.opencmis.client.api.CmisObject;
+import org.apache.opencmis.client.api.ContentStream;
+import org.apache.opencmis.client.api.Document;
+import org.apache.opencmis.client.api.OperationContext;
+import org.apache.opencmis.client.api.Rendition;
+import org.apache.opencmis.client.api.Session;
+import org.apache.opencmis.commons.provider.ContentStreamData;
+
+/**
+ * Implementation of <code>Rendition</code>.
+ */
+public class RenditionImpl implements Rendition, Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private Session session;
+  private String objectId;
+  private String streamId;
+  private String renditionDocumentId;
+  private String kind;
+  private long length;
+  private String mimetype;
+  private String title;
+  private int height;
+  private int width;
+
+  /**
+   * Constructor.
+   */
+  public RenditionImpl(Session session, String objectId, String streamId,
+      String renditionDocumentId, String kind, long length, String mimetype, String title,
+      int height, int width) {
+    this.session = session;
+    this.objectId = objectId;
+    this.streamId = streamId;
+    this.renditionDocumentId = renditionDocumentId;
+    this.kind = kind;
+    this.mimetype = mimetype;
+    this.title = title;
+    this.height = height;
+    this.width = width;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Rendition#getKind()
+   */
+  public String getKind() {
+    return this.kind;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Rendition#getLength()
+   */
+  public long getLength() {
+    return this.length;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Rendition#getMimeType()
+   */
+  public String getMimeType() {
+    return this.mimetype;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Rendition#getTitle()
+   */
+  public String getTitle() {
+    return this.title;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Rendition#getHeight()
+   */
+  public int getHeight() {
+    return this.height;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Rendition#getWidth()
+   */
+  public int getWidth() {
+    return this.width;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Rendition#getRenditionDocument()
+   */
+  public Document getRenditionDocument() {
+    return getRenditionDocument(session.getDefaultContext());
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.client.api.Rendition#getRenditionDocument(org.apache.opencmis.client.api
+   * .OperationContext)
+   */
+  public Document getRenditionDocument(OperationContext context) {
+    if (this.renditionDocumentId == null) {
+      return null;
+    }
+
+    CmisObject rendDoc = session.getObject(this.renditionDocumentId, context);
+    if (!(rendDoc instanceof Document)) {
+      return null;
+    }
+
+    return (Document) rendDoc;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Rendition#getContentStream()
+   */
+  public ContentStream getContentStream() {
+    if ((objectId == null) || (streamId == null)) {
+      return null;
+    }
+
+    ContentStreamData contentStream = session.getProvider().getObjectService().getContentStream(
+        session.getRepositoryInfo().getId(), objectId, streamId, null, null, null);
+    if (contentStream == null) {
+      return null;
+    }
+
+    // TODO: what should happen if the length is not set?
+    long length = (contentStream.getLength() == null ? -1 : contentStream.getLength().longValue());
+
+    return session.getObjectFactory().createContentStream(contentStream.getFilename(), length,
+        contentStream.getMimeType(), contentStream.getStream());
+  }
+
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RenditionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionUtil.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionUtil.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionUtil.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionUtil.java Thu Mar  4 13:31:45 2010
@@ -31,6 +31,8 @@
 import org.apache.opencmis.client.api.Acl;
 import org.apache.opencmis.client.api.AllowableActions;
 import org.apache.opencmis.client.api.Property;
+import org.apache.opencmis.client.api.QueryProperty;
+import org.apache.opencmis.client.api.Rendition;
 import org.apache.opencmis.client.api.Session;
 import org.apache.opencmis.client.api.objecttype.ObjectType;
 import org.apache.opencmis.client.api.repository.ObjectFactory;
@@ -62,6 +64,7 @@
 import org.apache.opencmis.commons.provider.PropertyData;
 import org.apache.opencmis.commons.provider.PropertyIdData;
 import org.apache.opencmis.commons.provider.ProviderObjectFactory;
+import org.apache.opencmis.commons.provider.RenditionData;
 
 /**
  * Utility methods.
@@ -221,6 +224,27 @@
   }
 
   /**
+   * Converts query properties.
+   */
+  @SuppressWarnings("unchecked")
+  public static List<QueryProperty<?>> convertQueryProperties(Session session,
+      PropertiesData properties) {
+    // check input
+    if ((properties == null) || (properties.getProperties() == null)) {
+      throw new IllegalArgumentException("Properties must be set!");
+    }
+
+    // iterate through properties and convert them
+    List<QueryProperty<?>> result = new ArrayList<QueryProperty<?>>();
+    for (PropertyData<?> property : properties.getProperties().values()) {
+      result.add(new QueryPropertyImpl(property.getId(), property.getQueryName(), property
+          .getValues()));
+    }
+
+    return result;
+  }
+
+  /**
    * Converts allowable actions.
    */
   public static AllowableActions convertAllowableActions(Session session,
@@ -274,6 +298,24 @@
   }
 
   /**
+   * Converts rendition.
+   */
+  public static Rendition convertRendition(Session session, String objectId, RenditionData rendition) {
+    if (rendition == null) {
+      throw new IllegalArgumentException("Rendition must be set!");
+    }
+
+    // TODO: what should happen if the length is not set?
+    long length = (rendition.getLength() == null ? -1 : rendition.getLength().longValue());
+    int height = (rendition.getHeight() == null ? -1 : rendition.getHeight().intValue());
+    int width = (rendition.getWidth() == null ? -1 : rendition.getWidth().intValue());
+
+    return new RenditionImpl(session, objectId, rendition.getStreamId(), rendition
+        .getRenditionDocumentId(), rendition.getKind(), length, rendition.getMimeType(), rendition
+        .getTitle(), height, width);
+  }
+
+  /**
    * Extracts the type information from the given object data and returns the object type or
    * <code>null</code> if there is no type information.
    */

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java Thu Mar  4 13:31:45 2010
@@ -31,6 +31,7 @@
 import org.apache.opencmis.client.api.Folder;
 import org.apache.opencmis.client.api.Policy;
 import org.apache.opencmis.client.api.Property;
+import org.apache.opencmis.client.api.QueryResult;
 import org.apache.opencmis.client.api.Relationship;
 import org.apache.opencmis.client.api.objecttype.ObjectType;
 import org.apache.opencmis.client.api.repository.ObjectFactory;
@@ -43,6 +44,7 @@
 import org.apache.opencmis.client.runtime.PersistentPolicyImpl;
 import org.apache.opencmis.client.runtime.PersistentRelationshipImpl;
 import org.apache.opencmis.client.runtime.PersistentSessionImpl;
+import org.apache.opencmis.client.runtime.QueryResultImpl;
 import org.apache.opencmis.client.runtime.SessionUtil;
 import org.apache.opencmis.commons.enums.VersioningState;
 import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
@@ -139,4 +141,12 @@
       throw new CmisRuntimeException("unsupported type: " + objectData.getBaseTypeId());
     }
   }
+
+  public QueryResult convertQueryResult(ObjectData objectData) {
+    if (objectData == null) {
+      throw new IllegalArgumentException("Object data is null!");
+    }
+
+    return new QueryResultImpl(session, objectData);
+  }
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyDiscoverTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyDiscoverTest.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyDiscoverTest.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyDiscoverTest.java Thu Mar  4 13:31:45 2010
@@ -27,6 +27,7 @@
 import org.apache.opencmis.client.api.ChangeEvent;
 import org.apache.opencmis.client.api.CmisObject;
 import org.apache.opencmis.client.api.Property;
+import org.apache.opencmis.client.api.QueryResult;
 import org.apache.opencmis.client.api.util.PagingList;
 import org.apache.opencmis.commons.enums.CapabilityChanges;
 import org.apache.opencmis.commons.enums.CapabilityQuery;
@@ -46,11 +47,11 @@
       ReadOnlyDiscoverTest.log.info("queries not supported");
       break;
     default:
-      PagingList<CmisObject> resultSet = this.session.query(Fixture.QUERY, false, -1);
+      PagingList<QueryResult> resultSet = this.session.query(Fixture.QUERY, false, -1);
       Assert.assertNotNull(resultSet);
       //Assert.assertFalse(resultSet.isEmpty());
-      for (List<CmisObject> lo : resultSet) {
-        for (CmisObject o : lo) {
+      for (List<QueryResult> lo : resultSet) {
+        for (QueryResult o : lo) {
           Assert.assertNotNull(o);
         }
       }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java?rev=918984&r1=918983&r2=918984&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java Thu Mar  4 13:31:45 2010
@@ -44,6 +44,8 @@
 import org.apache.opencmis.client.api.Folder;
 import org.apache.opencmis.client.api.OperationContext;
 import org.apache.opencmis.client.api.Property;
+import org.apache.opencmis.client.api.QueryProperty;
+import org.apache.opencmis.client.api.QueryResult;
 import org.apache.opencmis.client.api.Session;
 import org.apache.opencmis.client.api.SessionFactory;
 import org.apache.opencmis.client.api.objecttype.DocumentType;
@@ -185,9 +187,11 @@
 		expect(session.getContentChanges(null, -1)).andReturn(plce).anyTimes();
 
 		/* query support */
-		List<CmisObject> queryList = new ArrayList<CmisObject>(
-				this.idObjectIndex.values());
-		PagingList<CmisObject> plq = this.createMockPaging(queryList);
+		List<QueryResult> queryList = new ArrayList<QueryResult>();
+		for(CmisObject cm :this.idObjectIndex.values()) {
+		  queryList.add(createMockQueryResult(cm));
+		}
+		PagingList<QueryResult> plq = this.createMockPaging(queryList);
 		expect(session.query(Fixture.QUERY, false, -1)).andReturn(plq)
 				.anyTimes();
 
@@ -553,6 +557,13 @@
 		return f;
 	}
 
+	private QueryResult createMockQueryResult(CmisObject cmisObject) {
+	  QueryResult qr = createNiceMock(QueryResult.class);
+  
+	  return qr;
+	}
+	
+	
 	@SuppressWarnings( { "unchecked" })
 	private <T> PagingList<T> createMockPaging(List<T> items) {
 		PagingList<T> pl = createNiceMock(PagingList.class);



Mime
View raw message