You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2014/08/14 18:17:01 UTC
svn commit: r1617989 - in
/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main:
java/org/apache/chemistry/opencmis/workbench/model/ resources/META-INF/
Author: fmui
Date: Thu Aug 14 16:17:00 2014
New Revision: 1617989
URL: http://svn.apache.org/r1617989
Log:
CMIS-836: Workbench: added property to restrict the number of children
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README-cmis-workbench.txt
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java?rev=1617989&r1=1617988&r2=1617989&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java Thu Aug 14 16:17:00 2014
@@ -18,7 +18,8 @@
*/
package org.apache.chemistry.opencmis.workbench.model;
-import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
import java.io.BufferedInputStream;
import java.io.File;
@@ -189,10 +190,21 @@ public class ClientModel {
}
List<CmisObject> children = new ArrayList<CmisObject>();
- ItemIterable<CmisObject> iter = ((Folder) folderObject).getChildren(clientSession
- .getFolderOperationContext());
- for (CmisObject child : iter) {
- children.add(child);
+
+ if (clientSession.getMaxChildren() != 0) {
+ // if maxChildren == 0 don't call getChildren()
+ ItemIterable<CmisObject> iter = ((Folder) folderObject).getChildren(clientSession
+ .getFolderOperationContext());
+
+ if (clientSession.getMaxChildren() > 0) {
+ // if maxChildren > 0 restrict number of children
+ // otherwise load all
+ iter = iter.getPage(clientSession.getMaxChildren());
+ }
+
+ for (CmisObject child : iter) {
+ children.add(child);
+ }
}
setCurrentFolder((Folder) folderObject, children);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java?rev=1617989&r1=1617988&r2=1617989&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java Thu Aug 14 16:17:00 2014
@@ -62,6 +62,7 @@ public class ClientSession {
public static final String FOLDER_PREFIX = WORKBENCH_PREFIX + "folder.";
public static final String VERSION_PREFIX = WORKBENCH_PREFIX + "version.";
public static final String ACCEPT_SELF_SIGNED_CERTIFICATES = WORKBENCH_PREFIX + "acceptSelfSignedCertificates";
+ public static final String MAX_FOLDER_CHILDREN = FOLDER_PREFIX + "maxChildren";
public enum Authentication {
NONE, STANDARD, NTLM, OAUTH_BEARER
@@ -103,6 +104,7 @@ public class ClientSession {
private OperationContext objectOperationContext;
private OperationContext folderOperationContext;
private OperationContext versionOperationContext;
+ private int maxChildren;
public ClientSession(Map<String, String> sessionParameters, ObjectFactory objectFactory,
AuthenticationProvider authenticationProvider, Cache cache, TypeDefinitionCache typeDefCache) {
@@ -175,6 +177,16 @@ public class ClientSession {
acceptSelfSignedCertificates();
}
+ maxChildren = -1;
+ String maxChildrenStr = sessionParameters.get(MAX_FOLDER_CHILDREN);
+ if (maxChildrenStr != null) {
+ try {
+ maxChildren = Integer.valueOf(maxChildrenStr.trim());
+ } catch (NumberFormatException e) {
+ LOG.warn("Invalid " + MAX_FOLDER_CHILDREN + " parameter!", e);
+ }
+ }
+
repositories = SessionFactoryImpl.newInstance().getRepositories(sessionParameters, objectFactory,
authenticationProvider, cache, typeDefCache);
}
@@ -199,6 +211,10 @@ public class ClientSession {
return Collections.unmodifiableMap(sessionParameters);
}
+ public int getMaxChildren() {
+ return maxChildren;
+ }
+
public synchronized OperationContext getObjectOperationContext() {
if (objectOperationContext == null) {
createOperationContexts();
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README-cmis-workbench.txt
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README-cmis-workbench.txt?rev=1617989&r1=1617988&r2=1617989&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README-cmis-workbench.txt (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README-cmis-workbench.txt Thu Aug 14 16:17:00 2014
@@ -37,6 +37,7 @@ cmis.workbench.folder.includeRelationshi
cmis.workbench.folder.renditionFilter
cmis.workbench.folder.orderBy
cmis.workbench.folder.maxItemsPerPage
+cmis.workbench.folder.maxChildren
Object operation context: