chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1525957 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
Date Tue, 24 Sep 2013 18:12:14 GMT
Author: jens
Date: Tue Sep 24 18:12:13 2013
New Revision: 1525957

URL: http://svn.apache.org/r1525957
Log:
InMemory: return more than one entry in getContentChanges()

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java?rev=1525957&r1=1525956&r2=1525957&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
Tue Sep 24 18:12:13 2013
@@ -59,33 +59,38 @@ public class InMemoryDiscoveryServiceImp
             Boolean includeProperties, String filter, Boolean includePolicyIds, Boolean includeAcl,
             BigInteger maxItems, ExtensionsData extension, ObjectInfoHandler objectInfos)
{
         // dummy implementation using hard coded values
-
+        final int ITEMS_AVAILABLE = 25;
+        
         ObjectListImpl objList = new ObjectListImpl();
-
+        GregorianCalendar timestamp = new GregorianCalendar();
+        timestamp.add(GregorianCalendar.MINUTE, -1);
         // convert ObjectInFolderContainerList to objectList
         List<ObjectData> lod = new ArrayList<ObjectData>();
-
-        // add a dummy delete event
-        ObjectDataImpl odImpl = new ObjectDataImpl();
-        PropertiesImpl props = new PropertiesImpl();
-        props.addProperty(new PropertyIdImpl(PropertyIds.OBJECT_ID, UUID.randomUUID().toString()));
-        props.addProperty(new PropertyIdImpl(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_DOCUMENT.value()));
-        props.addProperty(new PropertyIdImpl(PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_DOCUMENT.value()));
-        odImpl.setProperties(props);
-        ChangeEventInfoDataImpl changeEventInfo = new ChangeEventInfoDataImpl();
-        changeEventInfo.setChangeType(ChangeType.DELETED);
-        changeEventInfo.setChangeTime(new GregorianCalendar());
-        odImpl.setChangeEventInfo(changeEventInfo);
-        if (includePolicyIds != null && includePolicyIds) {
-            PolicyIdList policies = new PolicyIdListImpl();
-            // TODO fill list
-            odImpl.setPolicyIds(policies);
+        int count = Math.min(ITEMS_AVAILABLE, maxItems.intValue());
+        
+        for (int i=0; i<count; i++) {
+            // add a dummy delete event
+            ObjectDataImpl odImpl = new ObjectDataImpl();
+            PropertiesImpl props = new PropertiesImpl();
+            props.addProperty(new PropertyIdImpl(PropertyIds.OBJECT_ID, UUID.randomUUID().toString()));
+            props.addProperty(new PropertyIdImpl(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_DOCUMENT.value()));
+            props.addProperty(new PropertyIdImpl(PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_DOCUMENT.value()));
+            odImpl.setProperties(props);
+            ChangeEventInfoDataImpl changeEventInfo = new ChangeEventInfoDataImpl();
+            changeEventInfo.setChangeType(ChangeType.DELETED);
+            timestamp.add(GregorianCalendar.SECOND, 1);
+            changeEventInfo.setChangeTime(timestamp);
+            odImpl.setChangeEventInfo(changeEventInfo);
+            if (includePolicyIds != null && includePolicyIds) {
+                PolicyIdList policies = new PolicyIdListImpl();
+                odImpl.setPolicyIds(policies);
+            }
+            lod.add(odImpl);
         }
-        lod.add(odImpl);
 
         objList.setObjects(lod);
         objList.setNumItems(BigInteger.valueOf(lod.size()));
-        objList.setHasMoreItems(false);
+        objList.setHasMoreItems(ITEMS_AVAILABLE > lod.size());
 
         String changeToken = Long.valueOf(new Date().getTime()).toString();
         changeLogToken.setValue(changeToken);



Mime
View raw message