chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1003879 - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/ap...
Date Sat, 02 Oct 2010 20:41:25 GMT
Author: fmui
Date: Sat Oct  2 20:41:24 2010
New Revision: 1003879

URL: http://svn.apache.org/viewvc?rev=1003879&view=rev
Log:
- added change log support to client API
- some code clean up

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvents.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventsImpl.java
  (with props)
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvent.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ChangeEventInfoDataImpl.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvent.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvent.java?rev=1003879&r1=1003878&r2=1003879&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvent.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvent.java
Sat Oct  2 20:41:24 2010
@@ -19,31 +19,33 @@
 package org.apache.chemistry.opencmis.client.api;
 
 import java.util.List;
+import java.util.Map;
 
+import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.ChangeEventInfo;
 
 /**
  * Change Event from the change log.
- * 
- * @see Session#getContentChanges(String, StringBuffer)
- * 
- *      See CMIS Domain Model - section 2.1.11.
  */
 public interface ChangeEvent extends ChangeEventInfo {
 
     /**
      * Gets the id of the object.
-     * 
-     * @return the object ID
      */
     String getObjectId();
 
     /**
-     * For change events with change type "updated": The list of properties now
-     * applied to the object.
-     * 
-     * @return the list with the new properties, might be {@code null}
+     * Returns the properties.
      */
-    List<Property<?>> getNewProperties();
+    Map<String, List<?>> getProperties();
 
-}
+    /**
+     * Returns the policy ids.
+     */
+    List<String> getPolicyIds();
+
+    /**
+     * Returns the ACL.
+     */
+    Acl getAcl();
+}
\ No newline at end of file

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvents.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvents.java?rev=1003879&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvents.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ChangeEvents.java
Sat Oct  2 20:41:24 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.chemistry.opencmis.client.api;
+
+import java.util.List;
+
+public interface ChangeEvents {
+
+    String getlatestChangeLogToken();
+
+    List<ChangeEvent> getChangeEvents();
+
+    boolean getHasMoreItems();
+    
+    long getTotalNumItems();
+}

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

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java?rev=1003879&r1=1003878&r2=1003879&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java
Sat Oct  2 20:41:24 2010
@@ -27,6 +27,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.data.ObjectList;
 import org.apache.chemistry.opencmis.commons.data.Properties;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.data.RenditionData;
@@ -46,9 +47,9 @@ public interface ObjectFactory {
     Acl convertAces(List<Ace> aces);
 
     Acl createAcl(List<Ace> aces);
-    
+
     Ace createAce(String principal, List<String> permissions);
-    
+
     // policies
 
     List<String> convertPolicies(List<Policy> policies);
@@ -86,4 +87,8 @@ public interface ObjectFactory {
     CmisObject convertObject(ObjectData objectData, OperationContext context);
 
     QueryResult convertQueryResult(ObjectData objectData);
+
+    ChangeEvent convertChangeEvent(ObjectData objectData);
+
+    ChangeEvents convertChangeEvents(String changeLogToken, ObjectList objectList);
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java?rev=1003879&r1=1003878&r2=1003879&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
Sat Oct  2 20:41:24 2010
@@ -262,9 +262,33 @@ public interface Session {
     ItemIterable<QueryResult> query(String statement, boolean searchAllVersions, OperationContext
context);
 
     /**
-     * Returns the content changes. (See CMIS spec "2.1.11 Change Log".)
+     * Returns the content changes.
+     * 
+     * @param changeLogToken
+     *            the change log token to start from or <code>null</code>
+     * @param includeProperties
+     *            indicates if changed properties should be included in the
+     *            result
+     * @param maxNumItems
+     *            maximum numbers of events
+     */
+    ChangeEvents getContentChanges(String changeLogToken, boolean includeProperties, long
maxNumItems);
+
+    /**
+     * Returns the content changes.
+     * 
+     * @param changeLogToken
+     *            the change log token to start from or <code>null</code>
+     * @param includeProperties
+     *            indicates if changed properties should be included in the
+     *            result
+     * @param maxNumItems
+     *            maximum numbers of events
+     * @param context
+     *            the OperationContext
      */
-    ItemIterable<ChangeEvent> getContentChanges(String changeLogToken);
+    ChangeEvents getContentChanges(String changeLogToken, boolean includeProperties, long
maxNumItems,
+            OperationContext context);
 
     // create
 

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java?rev=1003879&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java
Sat Oct  2 20:41:24 2010
@@ -0,0 +1,84 @@
+/*
+ * 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.chemistry.opencmis.client.runtime;
+
+import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.api.ChangeEvent;
+import org.apache.chemistry.opencmis.commons.data.Acl;
+import org.apache.chemistry.opencmis.commons.enums.ChangeType;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChangeEventInfoDataImpl;
+
+/**
+ * Change Event.
+ */
+public class ChangeEventImpl extends ChangeEventInfoDataImpl implements ChangeEvent {
+
+    private String objectId;
+    private Map<String, List<?>> properties;
+    private List<String> policyIds;
+    private Acl acl;
+
+    public ChangeEventImpl() {
+    }
+
+    public ChangeEventImpl(ChangeType changeType, GregorianCalendar changeTime, String objectId,
+            Map<String, List<?>> properties, List<String> policyIds, Acl
acl) {
+        setChangeType(changeType);
+        setChangeTime(changeTime);
+        setObjectId(objectId);
+        setProperties(properties);
+        setPolicyIds(policyIds);
+        setAcl(acl);
+    }
+
+    public String getObjectId() {
+        return objectId;
+    }
+
+    public void setObjectId(String objectId) {
+        this.objectId = objectId;
+    }
+
+    public Map<String, List<?>> getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Map<String, List<?>> properties) {
+        this.properties = properties;
+    }
+
+    public List<String> getPolicyIds() {
+        return policyIds;
+    }
+
+    public void setPolicyIds(List<String> policyIds) {
+        this.policyIds = policyIds;
+    }
+
+    public Acl getAcl() {
+        return acl;
+    }
+
+    public void setAcl(Acl acl) {
+        this.acl = acl;
+    }
+}

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

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventsImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventsImpl.java?rev=1003879&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventsImpl.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventsImpl.java
Sat Oct  2 20:41:24 2010
@@ -0,0 +1,75 @@
+/*
+ * 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.chemistry.opencmis.client.runtime;
+
+import java.util.List;
+
+import org.apache.chemistry.opencmis.client.api.ChangeEvent;
+import org.apache.chemistry.opencmis.client.api.ChangeEvents;
+
+public class ChangeEventsImpl implements ChangeEvents {
+
+    private String latestChangeLogToken = null;
+    private List<ChangeEvent> events = null;
+    private boolean hasMoreItems = false;
+    private long totalNumItems = -1;
+
+    public ChangeEventsImpl() {
+    }
+
+    public ChangeEventsImpl(String latestChangeLogToken, List<ChangeEvent> events,
boolean hasMoreItems,
+            long totalNumItems) {
+        setlatestChangeLogToken(latestChangeLogToken);
+        setChangeEvents(events);
+        setHasMoreItems(hasMoreItems);
+        setTotalNumItems(totalNumItems);
+    }
+
+    public String getlatestChangeLogToken() {
+        return latestChangeLogToken;
+    }
+
+    public void setlatestChangeLogToken(String latestChangeLogToken) {
+        this.latestChangeLogToken = latestChangeLogToken;
+    }
+
+    public List<ChangeEvent> getChangeEvents() {
+        return events;
+    }
+
+    public void setChangeEvents(List<ChangeEvent> events) {
+        this.events = events;
+    }
+
+    public boolean getHasMoreItems() {
+        return hasMoreItems;
+    }
+
+    public void setHasMoreItems(boolean hasMoreItems) {
+        this.hasMoreItems = hasMoreItems;
+    }
+
+    public void setTotalNumItems(long totalNumItems) {
+        this.totalNumItems = totalNumItems;
+    }
+
+    public long getTotalNumItems() {
+        return totalNumItems;
+    }
+}

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

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java?rev=1003879&r1=1003878&r2=1003879&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java
Sat Oct  2 20:41:24 2010
@@ -28,7 +28,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-import org.apache.chemistry.opencmis.client.api.ChangeEvent;
+import org.apache.chemistry.opencmis.client.api.ChangeEvents;
 import org.apache.chemistry.opencmis.client.api.CmisObject;
 import org.apache.chemistry.opencmis.client.api.Document;
 import org.apache.chemistry.opencmis.client.api.ExtensionHandler;
@@ -64,6 +64,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
 import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
+import org.apache.chemistry.opencmis.commons.spi.Holder;
 import org.apache.chemistry.opencmis.commons.spi.NavigationService;
 import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
 import org.apache.commons.logging.Log;
@@ -234,10 +235,10 @@ public class PersistentSessionImpl imple
             protected AbstractPageFetch.PageFetchResult<Document> fetchPage(long skipCount)
{
 
                 // get all checked out documents
-                ObjectList checkedOutDocs = navigationService.getCheckedOutDocs(getRepositoryId(),
null, ctxt
-                        .getFilterString(), ctxt.getOrderBy(), ctxt.isIncludeAllowableActions(),
ctxt
-                        .getIncludeRelationships(), ctxt.getRenditionFilterString(), BigInteger
-                        .valueOf(this.maxNumItems), BigInteger.valueOf(skipCount), null);
+                ObjectList checkedOutDocs = navigationService.getCheckedOutDocs(getRepositoryId(),
null,
+                        ctxt.getFilterString(), ctxt.getOrderBy(), ctxt.isIncludeAllowableActions(),
+                        ctxt.getIncludeRelationships(), ctxt.getRenditionFilterString(),
+                        BigInteger.valueOf(this.maxNumItems), BigInteger.valueOf(skipCount),
null);
 
                 // convert objects
                 List<Document> page = new ArrayList<Document>();
@@ -259,8 +260,24 @@ public class PersistentSessionImpl imple
         });
     }
 
-    public ItemIterable<ChangeEvent> getContentChanges(String changeLogToken) {
-        throw new CmisRuntimeException("not implemented");
+    public ChangeEvents getContentChanges(String changeLogToken, boolean includeProperties,
long maxNumItems) {
+        return getContentChanges(changeLogToken, includeProperties, maxNumItems, getDefaultContext());
+    }
+
+    public ChangeEvents getContentChanges(String changeLogToken, boolean includeProperties,
long maxNumItems,
+            OperationContext context) {
+        fLock.readLock().lock();
+        try {
+            Holder<String> changeLogTokenHolder = new Holder<String>(changeLogToken);
+
+            ObjectList objectList = getBinding().getDiscoveryService().getContentChanges(getRepositoryInfo().getId(),
+                    changeLogTokenHolder, includeProperties, context.getFilterString(), context.isIncludePolicies(),
+                    context.isIncludeAcls(), BigInteger.valueOf(maxNumItems), null);
+
+            return objectFactory.convertChangeEvents(changeLogTokenHolder.getValue(), objectList);
+        } finally {
+            fLock.readLock().unlock();
+        }
     }
 
     public OperationContext getDefaultContext() {
@@ -411,8 +428,8 @@ public class PersistentSessionImpl imple
 
                 // fetch the data
                 TypeDefinitionList tdl = repositoryService.getTypeChildren(
-                        PersistentSessionImpl.this.getRepositoryId(), typeId, includePropertyDefinitions,
BigInteger
-                                .valueOf(this.maxNumItems), BigInteger.valueOf(skipCount),
null);
+                        PersistentSessionImpl.this.getRepositoryId(), typeId, includePropertyDefinitions,
+                        BigInteger.valueOf(this.maxNumItems), BigInteger.valueOf(skipCount),
null);
 
                 // convert type definitions
                 List<ObjectType> page = new ArrayList<ObjectType>(tdl.getList().size());
@@ -473,9 +490,10 @@ public class PersistentSessionImpl imple
             protected AbstractPageFetch.PageFetchResult<QueryResult> fetchPage(long
skipCount) {
 
                 // fetch the data
-                ObjectList resultList = discoveryService.query(getRepositoryId(), statement,
searchAllVersions, ctxt
-                        .isIncludeAllowableActions(), ctxt.getIncludeRelationships(), ctxt.getRenditionFilterString(),
-                        BigInteger.valueOf(this.maxNumItems), BigInteger.valueOf(skipCount),
null);
+                ObjectList resultList = discoveryService.query(getRepositoryId(), statement,
searchAllVersions,
+                        ctxt.isIncludeAllowableActions(), ctxt.getIncludeRelationships(),
+                        ctxt.getRenditionFilterString(), BigInteger.valueOf(this.maxNumItems),
+                        BigInteger.valueOf(skipCount), null);
 
                 // convert type definitions
                 List<QueryResult> page = new ArrayList<QueryResult>();
@@ -489,8 +507,8 @@ public class PersistentSessionImpl imple
                     }
                 }
 
-                return new AbstractPageFetch.PageFetchResult<QueryResult>(page, resultList.getNumItems(),
resultList
-                        .hasMoreItems());
+                return new AbstractPageFetch.PageFetchResult<QueryResult>(page, resultList.getNumItems(),
+                        resultList.hasMoreItems());
             }
         });
 
@@ -508,8 +526,8 @@ public class PersistentSessionImpl imple
      * Connect session object to the provider. This is the very first call after
      * a session is created.
      * <p>
-     * In dependency of the parameter set an {@code AtomPub}, a {@code
-     * WebService} or an {@code InMemory} provider is selected.
+     * In dependency of the parameter set an {@code AtomPub}, a
+     * {@code WebService} or an {@code InMemory} provider is selected.
      */
     public void connect() {
         fLock.writeLock().lock();

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java?rev=1003879&r1=1003878&r2=1003879&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java
Sat Oct  2 20:41:24 2010
@@ -25,11 +25,14 @@ import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.GregorianCalendar;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.chemistry.opencmis.client.api.ChangeEvent;
+import org.apache.chemistry.opencmis.client.api.ChangeEvents;
 import org.apache.chemistry.opencmis.client.api.CmisObject;
 import org.apache.chemistry.opencmis.client.api.ObjectFactory;
 import org.apache.chemistry.opencmis.client.api.ObjectType;
@@ -38,6 +41,8 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.Property;
 import org.apache.chemistry.opencmis.client.api.QueryResult;
 import org.apache.chemistry.opencmis.client.api.Rendition;
+import org.apache.chemistry.opencmis.client.runtime.ChangeEventImpl;
+import org.apache.chemistry.opencmis.client.runtime.ChangeEventsImpl;
 import org.apache.chemistry.opencmis.client.runtime.PersistentDocumentImpl;
 import org.apache.chemistry.opencmis.client.runtime.PersistentFolderImpl;
 import org.apache.chemistry.opencmis.client.runtime.PersistentPolicyImpl;
@@ -55,6 +60,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.data.ObjectList;
 import org.apache.chemistry.opencmis.commons.data.Properties;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.data.PropertyId;
@@ -74,6 +80,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.Cardinality;
+import org.apache.chemistry.opencmis.commons.enums.ChangeType;
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
@@ -115,13 +122,6 @@ public class PersistentObjectFactoryImpl
 
     // ACL and ACE
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#convertAces(java
-     * .util.List)
-     */
     public Acl convertAces(List<Ace> aces) {
         if (aces == null) {
             return null;
@@ -155,13 +155,6 @@ public class PersistentObjectFactoryImpl
 
     // policies
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#convertPolicies
-     * (java.util.List)
-     */
     public List<String> convertPolicies(List<Policy> policies) {
         if (policies == null) {
             return null;
@@ -180,13 +173,6 @@ public class PersistentObjectFactoryImpl
 
     // renditions
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#convertRendition
-     * (java.lang.String, org.apache.opencmis.commons.provider.RenditionData)
-     */
     public Rendition convertRendition(String objectId, RenditionData rendition) {
         if (rendition == null) {
             throw new IllegalArgumentException("Rendition must be set!");
@@ -203,24 +189,10 @@ public class PersistentObjectFactoryImpl
 
     // content stream
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#createContentStream
-     * (java.lang.String, long, java.lang.String, java.io.InputStream)
-     */
     public ContentStream createContentStream(String filename, long length, String mimetype,
InputStream stream) {
         return new ContentStreamImpl(filename, BigInteger.valueOf(length), mimetype, stream);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#convertContentStream
-     * (org.apache.opencmis .client.api.ContentStream)
-     */
     public ContentStream convertContentStream(ContentStream contentStream) {
         if (contentStream == null) {
             return null;
@@ -234,13 +206,6 @@ public class PersistentObjectFactoryImpl
 
     // types
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#convertTypeDefinition
-     * (org.apache.opencmis .commons.api.TypeDefinition)
-     */
     public ObjectType convertTypeDefinition(TypeDefinition typeDefinition) {
         if (typeDefinition instanceof DocumentTypeDefinition) {
             return new DocumentTypeImpl(this.session, (DocumentTypeDefinition) typeDefinition);
@@ -255,13 +220,6 @@ public class PersistentObjectFactoryImpl
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#getTypeFromObjectData
-     * (org.apache.opencmis .commons.provider.ObjectData)
-     */
     public ObjectType getTypeFromObjectData(ObjectData objectData) {
         if ((objectData == null) || (objectData.getProperties() == null)
                 || (objectData.getProperties().getProperties() == null)) {
@@ -278,36 +236,14 @@ public class PersistentObjectFactoryImpl
 
     // properties
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#createProperty
-     * (org.apache.opencmis. commons.api.PropertyDefinition, java.lang.Object)
-     */
     public <T> Property<T> createProperty(PropertyDefinition<?> type, T
value) {
         return new PersistentPropertyImpl<T>(type, value);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.opencmis.client.api.repository.ObjectFactory#
-     * createPropertyMultivalue(org.apache
-     * .opencmis.commons.api.PropertyDefinition, java.util.List)
-     */
     public <T> Property<T> createPropertyMultivalue(PropertyDefinition<?>
type, List<T> values) {
         return new PersistentPropertyImpl<T>(type, values);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#convertProperties
-     * (org.apache.opencmis .client.api.objecttype.ObjectType,
-     * org.apache.opencmis.commons.provider.PropertiesData)
-     */
     @SuppressWarnings("unchecked")
     public Map<String, Property<?>> convertProperties(ObjectType objectType,
Properties properties) {
         // check input
@@ -367,14 +303,6 @@ public class PersistentObjectFactoryImpl
         return result;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#convertProperties
-     * (java.util.Map, org.apache.opencmis.client.api.objecttype.ObjectType,
-     * java.util.Set)
-     */
     @SuppressWarnings("unchecked")
     public Properties convertProperties(Map<String, ?> properties, ObjectType type,
Set<Updatability> updatabilityFilter) {
         // check input
@@ -548,13 +476,6 @@ public class PersistentObjectFactoryImpl
         return bof.createPropertiesData(propertyList);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.opencmis.client.api.repository.ObjectFactory#
-     * convertQueryProperties(org.apache.opencmis
-     * .commons.provider.PropertiesData)
-     */
     public List<PropertyData<?>> convertQueryProperties(Properties properties)
{
         // check input
         if ((properties == null) || (properties.getProperties() == null)) {
@@ -565,14 +486,6 @@ public class PersistentObjectFactoryImpl
 
     // objects
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#convertObject
-     * (org.apache.opencmis.commons .provider.ObjectData,
-     * org.apache.opencmis.client.api.OperationContext)
-     */
     public CmisObject convertObject(ObjectData objectData, OperationContext context) {
         if (objectData == null) {
             throw new IllegalArgumentException("Object data is null!");
@@ -595,13 +508,6 @@ public class PersistentObjectFactoryImpl
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.api.repository.ObjectFactory#convertQueryResult
-     * (org.apache.opencmis .commons.provider.ObjectData)
-     */
     public QueryResult convertQueryResult(ObjectData objectData) {
         if (objectData == null) {
             throw new IllegalArgumentException("Object data is null!");
@@ -610,4 +516,64 @@ public class PersistentObjectFactoryImpl
         return new QueryResultImpl(session, objectData);
     }
 
+    public ChangeEvent convertChangeEvent(ObjectData objectData) {
+        ChangeType changeType = null;
+        GregorianCalendar changeTime = null;
+        String objectId = null;
+        Map<String, List<?>> properties = null;
+        List<String> policyIds = null;
+        Acl acl = null;
+
+        if (objectData.getChangeEventInfo() != null) {
+            changeType = objectData.getChangeEventInfo().getChangeType();
+            changeTime = objectData.getChangeEventInfo().getChangeTime();
+        }
+
+        if ((objectData.getProperties() != null) && (objectData.getProperties().getPropertyList()
!= null)) {
+            properties = new HashMap<String, List<?>>();
+
+            for (PropertyData<?> property : objectData.getProperties().getPropertyList())
{
+                properties.put(property.getId(), property.getValues());
+            }
+
+            if (properties.containsKey(PropertyIds.OBJECT_ID)) {
+                List<?> objectIdList = properties.get(PropertyIds.OBJECT_ID);
+                if ((objectIdList != null) && (!objectIdList.isEmpty()))
+                    objectId = objectIdList.get(0).toString();
+            }
+
+            if ((objectData.getPolicyIds() != null) && (objectData.getPolicyIds().getPolicyIds()
!= null)) {
+                policyIds = objectData.getPolicyIds().getPolicyIds();
+            }
+
+            if (objectData.getAcl() != null) {
+                acl = objectData.getAcl();
+            }
+        }
+
+        return new ChangeEventImpl(changeType, changeTime, objectId, properties, policyIds,
acl);
+    }
+
+    public ChangeEvents convertChangeEvents(String changeLogToken, ObjectList objectList)
{
+        if (objectList == null) {
+            return null;
+        }
+
+        List<ChangeEvent> events = new ArrayList<ChangeEvent>();
+        if (objectList.getObjects() != null) {
+            for (ObjectData objectData : objectList.getObjects()) {
+                if (objectData == null) {
+                    continue;
+                }
+
+                events.add(convertChangeEvent(objectData));
+            }
+        }
+
+        boolean hasMoreItems = (objectList.hasMoreItems() == null ? false : objectList.hasMoreItems().booleanValue());
+        long totalNumItems = (objectList.getNumItems() == null ? -1 : objectList.getNumItems().longValue());
+
+        return new ChangeEventsImpl(changeLogToken, events, hasMoreItems, totalNumItems);
+    }
+
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ChangeEventInfoDataImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ChangeEventInfoDataImpl.java?rev=1003879&r1=1003878&r2=1003879&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ChangeEventInfoDataImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ChangeEventInfoDataImpl.java
Sat Oct  2 20:41:24 2010
@@ -24,39 +24,26 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.ChangeType;
 
 /**
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ * Change event.
  */
 public class ChangeEventInfoDataImpl extends AbstractExtensionData implements ChangeEventInfo
{
 
-    private GregorianCalendar fChangeTime;
-    private ChangeType fTypeOfChanges;
+    private GregorianCalendar changeTime;
+    private ChangeType changeType;
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.provider.ChangeEventInfoData#getChangeTime()
-     */
     public GregorianCalendar getChangeTime() {
-        return fChangeTime;
+        return changeTime;
     }
 
     public void setChangeTime(GregorianCalendar changeTime) {
-        fChangeTime = changeTime;
+        this.changeTime = changeTime;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.provider.ChangeEventInfoData#getChangeType()
-     */
     public ChangeType getChangeType() {
-        return fTypeOfChanges;
+        return changeType;
     }
 
     public void setChangeType(ChangeType changeType) {
-        fTypeOfChanges = changeType;
+        this.changeType = changeType;
     }
 }



Mime
View raw message