chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1481420 [2/7] - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src: main/java/org/apache/chemistry/opencmis/server/impl/ main/java/org/apache/chemistry/opencmis/server/impl/atompub/ main/java/org/...
Date Sat, 11 May 2013 21:19:48 GMT
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java?rev=1481420&r1=1481419&r2=1481420&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java Sat May 11 21:19:48 2013
@@ -18,14 +18,6 @@
  */
 package org.apache.chemistry.opencmis.server.impl.atompub;
 
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ENTRY;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeObjectEntry;
-import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getEnumParameter;
-import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -42,103 +34,99 @@ import org.apache.chemistry.opencmis.ser
 /**
  * MultiFiling Service operations.
  */
-public final class MultiFilingService {
-
-    private MultiFilingService() {
-    }
+public class MultiFilingService {
 
     /**
      * Remove object from folder.
      */
-    public static void removeObjectFromFolder(CallContext context, CmisService service, String repositoryId,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
-        // get parameters
-        String removeFrom = getStringParameter(request, Constants.PARAM_REMOVE_FROM);
-
-        ThresholdOutputStreamFactory streamFactory = (ThresholdOutputStreamFactory) context
-                .get(CallContext.STREAM_FACTORY);
-        AtomEntryParser parser = new AtomEntryParser(streamFactory);
-        parser.setIgnoreAtomContentSrc(true); // needed for some clients
-        parser.parse(request.getInputStream());
-
-        String objectId = parser.getId();
-
-        if (objectId == null && removeFrom == null) {
-            // create unfiled object
-            createUnfiledObject(context, service, repositoryId, request, response, parser);
-            return;
-        }
-
-        // execute
-        service.removeObjectFromFolder(repositoryId, objectId, removeFrom, null);
-
-        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
-        if (objectInfo == null) {
-            throw new CmisRuntimeException("Object Info is missing!");
+    public static class RemoveObjectFromFolder extends AbstractAtomPubServiceCall {
+        public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+                HttpServletResponse response) throws Exception {
+            // get parameters
+            String removeFrom = getStringParameter(request, Constants.PARAM_REMOVE_FROM);
+
+            ThresholdOutputStreamFactory streamFactory = (ThresholdOutputStreamFactory) context
+                    .get(CallContext.STREAM_FACTORY);
+            AtomEntryParser parser = new AtomEntryParser(streamFactory);
+            parser.setIgnoreAtomContentSrc(true); // needed for some clients
+            parser.parse(request.getInputStream());
+
+            String objectId = parser.getId();
+
+            if (objectId == null && removeFrom == null) {
+                // create unfiled object
+                createUnfiledObject(context, service, repositoryId, request, response, parser);
+                return;
+            }
+
+            // execute
+            service.removeObjectFromFolder(repositoryId, objectId, removeFrom, null);
+
+            ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
+            if (objectInfo == null) {
+                throw new CmisRuntimeException("Object Info is missing!");
+            }
+
+            ObjectData object = objectInfo.getObject();
+            if (object == null) {
+                throw new CmisRuntimeException("Object is null!");
+            }
+
+            if (object.getId() == null) {
+                throw new CmisRuntimeException("Object Id is null!");
+            }
+
+            // set headers
+            UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+
+            response.setStatus(HttpServletResponse.SC_CREATED);
+            response.setContentType(Constants.MEDIATYPE_ENTRY);
+            response.setHeader("Location", compileUrl(baseUrl, RESOURCE_ENTRY, object.getId()));
+
+            // write XML
+            AtomEntry entry = new AtomEntry();
+            entry.startDocument(response.getOutputStream(), getNamespaces(service));
+            writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                    context.getCmisVersion());
+            entry.endDocument();
+        }
+
+        /**
+         * Create unfiled object.
+         */
+        private void createUnfiledObject(CallContext context, CmisService service, String repositoryId,
+                HttpServletRequest request, HttpServletResponse response, AtomEntryParser parser) throws Exception {
+            // get additional parameters
+            VersioningState versioningState = getEnumParameter(request, Constants.PARAM_VERSIONIG_STATE,
+                    VersioningState.class);
+
+            // create
+            String newObjectId = service.create(repositoryId, parser.getProperties(), null, parser.getContentStream(),
+                    versioningState, parser.getPolicyIds(), null);
+
+            ObjectInfo objectInfo = service.getObjectInfo(repositoryId, newObjectId);
+            if (objectInfo == null) {
+                throw new CmisRuntimeException("Object Info is missing!");
+            }
+
+            ObjectData object = objectInfo.getObject();
+            if (object == null) {
+                throw new CmisRuntimeException("Object is null!");
+            }
+
+            // set headers
+            UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+
+            response.setStatus(HttpServletResponse.SC_CREATED);
+            response.setContentType(Constants.MEDIATYPE_ENTRY);
+            response.setHeader("Location", compileUrl(baseUrl, RESOURCE_ENTRY, newObjectId));
+
+            // write XML
+            AtomEntry entry = new AtomEntry();
+            entry.startDocument(response.getOutputStream(), getNamespaces(service));
+            writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                    context.getCmisVersion());
+            entry.endDocument();
         }
-
-        ObjectData object = objectInfo.getObject();
-        if (object == null) {
-            throw new CmisRuntimeException("Object is null!");
-        }
-
-        if (object.getId() == null) {
-            throw new CmisRuntimeException("Object Id is null!");
-        }
-
-        // set headers
-        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
-
-        response.setStatus(HttpServletResponse.SC_CREATED);
-        response.setContentType(Constants.MEDIATYPE_ENTRY);
-        response.setHeader("Location", compileUrl(baseUrl, RESOURCE_ENTRY, object.getId()));
-
-        // write XML
-        AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
-                context.getCmisVersion());
-        entry.endDocument();
-    }
-
-    /**
-     * Create unfiled object.
-     * 
-     * (Creation of unfiled objects via AtomPub is not defined in the CMIS 1.0
-     * specification. This implementation follow the CMIS 1.1 draft.)
-     */
-    private static void createUnfiledObject(CallContext context, CmisService service, String repositoryId,
-            HttpServletRequest request, HttpServletResponse response, AtomEntryParser parser) throws Exception {
-        // get additional parameters
-        VersioningState versioningState = getEnumParameter(request, Constants.PARAM_VERSIONIG_STATE,
-                VersioningState.class);
-
-        // create
-        String newObjectId = service.create(repositoryId, parser.getProperties(), null, parser.getContentStream(),
-                versioningState, parser.getPolicyIds(), null);
-
-        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, newObjectId);
-        if (objectInfo == null) {
-            throw new CmisRuntimeException("Object Info is missing!");
-        }
-
-        ObjectData object = objectInfo.getObject();
-        if (object == null) {
-            throw new CmisRuntimeException("Object is null!");
-        }
-
-        // set headers
-        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
-
-        response.setStatus(HttpServletResponse.SC_CREATED);
-        response.setContentType(Constants.MEDIATYPE_ENTRY);
-        response.setHeader("Location", compileUrl(baseUrl, RESOURCE_ENTRY, newObjectId));
-
-        // write XML
-        AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
-                context.getCmisVersion());
-        entry.endDocument();
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java?rev=1481420&r1=1481419&r2=1481420&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java Sat May 11 21:19:48 2013
@@ -18,28 +18,6 @@
  */
 package org.apache.chemistry.opencmis.server.impl.atompub;
 
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ACL;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ALLOWABLEACIONS;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_CHECKEDOUT;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_CHILDREN;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_CONTENT;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_DESCENDANTS;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ENTRY;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_FOLDERTREE;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_PARENTS;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_POLICIES;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_RELATIONSHIPS;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_TYPE;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrlBuilder;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeObjectEntry;
-import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
-import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
-import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getEnumParameter;
-import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
-
 import java.math.BigInteger;
 import java.util.GregorianCalendar;
 import java.util.List;
@@ -66,467 +44,478 @@ import org.apache.chemistry.opencmis.com
 /**
  * Navigation Service operations.
  */
-public final class NavigationService {
-
-    private NavigationService() {
-    }
+public class NavigationService {
 
     /**
      * Children Collection GET.
      */
-    public static void getChildren(CallContext context, CmisService service, String repositoryId,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
-        // get parameters
-        String folderId = getStringParameter(request, Constants.PARAM_ID);
-        String filter = getStringParameter(request, Constants.PARAM_FILTER);
-        String orderBy = getStringParameter(request, Constants.PARAM_ORDER_BY);
-        Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
-        IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
-                IncludeRelationships.class);
-        String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
-        Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
-        BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
-        BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
-
-        // execute
-        ObjectInFolderList children = service.getChildren(repositoryId, folderId, filter, orderBy,
-                includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItems,
-                skipCount, null);
+    public static class GetChildren extends AbstractAtomPubServiceCall {
+        public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+                HttpServletResponse response) throws Exception {
+            // get parameters
+            String folderId = getStringParameter(request, Constants.PARAM_ID);
+            String filter = getStringParameter(request, Constants.PARAM_FILTER);
+            String orderBy = getStringParameter(request, Constants.PARAM_ORDER_BY);
+            Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
+            IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
+                    IncludeRelationships.class);
+            String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
+            Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
+            BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
+            BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
+
+            // execute
+            ObjectInFolderList children = service.getChildren(repositoryId, folderId, filter, orderBy,
+                    includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItems,
+                    skipCount, null);
 
-        if (children == null) {
-            throw new CmisRuntimeException("Children are null!");
-        }
-
-        ObjectInfo folderInfo = service.getObjectInfo(repositoryId, folderId);
-        if (folderInfo == null) {
-            throw new CmisRuntimeException("Folder Object Info is missing!");
-        }
+            if (children == null) {
+                throw new CmisRuntimeException("Children are null!");
+            }
 
-        // set headers
-        response.setStatus(HttpServletResponse.SC_OK);
-        response.setContentType(Constants.MEDIATYPE_FEED);
-
-        // write XML
-        AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream(), getNamespaces(service));
-        feed.startFeed(true);
-
-        // write basic Atom feed elements
-        feed.writeFeedElements(folderInfo.getId(), folderInfo.getAtomId(), folderInfo.getCreatedBy(),
-                folderInfo.getName(), folderInfo.getLastModificationDate(), null, children.getNumItems());
-
-        // write links
-        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
-
-        feed.writeServiceLink(baseUrl.toString(), repositoryId);
-
-        UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_CHILDREN, folderInfo.getId());
-        selfLink.addParameter(Constants.PARAM_FILTER, filter);
-        selfLink.addParameter(Constants.PARAM_ORDER_BY, orderBy);
-        selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
-        selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
-        selfLink.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
-        selfLink.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
-        selfLink.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
-        selfLink.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
-        feed.writeSelfLink(selfLink.toString(), null);
-
-        feed.writeDescribedByLink(compileUrl(baseUrl, RESOURCE_TYPE, folderInfo.getTypeId()));
-
-        feed.writeAllowableActionsLink(compileUrl(baseUrl, RESOURCE_ALLOWABLEACIONS, folderInfo.getId()));
-
-        feed.writeDownLink(compileUrl(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()), Constants.MEDIATYPE_FEED);
-
-        if (folderInfo.supportsDescendants()) {
-            feed.writeDownLink(compileUrl(baseUrl, RESOURCE_DESCENDANTS, folderInfo.getId()),
-                    Constants.MEDIATYPE_DESCENDANTS);
-        }
+            ObjectInfo folderInfo = service.getObjectInfo(repositoryId, folderId);
+            if (folderInfo == null) {
+                throw new CmisRuntimeException("Folder Object Info is missing!");
+            }
 
-        if (folderInfo.supportsFolderTree()) {
-            feed.writeFolderTreeLink(compileUrl(baseUrl, RESOURCE_FOLDERTREE, folderInfo.getId()));
-        }
+            // set headers
+            response.setStatus(HttpServletResponse.SC_OK);
+            response.setContentType(Constants.MEDIATYPE_FEED);
+
+            // write XML
+            AtomFeed feed = new AtomFeed();
+            feed.startDocument(response.getOutputStream(), getNamespaces(service));
+            feed.startFeed(true);
+
+            // write basic Atom feed elements
+            feed.writeFeedElements(folderInfo.getId(), folderInfo.getAtomId(), folderInfo.getCreatedBy(),
+                    folderInfo.getName(), folderInfo.getLastModificationDate(), null, children.getNumItems());
+
+            // write links
+            UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+
+            feed.writeServiceLink(baseUrl.toString(), repositoryId);
+
+            UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_CHILDREN, folderInfo.getId());
+            selfLink.addParameter(Constants.PARAM_FILTER, filter);
+            selfLink.addParameter(Constants.PARAM_ORDER_BY, orderBy);
+            selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+            selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
+            selfLink.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
+            selfLink.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
+            selfLink.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
+            selfLink.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
+            feed.writeSelfLink(selfLink.toString(), null);
+
+            feed.writeDescribedByLink(compileUrl(baseUrl, RESOURCE_TYPE, folderInfo.getTypeId()));
+
+            feed.writeAllowableActionsLink(compileUrl(baseUrl, RESOURCE_ALLOWABLEACIONS, folderInfo.getId()));
+
+            feed.writeDownLink(compileUrl(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()), Constants.MEDIATYPE_FEED);
+
+            if (folderInfo.supportsDescendants()) {
+                feed.writeDownLink(compileUrl(baseUrl, RESOURCE_DESCENDANTS, folderInfo.getId()),
+                        Constants.MEDIATYPE_DESCENDANTS);
+            }
 
-        if (folderInfo.hasParent()) {
-            feed.writeUpLink(compileUrl(baseUrl, RESOURCE_PARENTS, folderInfo.getId()), Constants.MEDIATYPE_FEED);
-        }
+            if (folderInfo.supportsFolderTree()) {
+                feed.writeFolderTreeLink(compileUrl(baseUrl, RESOURCE_FOLDERTREE, folderInfo.getId()));
+            }
 
-        if (folderInfo.getRenditionInfos() != null) {
-            for (RenditionInfo ri : folderInfo.getRenditionInfos()) {
-                feed.writeAlternateLink(compileUrl(baseUrl, RESOURCE_CONTENT, ri.getId()), ri.getContenType(),
-                        ri.getKind(), ri.getTitle(), ri.getLength());
+            if (folderInfo.hasParent()) {
+                feed.writeUpLink(compileUrl(baseUrl, RESOURCE_PARENTS, folderInfo.getId()), Constants.MEDIATYPE_FEED);
             }
-        }
 
-        if (folderInfo.hasAcl()) {
-            feed.writeAclLink(compileUrl(baseUrl, RESOURCE_ACL, folderInfo.getId()));
-        }
+            if (folderInfo.getRenditionInfos() != null) {
+                for (RenditionInfo ri : folderInfo.getRenditionInfos()) {
+                    feed.writeAlternateLink(compileUrl(baseUrl, RESOURCE_CONTENT, ri.getId()), ri.getContenType(),
+                            ri.getKind(), ri.getTitle(), ri.getLength());
+                }
+            }
 
-        if (folderInfo.supportsPolicies()) {
-            feed.writeAclLink(compileUrl(baseUrl, RESOURCE_POLICIES, folderInfo.getId()));
-        }
+            if (folderInfo.hasAcl()) {
+                feed.writeAclLink(compileUrl(baseUrl, RESOURCE_ACL, folderInfo.getId()));
+            }
 
-        if (folderInfo.supportsRelationships()) {
-            feed.writeRelationshipsLink(compileUrl(baseUrl, RESOURCE_RELATIONSHIPS, folderInfo.getId()));
-        }
+            if (folderInfo.supportsPolicies()) {
+                feed.writeAclLink(compileUrl(baseUrl, RESOURCE_POLICIES, folderInfo.getId()));
+            }
 
-        UrlBuilder pagingUrl = new UrlBuilder(compileUrlBuilder(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()));
-        pagingUrl.addParameter(Constants.PARAM_FILTER, filter);
-        pagingUrl.addParameter(Constants.PARAM_ORDER_BY, orderBy);
-        pagingUrl.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
-        pagingUrl.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
-        pagingUrl.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
-        pagingUrl.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
-        feed.writePagingLinks(pagingUrl, maxItems, skipCount, children.getNumItems(), children.hasMoreItems(),
-                AtomPubUtils.PAGE_SIZE);
-
-        // write collection
-        feed.writeCollection(compileUrl(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()), null, "Folder collection",
-                Constants.MEDIATYPE_CMISATOM);
+            if (folderInfo.supportsRelationships()) {
+                feed.writeRelationshipsLink(compileUrl(baseUrl, RESOURCE_RELATIONSHIPS, folderInfo.getId()));
+            }
 
-        // write entries
-        if (children.getObjects() != null) {
-            AtomEntry entry = new AtomEntry(feed.getWriter());
-            for (ObjectInFolderData object : children.getObjects()) {
-                if ((object == null) || (object.getObject() == null)) {
-                    continue;
+            UrlBuilder pagingUrl = new UrlBuilder(compileUrlBuilder(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()));
+            pagingUrl.addParameter(Constants.PARAM_FILTER, filter);
+            pagingUrl.addParameter(Constants.PARAM_ORDER_BY, orderBy);
+            pagingUrl.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+            pagingUrl.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
+            pagingUrl.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
+            pagingUrl.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
+            feed.writePagingLinks(pagingUrl, maxItems, skipCount, children.getNumItems(), children.hasMoreItems(),
+                    PAGE_SIZE);
+
+            // write collection
+            feed.writeCollection(compileUrl(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()), null, "Folder collection",
+                    Constants.MEDIATYPE_CMISATOM);
+
+            // write entries
+            if (children.getObjects() != null) {
+                AtomEntry entry = new AtomEntry(feed.getWriter());
+                for (ObjectInFolderData object : children.getObjects()) {
+                    if ((object == null) || (object.getObject() == null)) {
+                        continue;
+                    }
+                    writeObjectEntry(service, entry, object.getObject(), null, repositoryId, object.getPathSegment(),
+                            null, baseUrl, false, context.getCmisVersion());
                 }
-                writeObjectEntry(service, entry, object.getObject(), null, repositoryId, object.getPathSegment(), null,
-                        baseUrl, false, context.getCmisVersion());
             }
-        }
 
-        // we are done
-        feed.endFeed();
-        feed.endDocument();
+            // we are done
+            feed.endFeed();
+            feed.endDocument();
+        }
     }
 
     /**
      * Descendants feed GET.
      */
-    public static void getDescendants(CallContext context, CmisService service, String repositoryId,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
-        // get parameters
-        String folderId = getStringParameter(request, Constants.PARAM_ID);
-        BigInteger depth = getBigIntegerParameter(request, Constants.PARAM_DEPTH);
-        String filter = getStringParameter(request, Constants.PARAM_FILTER);
-        Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
-        IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
-                IncludeRelationships.class);
-        String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
-        Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
-
-        // execute
-        List<ObjectInFolderContainer> descendants = service.getDescendants(repositoryId, folderId, depth, filter,
-                includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null);
+    public static class GetDescendants extends AbstractAtomPubServiceCall {
+        public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+                HttpServletResponse response) throws Exception {
+            // get parameters
+            String folderId = getStringParameter(request, Constants.PARAM_ID);
+            BigInteger depth = getBigIntegerParameter(request, Constants.PARAM_DEPTH);
+            String filter = getStringParameter(request, Constants.PARAM_FILTER);
+            Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
+            IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
+                    IncludeRelationships.class);
+            String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
+            Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
+
+            // execute
+            List<ObjectInFolderContainer> descendants = service.getDescendants(repositoryId, folderId, depth, filter,
+                    includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null);
 
-        if (descendants == null) {
-            throw new CmisRuntimeException("Descendants are null!");
-        }
+            if (descendants == null) {
+                throw new CmisRuntimeException("Descendants are null!");
+            }
 
-        ObjectInfo folderInfo = service.getObjectInfo(repositoryId, folderId);
-        if (folderInfo == null) {
-            throw new CmisRuntimeException("Folder Object Info is missing!");
-        }
+            ObjectInfo folderInfo = service.getObjectInfo(repositoryId, folderId);
+            if (folderInfo == null) {
+                throw new CmisRuntimeException("Folder Object Info is missing!");
+            }
 
-        // set headers
-        response.setStatus(HttpServletResponse.SC_OK);
-        response.setContentType(Constants.MEDIATYPE_FEED);
-
-        // write XML
-        AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream(), getNamespaces(service));
-        feed.startFeed(true);
-
-        // write basic Atom feed elements
-        feed.writeFeedElements(folderInfo.getId(), folderInfo.getAtomId(), folderInfo.getCreatedBy(),
-                folderInfo.getName(), folderInfo.getLastModificationDate(), null, null);
-
-        // write links
-        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
-
-        feed.writeServiceLink(baseUrl.toString(), repositoryId);
-
-        UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_DESCENDANTS, folderInfo.getId());
-        selfLink.addParameter(Constants.PARAM_DEPTH, depth);
-        selfLink.addParameter(Constants.PARAM_FILTER, filter);
-        selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
-        selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
-        selfLink.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
-        selfLink.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
-        feed.writeSelfLink(selfLink.toString(), null);
+            // set headers
+            response.setStatus(HttpServletResponse.SC_OK);
+            response.setContentType(Constants.MEDIATYPE_FEED);
+
+            // write XML
+            AtomFeed feed = new AtomFeed();
+            feed.startDocument(response.getOutputStream(), getNamespaces(service));
+            feed.startFeed(true);
+
+            // write basic Atom feed elements
+            feed.writeFeedElements(folderInfo.getId(), folderInfo.getAtomId(), folderInfo.getCreatedBy(),
+                    folderInfo.getName(), folderInfo.getLastModificationDate(), null, null);
+
+            // write links
+            UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+
+            feed.writeServiceLink(baseUrl.toString(), repositoryId);
+
+            UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_DESCENDANTS, folderInfo.getId());
+            selfLink.addParameter(Constants.PARAM_DEPTH, depth);
+            selfLink.addParameter(Constants.PARAM_FILTER, filter);
+            selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+            selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
+            selfLink.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
+            selfLink.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
+            feed.writeSelfLink(selfLink.toString(), null);
 
-        feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, folderInfo.getId()));
+            feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, folderInfo.getId()));
 
-        feed.writeDownLink(compileUrl(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()), Constants.MEDIATYPE_FEED);
+            feed.writeDownLink(compileUrl(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()), Constants.MEDIATYPE_FEED);
 
-        if (folderInfo.supportsFolderTree()) {
-            feed.writeFolderTreeLink(compileUrl(baseUrl, RESOURCE_FOLDERTREE, folderInfo.getId()));
-        }
+            if (folderInfo.supportsFolderTree()) {
+                feed.writeFolderTreeLink(compileUrl(baseUrl, RESOURCE_FOLDERTREE, folderInfo.getId()));
+            }
 
-        if (folderInfo.hasParent()) {
-            feed.writeUpLink(compileUrl(baseUrl, RESOURCE_PARENTS, folderInfo.getId()), Constants.MEDIATYPE_FEED);
-        }
+            if (folderInfo.hasParent()) {
+                feed.writeUpLink(compileUrl(baseUrl, RESOURCE_PARENTS, folderInfo.getId()), Constants.MEDIATYPE_FEED);
+            }
 
-        // write entries
-        AtomEntry entry = new AtomEntry(feed.getWriter());
-        for (ObjectInFolderContainer container : descendants) {
-            if ((container == null) || (container.getObject() == null) || (container.getObject().getObject() == null)) {
-                continue;
+            // write entries
+            AtomEntry entry = new AtomEntry(feed.getWriter());
+            for (ObjectInFolderContainer container : descendants) {
+                if ((container == null) || (container.getObject() == null)
+                        || (container.getObject().getObject() == null)) {
+                    continue;
+                }
+                writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(),
+                        repositoryId, container.getObject().getPathSegment(), null, baseUrl, false,
+                        context.getCmisVersion());
             }
-            writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(), repositoryId,
-                    container.getObject().getPathSegment(), null, baseUrl, false, context.getCmisVersion());
-        }
 
-        // we are done
-        feed.endFeed();
-        feed.endDocument();
+            // we are done
+            feed.endFeed();
+            feed.endDocument();
+        }
     }
 
     /**
      * Folder tree feed GET.
      */
-    public static void getFolderTree(CallContext context, CmisService service, String repositoryId,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
-        // get parameters
-        String folderId = getStringParameter(request, Constants.PARAM_ID);
-        BigInteger depth = getBigIntegerParameter(request, Constants.PARAM_DEPTH);
-        String filter = getStringParameter(request, Constants.PARAM_FILTER);
-        Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
-        IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
-                IncludeRelationships.class);
-        String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
-        Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
-
-        // execute
-        List<ObjectInFolderContainer> folderTree = service.getFolderTree(repositoryId, folderId, depth, filter,
-                includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null);
+    public static class GetFolderTree extends AbstractAtomPubServiceCall {
+        public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+                HttpServletResponse response) throws Exception {
+            // get parameters
+            String folderId = getStringParameter(request, Constants.PARAM_ID);
+            BigInteger depth = getBigIntegerParameter(request, Constants.PARAM_DEPTH);
+            String filter = getStringParameter(request, Constants.PARAM_FILTER);
+            Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
+            IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
+                    IncludeRelationships.class);
+            String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
+            Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
+
+            // execute
+            List<ObjectInFolderContainer> folderTree = service.getFolderTree(repositoryId, folderId, depth, filter,
+                    includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null);
 
-        if (folderTree == null) {
-            throw new CmisRuntimeException("Folder tree is null!");
-        }
+            if (folderTree == null) {
+                throw new CmisRuntimeException("Folder tree is null!");
+            }
 
-        ObjectInfo folderInfo = service.getObjectInfo(repositoryId, folderId);
-        if (folderInfo == null) {
-            throw new CmisRuntimeException("Folder Object Info is missing!");
-        }
+            ObjectInfo folderInfo = service.getObjectInfo(repositoryId, folderId);
+            if (folderInfo == null) {
+                throw new CmisRuntimeException("Folder Object Info is missing!");
+            }
 
-        // set headers
-        response.setStatus(HttpServletResponse.SC_OK);
-        response.setContentType(Constants.MEDIATYPE_FEED);
-
-        // write XML
-        AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream(), getNamespaces(service));
-        feed.startFeed(true);
-
-        // write basic Atom feed elements
-        feed.writeFeedElements(folderInfo.getId(), folderInfo.getAtomId(), folderInfo.getCreatedBy(),
-                folderInfo.getName(), folderInfo.getLastModificationDate(), null, null);
-
-        // write links
-        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
-
-        feed.writeServiceLink(baseUrl.toString(), repositoryId);
-
-        UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_FOLDERTREE, folderInfo.getId());
-        selfLink.addParameter(Constants.PARAM_DEPTH, depth);
-        selfLink.addParameter(Constants.PARAM_FILTER, filter);
-        selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
-        selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
-        selfLink.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
-        selfLink.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
-        feed.writeSelfLink(selfLink.toString(), null);
-
-        feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, folderInfo.getId()));
-
-        feed.writeDownLink(compileUrl(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()), Constants.MEDIATYPE_FEED);
-
-        if (folderInfo.supportsDescendants()) {
-            feed.writeDownLink(compileUrl(baseUrl, RESOURCE_DESCENDANTS, folderInfo.getId()),
-                    Constants.MEDIATYPE_DESCENDANTS);
-        }
+            // set headers
+            response.setStatus(HttpServletResponse.SC_OK);
+            response.setContentType(Constants.MEDIATYPE_FEED);
+
+            // write XML
+            AtomFeed feed = new AtomFeed();
+            feed.startDocument(response.getOutputStream(), getNamespaces(service));
+            feed.startFeed(true);
+
+            // write basic Atom feed elements
+            feed.writeFeedElements(folderInfo.getId(), folderInfo.getAtomId(), folderInfo.getCreatedBy(),
+                    folderInfo.getName(), folderInfo.getLastModificationDate(), null, null);
+
+            // write links
+            UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+
+            feed.writeServiceLink(baseUrl.toString(), repositoryId);
+
+            UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_FOLDERTREE, folderInfo.getId());
+            selfLink.addParameter(Constants.PARAM_DEPTH, depth);
+            selfLink.addParameter(Constants.PARAM_FILTER, filter);
+            selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+            selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
+            selfLink.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
+            selfLink.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
+            feed.writeSelfLink(selfLink.toString(), null);
+
+            feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, folderInfo.getId()));
+
+            feed.writeDownLink(compileUrl(baseUrl, RESOURCE_CHILDREN, folderInfo.getId()), Constants.MEDIATYPE_FEED);
+
+            if (folderInfo.supportsDescendants()) {
+                feed.writeDownLink(compileUrl(baseUrl, RESOURCE_DESCENDANTS, folderInfo.getId()),
+                        Constants.MEDIATYPE_DESCENDANTS);
+            }
 
-        if (folderInfo.hasParent()) {
-            feed.writeUpLink(compileUrl(baseUrl, RESOURCE_PARENTS, folderInfo.getId()), Constants.MEDIATYPE_FEED);
-        }
+            if (folderInfo.hasParent()) {
+                feed.writeUpLink(compileUrl(baseUrl, RESOURCE_PARENTS, folderInfo.getId()), Constants.MEDIATYPE_FEED);
+            }
 
-        // write entries
-        AtomEntry entry = new AtomEntry(feed.getWriter());
-        for (ObjectInFolderContainer container : folderTree) {
-            if ((container == null) || (container.getObject() == null) || (container.getObject().getObject() == null)) {
-                continue;
+            // write entries
+            AtomEntry entry = new AtomEntry(feed.getWriter());
+            for (ObjectInFolderContainer container : folderTree) {
+                if ((container == null) || (container.getObject() == null)
+                        || (container.getObject().getObject() == null)) {
+                    continue;
+                }
+                writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(),
+                        repositoryId, container.getObject().getPathSegment(), null, baseUrl, false,
+                        context.getCmisVersion());
             }
-            writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(), repositoryId,
-                    container.getObject().getPathSegment(), null, baseUrl, false, context.getCmisVersion());
-        }
 
-        // we are done
-        feed.endFeed();
-        feed.endDocument();
+            // we are done
+            feed.endFeed();
+            feed.endDocument();
+        }
     }
 
     /**
      * Object parents feed GET.
      */
-    public static void getObjectParents(CallContext context, CmisService service, String repositoryId,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
-        // get parameters
-        String objectId = getStringParameter(request, Constants.PARAM_ID);
-        String filter = getStringParameter(request, Constants.PARAM_FILTER);
-        Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
-        IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
-                IncludeRelationships.class);
-        String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
-        Boolean includeRelativePathSegment = getBooleanParameter(request, Constants.PARAM_RELATIVE_PATH_SEGMENT);
-
-        // execute
-        List<ObjectParentData> parents = service.getObjectParents(repositoryId, objectId, filter,
-                includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, null);
+    public static class GetObjectParents extends AbstractAtomPubServiceCall {
+        public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+                HttpServletResponse response) throws Exception {
+            // get parameters
+            String objectId = getStringParameter(request, Constants.PARAM_ID);
+            String filter = getStringParameter(request, Constants.PARAM_FILTER);
+            Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
+            IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
+                    IncludeRelationships.class);
+            String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
+            Boolean includeRelativePathSegment = getBooleanParameter(request, Constants.PARAM_RELATIVE_PATH_SEGMENT);
+
+            // execute
+            List<ObjectParentData> parents = service.getObjectParents(repositoryId, objectId, filter,
+                    includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, null);
 
-        if (parents == null) {
-            throw new CmisRuntimeException("Parents are null!");
-        }
+            if (parents == null) {
+                throw new CmisRuntimeException("Parents are null!");
+            }
 
-        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
-        if (objectInfo == null) {
-            throw new CmisRuntimeException("Object Info is missing!");
-        }
+            ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
+            if (objectInfo == null) {
+                throw new CmisRuntimeException("Object Info is missing!");
+            }
+
+            // set headers
+            response.setStatus(HttpServletResponse.SC_OK);
+            response.setContentType(Constants.MEDIATYPE_FEED);
+
+            // write XML
+            AtomFeed feed = new AtomFeed();
+            feed.startDocument(response.getOutputStream(), getNamespaces(service));
+            feed.startFeed(true);
+
+            // write basic Atom feed elements
+            feed.writeFeedElements(objectInfo.getId(), objectInfo.getAtomId(), objectInfo.getCreatedBy(),
+                    objectInfo.getName(), objectInfo.getLastModificationDate(), null, null);
+
+            // write links
+            UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+
+            feed.writeServiceLink(baseUrl.toString(), repositoryId);
+
+            UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_PARENTS, objectInfo.getId());
+            selfLink.addParameter(Constants.PARAM_FILTER, filter);
+            selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+            selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
+            selfLink.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
+            selfLink.addParameter(Constants.PARAM_RELATIVE_PATH_SEGMENT, includeRelativePathSegment);
+            feed.writeSelfLink(selfLink.toString(), null);
 
-        // set headers
-        response.setStatus(HttpServletResponse.SC_OK);
-        response.setContentType(Constants.MEDIATYPE_FEED);
-
-        // write XML
-        AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream(), getNamespaces(service));
-        feed.startFeed(true);
-
-        // write basic Atom feed elements
-        feed.writeFeedElements(objectInfo.getId(), objectInfo.getAtomId(), objectInfo.getCreatedBy(),
-                objectInfo.getName(), objectInfo.getLastModificationDate(), null, null);
-
-        // write links
-        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
-
-        feed.writeServiceLink(baseUrl.toString(), repositoryId);
-
-        UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_PARENTS, objectInfo.getId());
-        selfLink.addParameter(Constants.PARAM_FILTER, filter);
-        selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
-        selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
-        selfLink.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
-        selfLink.addParameter(Constants.PARAM_RELATIVE_PATH_SEGMENT, includeRelativePathSegment);
-        feed.writeSelfLink(selfLink.toString(), null);
-
-        // write entries
-        AtomEntry entry = new AtomEntry(feed.getWriter());
-        for (ObjectParentData object : parents) {
-            if ((object == null) || (object.getObject() == null)) {
-                continue;
+            // write entries
+            AtomEntry entry = new AtomEntry(feed.getWriter());
+            for (ObjectParentData object : parents) {
+                if ((object == null) || (object.getObject() == null)) {
+                    continue;
+                }
+                writeObjectEntry(service, entry, object.getObject(), null, repositoryId, null,
+                        object.getRelativePathSegment(), baseUrl, false, context.getCmisVersion());
             }
-            writeObjectEntry(service, entry, object.getObject(), null, repositoryId, null,
-                    object.getRelativePathSegment(), baseUrl, false, context.getCmisVersion());
-        }
 
-        // we are done
-        feed.endFeed();
-        feed.endDocument();
+            // we are done
+            feed.endFeed();
+            feed.endDocument();
+        }
     }
 
     /**
      * Checked Out Collection GET.
      */
-    public static void getCheckedOutDocs(CallContext context, CmisService service, String repositoryId,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
-        // get parameters
-        String folderId = getStringParameter(request, Constants.PARAM_FOLDER_ID);
-        String filter = getStringParameter(request, Constants.PARAM_FILTER);
-        String orderBy = getStringParameter(request, Constants.PARAM_ORDER_BY);
-        Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
-        IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
-                IncludeRelationships.class);
-        String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
-        BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
-        BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
-
-        // execute
-        ObjectList checkedOut = service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
-                includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, null);
-
-        if (checkedOut == null) {
-            throw new CmisRuntimeException("Checked Out list is null!");
-        }
+    public static class GetCheckedOutDocs extends AbstractAtomPubServiceCall {
+        public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+                HttpServletResponse response) throws Exception {
+            // get parameters
+            String folderId = getStringParameter(request, Constants.PARAM_FOLDER_ID);
+            String filter = getStringParameter(request, Constants.PARAM_FILTER);
+            String orderBy = getStringParameter(request, Constants.PARAM_ORDER_BY);
+            Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
+            IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
+                    IncludeRelationships.class);
+            String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
+            BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
+            BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
+
+            // execute
+            ObjectList checkedOut = service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
+                    includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, null);
 
-        ObjectInfo folderInfo = null;
-        if (folderId != null) {
-            folderInfo = service.getObjectInfo(repositoryId, folderId);
-            if (folderInfo == null) {
-                throw new CmisRuntimeException("Folder Object Info is missing!");
+            if (checkedOut == null) {
+                throw new CmisRuntimeException("Checked Out list is null!");
             }
-        } else {
-            folderInfo = new ObjectInfoImpl();
-            GregorianCalendar now = new GregorianCalendar();
-
-            ((ObjectInfoImpl) folderInfo).setId("uri:x-checkedout");
-            ((ObjectInfoImpl) folderInfo).setName("Checked Out");
-            ((ObjectInfoImpl) folderInfo).setCreatedBy("");
-            ((ObjectInfoImpl) folderInfo).setCreationDate(now);
-            ((ObjectInfoImpl) folderInfo).setLastModificationDate(now);
-            ((ObjectInfoImpl) folderInfo).setHasParent(false);
-            ((ObjectInfoImpl) folderInfo).setSupportsDescendants(false);
-            ((ObjectInfoImpl) folderInfo).setSupportsFolderTree(false);
-        }
 
-        // set headers
-        response.setStatus(HttpServletResponse.SC_OK);
-        response.setContentType(Constants.MEDIATYPE_FEED);
-
-        // write XML
-        AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream(), getNamespaces(service));
-        feed.startFeed(true);
-
-        // write basic Atom feed elements
-        feed.writeFeedElements(folderInfo.getId(), folderInfo.getAtomId(), folderInfo.getCreatedBy(),
-                folderInfo.getName(), folderInfo.getLastModificationDate(), null, checkedOut.getNumItems());
-
-        // write links
-        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
-
-        feed.writeServiceLink(baseUrl.toString(), repositoryId);
-
-        UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_CHECKEDOUT, folderInfo.getId());
-        selfLink.addParameter(Constants.PARAM_FILTER, filter);
-        selfLink.addParameter(Constants.PARAM_ORDER_BY, orderBy);
-        selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
-        selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
-        selfLink.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
-        selfLink.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
-        feed.writeSelfLink(selfLink.toString(), null);
-
-        UrlBuilder pagingUrl = compileUrlBuilder(baseUrl, RESOURCE_CHECKEDOUT, folderInfo.getId());
-        pagingUrl.addParameter(Constants.PARAM_FILTER, filter);
-        pagingUrl.addParameter(Constants.PARAM_ORDER_BY, orderBy);
-        pagingUrl.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
-        pagingUrl.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
-        pagingUrl.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
-        feed.writePagingLinks(pagingUrl, maxItems, skipCount, checkedOut.getNumItems(), checkedOut.hasMoreItems(),
-                AtomPubUtils.PAGE_SIZE);
+            ObjectInfo folderInfo = null;
+            if (folderId != null) {
+                folderInfo = service.getObjectInfo(repositoryId, folderId);
+                if (folderInfo == null) {
+                    throw new CmisRuntimeException("Folder Object Info is missing!");
+                }
+            } else {
+                folderInfo = new ObjectInfoImpl();
+                GregorianCalendar now = new GregorianCalendar();
+
+                ((ObjectInfoImpl) folderInfo).setId("uri:x-checkedout");
+                ((ObjectInfoImpl) folderInfo).setName("Checked Out");
+                ((ObjectInfoImpl) folderInfo).setCreatedBy("");
+                ((ObjectInfoImpl) folderInfo).setCreationDate(now);
+                ((ObjectInfoImpl) folderInfo).setLastModificationDate(now);
+                ((ObjectInfoImpl) folderInfo).setHasParent(false);
+                ((ObjectInfoImpl) folderInfo).setSupportsDescendants(false);
+                ((ObjectInfoImpl) folderInfo).setSupportsFolderTree(false);
+            }
 
-        // write entries
-        if (checkedOut.getObjects() != null) {
-            AtomEntry entry = new AtomEntry(feed.getWriter());
-            for (ObjectData object : checkedOut.getObjects()) {
-                if (object == null) {
-                    continue;
+            // set headers
+            response.setStatus(HttpServletResponse.SC_OK);
+            response.setContentType(Constants.MEDIATYPE_FEED);
+
+            // write XML
+            AtomFeed feed = new AtomFeed();
+            feed.startDocument(response.getOutputStream(), getNamespaces(service));
+            feed.startFeed(true);
+
+            // write basic Atom feed elements
+            feed.writeFeedElements(folderInfo.getId(), folderInfo.getAtomId(), folderInfo.getCreatedBy(),
+                    folderInfo.getName(), folderInfo.getLastModificationDate(), null, checkedOut.getNumItems());
+
+            // write links
+            UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+
+            feed.writeServiceLink(baseUrl.toString(), repositoryId);
+
+            UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_CHECKEDOUT, folderInfo.getId());
+            selfLink.addParameter(Constants.PARAM_FILTER, filter);
+            selfLink.addParameter(Constants.PARAM_ORDER_BY, orderBy);
+            selfLink.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+            selfLink.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
+            selfLink.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
+            selfLink.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
+            feed.writeSelfLink(selfLink.toString(), null);
+
+            UrlBuilder pagingUrl = compileUrlBuilder(baseUrl, RESOURCE_CHECKEDOUT, folderInfo.getId());
+            pagingUrl.addParameter(Constants.PARAM_FILTER, filter);
+            pagingUrl.addParameter(Constants.PARAM_ORDER_BY, orderBy);
+            pagingUrl.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+            pagingUrl.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
+            pagingUrl.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
+            feed.writePagingLinks(pagingUrl, maxItems, skipCount, checkedOut.getNumItems(), checkedOut.hasMoreItems(),
+                    PAGE_SIZE);
+
+            // write entries
+            if (checkedOut.getObjects() != null) {
+                AtomEntry entry = new AtomEntry(feed.getWriter());
+                for (ObjectData object : checkedOut.getObjects()) {
+                    if (object == null) {
+                        continue;
+                    }
+                    writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false,
+                            context.getCmisVersion());
                 }
-                writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false,
-                        context.getCmisVersion());
             }
-        }
 
-        // we are done
-        feed.endFeed();
-        feed.endDocument();
+            // we are done
+            feed.endFeed();
+            feed.endDocument();
+        }
     }
 }



Mime
View raw message