From 9446c8938a41c8a60abbddf682a33b8936e7c229 Mon Sep 17 00:00:00 2001 From: Jamal Kaabi-Mofrad Date: Tue, 10 May 2016 10:57:42 +0000 Subject: [PATCH] Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 122165 gjames: RA-823 Adding an interface git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126453 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../SerializerOfCollectionWithPaging.java | 11 +++--- .../resource/SerializablePagedCollection.java | 37 +++++++++++++++++++ .../parameters/CollectionWithPagingInfo.java | 8 +++- 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 source/java/org/alfresco/rest/framework/resource/SerializablePagedCollection.java diff --git a/source/java/org/alfresco/rest/framework/jacksonextensions/SerializerOfCollectionWithPaging.java b/source/java/org/alfresco/rest/framework/jacksonextensions/SerializerOfCollectionWithPaging.java index 26d6836243..a7f26b908d 100644 --- a/source/java/org/alfresco/rest/framework/jacksonextensions/SerializerOfCollectionWithPaging.java +++ b/source/java/org/alfresco/rest/framework/jacksonextensions/SerializerOfCollectionWithPaging.java @@ -2,6 +2,7 @@ package org.alfresco.rest.framework.jacksonextensions; import java.io.IOException; +import org.alfresco.rest.framework.resource.SerializablePagedCollection; import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; import org.alfresco.rest.framework.webscripts.ResourceWebScriptHelper; import org.codehaus.jackson.JsonGenerationException; @@ -11,21 +12,21 @@ import org.codehaus.jackson.map.SerializerProvider; import org.codehaus.jackson.map.ser.std.SerializerBase; /** - * Serializes CollectionWithPagingInfo into the correct response format, with Paging information and entries// + * Serializes SerializablePagedCollection into the correct response format, with Paging information and entries * * @author Gethin James */ @SuppressWarnings("rawtypes") -public class SerializerOfCollectionWithPaging extends SerializerBase +public class SerializerOfCollectionWithPaging extends SerializerBase { protected SerializerOfCollectionWithPaging() { - super(CollectionWithPagingInfo.class); + super(SerializablePagedCollection.class); } @Override - public void serialize(CollectionWithPagingInfo pagedCol, JsonGenerator jgen, SerializerProvider provider) + public void serialize(SerializablePagedCollection pagedCol, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException { if (pagedCol != null) @@ -40,7 +41,7 @@ public class SerializerOfCollectionWithPaging extends SerializerBase +{ + /** + * Returns the Collection object + * @return Collection + */ + Collection getCollection(); + + /** + * Indicates if the returned collection has more items after the current returned list. + */ + boolean hasMoreItems(); + + /** + * Indicates the total number of items available. + * + * Can be greater than the number of items returned in the list. + * + */ + Integer getTotalItems(); + + /** + * The requested paging parameters set by the client + */ + Paging getPaging(); +} diff --git a/source/java/org/alfresco/rest/framework/resource/parameters/CollectionWithPagingInfo.java b/source/java/org/alfresco/rest/framework/resource/parameters/CollectionWithPagingInfo.java index 059a129aa0..288c5d0a98 100644 --- a/source/java/org/alfresco/rest/framework/resource/parameters/CollectionWithPagingInfo.java +++ b/source/java/org/alfresco/rest/framework/resource/parameters/CollectionWithPagingInfo.java @@ -1,5 +1,7 @@ package org.alfresco.rest.framework.resource.parameters; +import org.alfresco.rest.framework.resource.SerializablePagedCollection; + import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -15,7 +17,7 @@ import java.util.Collections; * * @author Gethin James. */ -public class CollectionWithPagingInfo +public class CollectionWithPagingInfo implements SerializablePagedCollection { private final Collection collection; @@ -95,6 +97,7 @@ public class CollectionWithPagingInfo * Returns the Collection object * @return Collection */ + @Override public Collection getCollection() { return this.collection; @@ -103,6 +106,7 @@ public class CollectionWithPagingInfo /** * Indicates if the returned collection has more items after the current returned list. */ + @Override public boolean hasMoreItems() { return this.hasMoreItems; @@ -114,6 +118,7 @@ public class CollectionWithPagingInfo * Can be greater than the number of items returned in the list. * */ + @Override public Integer getTotalItems() { return this.totalItems; @@ -122,6 +127,7 @@ public class CollectionWithPagingInfo /** * The requested paging parameters set by the client */ + @Override public Paging getPaging() { return this.paging;