You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by dc...@apache.org on 2010/04/22 18:28:00 UTC
svn commit: r936938 [28/29] - in
/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server:
chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/
chemistry-opencmis-server-bindings/src/main/java/org/apache/chem...
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/MultiFilingServiceWrapper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/MultiFilingServiceWrapper.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/MultiFilingServiceWrapper.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/MultiFilingServiceWrapper.java Thu Apr 22 16:27:57 2010
@@ -32,67 +32,67 @@ import org.apache.chemistry.opencmis.ser
*/
public class MultiFilingServiceWrapper extends AbstractServiceWrapper implements CmisMultiFilingService {
- private CmisMultiFilingService fService;
+ private CmisMultiFilingService fService;
- /**
- * Constructor.
- *
- * @param service
- * the real service object
- */
- public MultiFilingServiceWrapper(CmisMultiFilingService service) {
- if (service == null) {
- throw new IllegalArgumentException("Service must be set!");
- }
-
- fService = service;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisMultiFilingService#addObjectToFolder
- * (org.apache.opencmis .server.spi.CallContext, java.lang.String,
- * java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData addObjectToFolder(CallContext context, String repositoryId, String objectId, String folderId,
- Boolean allVersions, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- checkRepositoryId(repositoryId);
- checkId("Object Id", objectId);
- checkId("Folder Id", folderId);
- allVersions = getDefaultTrue(allVersions);
-
- try {
- return fService.addObjectToFolder(context, repositoryId, objectId, folderId, allVersions, extension,
- objectInfos);
- } catch (Exception e) {
- throw createCmisException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisMultiFilingService#removeObjectFromFolder
- * (org.apache.opencmis .server.spi.CallContext, java.lang.String,
- * java.lang.String, java.lang.String,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData removeObjectFromFolder(CallContext context, String repositoryId, String objectId,
- String folderId, ExtensionsData extension, ObjectInfoHolder objectInfos) {
- checkRepositoryId(repositoryId);
- checkId("Object Id", objectId);
-
- try {
- return fService.removeObjectFromFolder(context, repositoryId, objectId, folderId, extension, objectInfos);
- } catch (Exception e) {
- throw createCmisException(e);
- }
- }
+ /**
+ * Constructor.
+ *
+ * @param service
+ * the real service object
+ */
+ public MultiFilingServiceWrapper(CmisMultiFilingService service) {
+ if (service == null) {
+ throw new IllegalArgumentException("Service must be set!");
+ }
+
+ fService = service;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisMultiFilingService#addObjectToFolder
+ * (org.apache.opencmis .server.spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData addObjectToFolder(CallContext context, String repositoryId, String objectId, String folderId,
+ Boolean allVersions, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ checkRepositoryId(repositoryId);
+ checkId("Object Id", objectId);
+ checkId("Folder Id", folderId);
+ allVersions = getDefaultTrue(allVersions);
+
+ try {
+ return fService.addObjectToFolder(context, repositoryId, objectId, folderId, allVersions, extension,
+ objectInfos);
+ } catch (Exception e) {
+ throw createCmisException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisMultiFilingService#removeObjectFromFolder
+ * (org.apache.opencmis .server.spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.String,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData removeObjectFromFolder(CallContext context, String repositoryId, String objectId,
+ String folderId, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ checkRepositoryId(repositoryId);
+ checkId("Object Id", objectId);
+
+ try {
+ return fService.removeObjectFromFolder(context, repositoryId, objectId, folderId, extension, objectInfos);
+ } catch (Exception e) {
+ throw createCmisException(e);
+ }
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/NavigationServiceWrapper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/NavigationServiceWrapper.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/NavigationServiceWrapper.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/NavigationServiceWrapper.java Thu Apr 22 16:27:57 2010
@@ -40,208 +40,208 @@ import org.apache.chemistry.opencmis.ser
*/
public class NavigationServiceWrapper extends AbstractServiceWrapper implements CmisNavigationService {
- private CmisNavigationService fService;
+ private CmisNavigationService fService;
- /**
- * Constructor.
- *
- * @param service
- * the real service object
- * @param defaultMaxItems
- * default value for <code>maxItems</code> parameters
- * @param defaultDepth
- * default value for <code>depth</code> parameters
- */
- public NavigationServiceWrapper(CmisNavigationService service, BigInteger defaultMaxItems, BigInteger defaultDepth) {
- if (service == null) {
- throw new IllegalArgumentException("Service must be set!");
- }
-
- fService = service;
- setDefaultMaxItems(defaultMaxItems);
- setDefaultDepth(defaultDepth);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getCheckedOutDocs
- * (org.apache.opencmis. server.spi.CallContext, java.lang.String,
- * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
- * java.math.BigInteger, java.math.BigInteger,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectList getCheckedOutDocs(CallContext context, String repositoryId, String folderId, String filter,
- String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension,
- ObjectInfoHolder objectInfos) {
- checkRepositoryId(repositoryId);
- includeAllowableActions = getDefaultFalse(includeAllowableActions);
- includeRelationships = getDefault(includeRelationships);
- renditionFilter = getDefaultRenditionFilter(renditionFilter);
- maxItems = getMaxItems(maxItems);
- skipCount = getSkipCount(skipCount);
-
- try {
- return fService.getCheckedOutDocs(context, repositoryId, folderId, filter, orderBy,
- includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension,
- objectInfos);
- } catch (Exception e) {
- throw createCmisException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getChildren(org.
- * apache.opencmis.server .spi.CallContext, java.lang.String,
- * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
- * java.lang.Boolean, java.math.BigInteger, java.math.BigInteger,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectInFolderList getChildren(CallContext context, String repositoryId, String folderId, String filter,
- String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
- ExtensionsData extension, ObjectInfoHolder objectInfos) {
- checkRepositoryId(repositoryId);
- checkId("Folder Id", folderId);
- includeAllowableActions = getDefaultFalse(includeAllowableActions);
- includeRelationships = getDefault(includeRelationships);
- renditionFilter = getDefaultRenditionFilter(renditionFilter);
- includePathSegment = getDefaultFalse(includePathSegment);
- maxItems = getMaxItems(maxItems);
- skipCount = getSkipCount(skipCount);
-
- try {
- return fService.getChildren(context, repositoryId, folderId, filter, orderBy, includeAllowableActions,
- includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension,
- objectInfos);
- } catch (Exception e) {
- throw createCmisException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getDescendants(org
- * .apache.opencmis.server .spi.CallContext, java.lang.String,
- * java.lang.String, java.math.BigInteger, java.lang.String,
- * java.lang.Boolean,
- * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
- * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public List<ObjectInFolderContainer> getDescendants(CallContext context, String repositoryId, String folderId,
- BigInteger depth, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
- ExtensionsData extension, ObjectInfoHolder objectInfos) {
- checkRepositoryId(repositoryId);
- checkId("Folder Id", folderId);
- depth = getDepth(depth);
- includeAllowableActions = getDefaultFalse(includeAllowableActions);
- includeRelationships = getDefault(includeRelationships);
- renditionFilter = getDefaultRenditionFilter(renditionFilter);
- includePathSegment = getDefaultFalse(includePathSegment);
-
- try {
- return fService.getDescendants(context, repositoryId, folderId, depth, filter, includeAllowableActions,
- includeRelationships, renditionFilter, includePathSegment, extension, objectInfos);
- } catch (Exception e) {
- throw createCmisException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getFolderParent(
- * org.apache.opencmis.server .spi.CallContext, java.lang.String,
- * java.lang.String, java.lang.String,
- * org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public ObjectData getFolderParent(CallContext context, String repositoryId, String folderId, String filter,
- ExtensionsData extension, ObjectInfoHolder objectInfos) {
- checkRepositoryId(repositoryId);
- checkId("Folder Id", folderId);
-
- try {
- return fService.getFolderParent(context, repositoryId, folderId, filter, extension, objectInfos);
- } catch (Exception e) {
- throw createCmisException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getFolderTree(org
- * .apache.opencmis.server .spi.CallContext, java.lang.String,
- * java.lang.String, java.math.BigInteger, java.lang.String,
- * java.lang.Boolean,
- * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
- * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public List<ObjectInFolderContainer> getFolderTree(CallContext context, String repositoryId, String folderId,
- BigInteger depth, String filter, Boolean includeAllowableActions,
- IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
- ExtensionsData extension, ObjectInfoHolder objectInfos) {
- checkRepositoryId(repositoryId);
- checkId("Folder Id", folderId);
- depth = getDepth(depth);
- includeAllowableActions = getDefaultFalse(includeAllowableActions);
- includeRelationships = getDefault(includeRelationships);
- renditionFilter = getDefaultRenditionFilter(renditionFilter);
- includePathSegment = getDefaultFalse(includePathSegment);
-
- try {
- return fService.getFolderTree(context, repositoryId, folderId, depth, filter, includeAllowableActions,
- includeRelationships, renditionFilter, includePathSegment, extension, objectInfos);
- } catch (Exception e) {
- throw createCmisException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.opencmis.server.spi.CmisNavigationService#getObjectParents
- * (org.apache.opencmis.server .spi.CallContext, java.lang.String,
- * java.lang.String, java.lang.String, java.lang.Boolean,
- * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
- * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
- * org.apache.opencmis.server.spi.ObjectInfoHolder)
- */
- public List<ObjectParentData> getObjectParents(CallContext context, String repositoryId, String objectId,
- String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
- String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension,
- ObjectInfoHolder objectInfos) {
- checkRepositoryId(repositoryId);
- checkId("Object Id", objectId);
- includeAllowableActions = getDefaultFalse(includeAllowableActions);
- includeRelationships = getDefault(includeRelationships);
- renditionFilter = getDefaultRenditionFilter(renditionFilter);
- includeRelativePathSegment = getDefaultFalse(includeRelativePathSegment);
-
- try {
- return fService.getObjectParents(context, repositoryId, objectId, filter, includeAllowableActions,
- includeRelationships, renditionFilter, includeRelativePathSegment, extension, objectInfos);
- } catch (Exception e) {
- throw createCmisException(e);
- }
- }
+ /**
+ * Constructor.
+ *
+ * @param service
+ * the real service object
+ * @param defaultMaxItems
+ * default value for <code>maxItems</code> parameters
+ * @param defaultDepth
+ * default value for <code>depth</code> parameters
+ */
+ public NavigationServiceWrapper(CmisNavigationService service, BigInteger defaultMaxItems, BigInteger defaultDepth) {
+ if (service == null) {
+ throw new IllegalArgumentException("Service must be set!");
+ }
+
+ fService = service;
+ setDefaultMaxItems(defaultMaxItems);
+ setDefaultDepth(defaultDepth);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getCheckedOutDocs
+ * (org.apache.opencmis. server.spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.math.BigInteger, java.math.BigInteger,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectList getCheckedOutDocs(CallContext context, String repositoryId, String folderId, String filter,
+ String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension,
+ ObjectInfoHolder objectInfos) {
+ checkRepositoryId(repositoryId);
+ includeAllowableActions = getDefaultFalse(includeAllowableActions);
+ includeRelationships = getDefault(includeRelationships);
+ renditionFilter = getDefaultRenditionFilter(renditionFilter);
+ maxItems = getMaxItems(maxItems);
+ skipCount = getSkipCount(skipCount);
+
+ try {
+ return fService.getCheckedOutDocs(context, repositoryId, folderId, filter, orderBy,
+ includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension,
+ objectInfos);
+ } catch (Exception e) {
+ throw createCmisException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getChildren(org.
+ * apache.opencmis.server .spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, java.math.BigInteger, java.math.BigInteger,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectInFolderList getChildren(CallContext context, String repositoryId, String folderId, String filter,
+ String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
+ ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ checkRepositoryId(repositoryId);
+ checkId("Folder Id", folderId);
+ includeAllowableActions = getDefaultFalse(includeAllowableActions);
+ includeRelationships = getDefault(includeRelationships);
+ renditionFilter = getDefaultRenditionFilter(renditionFilter);
+ includePathSegment = getDefaultFalse(includePathSegment);
+ maxItems = getMaxItems(maxItems);
+ skipCount = getSkipCount(skipCount);
+
+ try {
+ return fService.getChildren(context, repositoryId, folderId, filter, orderBy, includeAllowableActions,
+ includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension,
+ objectInfos);
+ } catch (Exception e) {
+ throw createCmisException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getDescendants(org
+ * .apache.opencmis.server .spi.CallContext, java.lang.String,
+ * java.lang.String, java.math.BigInteger, java.lang.String,
+ * java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public List<ObjectInFolderContainer> getDescendants(CallContext context, String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
+ ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ checkRepositoryId(repositoryId);
+ checkId("Folder Id", folderId);
+ depth = getDepth(depth);
+ includeAllowableActions = getDefaultFalse(includeAllowableActions);
+ includeRelationships = getDefault(includeRelationships);
+ renditionFilter = getDefaultRenditionFilter(renditionFilter);
+ includePathSegment = getDefaultFalse(includePathSegment);
+
+ try {
+ return fService.getDescendants(context, repositoryId, folderId, depth, filter, includeAllowableActions,
+ includeRelationships, renditionFilter, includePathSegment, extension, objectInfos);
+ } catch (Exception e) {
+ throw createCmisException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getFolderParent(
+ * org.apache.opencmis.server .spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.String,
+ * org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public ObjectData getFolderParent(CallContext context, String repositoryId, String folderId, String filter,
+ ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ checkRepositoryId(repositoryId);
+ checkId("Folder Id", folderId);
+
+ try {
+ return fService.getFolderParent(context, repositoryId, folderId, filter, extension, objectInfos);
+ } catch (Exception e) {
+ throw createCmisException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getFolderTree(org
+ * .apache.opencmis.server .spi.CallContext, java.lang.String,
+ * java.lang.String, java.math.BigInteger, java.lang.String,
+ * java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public List<ObjectInFolderContainer> getFolderTree(CallContext context, String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
+ ExtensionsData extension, ObjectInfoHolder objectInfos) {
+ checkRepositoryId(repositoryId);
+ checkId("Folder Id", folderId);
+ depth = getDepth(depth);
+ includeAllowableActions = getDefaultFalse(includeAllowableActions);
+ includeRelationships = getDefault(includeRelationships);
+ renditionFilter = getDefaultRenditionFilter(renditionFilter);
+ includePathSegment = getDefaultFalse(includePathSegment);
+
+ try {
+ return fService.getFolderTree(context, repositoryId, folderId, depth, filter, includeAllowableActions,
+ includeRelationships, renditionFilter, includePathSegment, extension, objectInfos);
+ } catch (Exception e) {
+ throw createCmisException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.server.spi.CmisNavigationService#getObjectParents
+ * (org.apache.opencmis.server .spi.CallContext, java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+ * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+ * org.apache.opencmis.server.spi.ObjectInfoHolder)
+ */
+ public List<ObjectParentData> getObjectParents(CallContext context, String repositoryId, String objectId,
+ String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension,
+ ObjectInfoHolder objectInfos) {
+ checkRepositoryId(repositoryId);
+ checkId("Object Id", objectId);
+ includeAllowableActions = getDefaultFalse(includeAllowableActions);
+ includeRelationships = getDefault(includeRelationships);
+ renditionFilter = getDefaultRenditionFilter(renditionFilter);
+ includeRelativePathSegment = getDefaultFalse(includeRelativePathSegment);
+
+ try {
+ return fService.getObjectParents(context, repositoryId, objectId, filter, includeAllowableActions,
+ includeRelationships, renditionFilter, includeRelativePathSegment, extension, objectInfos);
+ } catch (Exception e) {
+ throw createCmisException(e);
+ }
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/ObjectInfoHelper.java Thu Apr 22 16:27:57 2010
@@ -63,420 +63,420 @@ import org.apache.chemistry.opencmis.ser
*/
public class ObjectInfoHelper {
- private CmisObjectService _objSvc;
- private CmisRepositoryService _repSvc;
- private CmisNavigationService _navSvc;
-
- private Map<String, RepositoryCapabilities> _repos = new HashMap<String, RepositoryCapabilities>();
- private Map<String, Boolean> _mapPolicies = new HashMap<String, Boolean>();
- private Map<String, Boolean> _mapRelationships = new HashMap<String, Boolean>();
-
- public ObjectInfoHelper(CmisRepositoryService repSvc, CmisObjectService objSvc, CmisNavigationService navSvc) {
- _objSvc = objSvc;
- _repSvc = repSvc;
- _navSvc = navSvc;
- }
-
- /**
- * fill an ObjectInfoHolder object with required information needed for Atom
- * binding to be able to generate the necessary links in AtomPub
- *
- * @param context
- * call context of the current request
- * @param repositoryId
- * id of repository
- * @param objectId
- * object to retrieve information for
- * @param objectInfos
- * Holder to fill with information
- */
- public ObjectData fillObjectInfoHolder(CallContext context, String repositoryId, String objectId,
- ObjectInfoHolder objectInfos) {
-
- if (null == objectInfos || null == objectId)
- return null;
-
- // call getObject to get the required information to fill
- // ObjectInfoHolder
- ObjectData objData = getObject(context, repositoryId, objectId);
- fillObjectInfoHolder(context, repositoryId, objData, objectInfos);
-
- return objData; // might be useful as return value in some service
- // methods
- }
-
- /**
- * Fill object in
- *
- * @param context
- * @param repositoryId
- * @param objData
- * @param filter
- * @param objectInfos
- */
- public void fillObjectInfoHolder(CallContext context, String repositoryId, ObjectData objData, String filter,
- ObjectInfoHolder objectInfos) {
- // fill objectInfos
- if (filterContainsRequiredProperties(filter))
- fillObjectInfoHolder(context, repositoryId, objData, objectInfos);
- else
- // get object again as we need almost all system properties
- fillObjectInfoHolder(context, repositoryId, objData.getId(), objectInfos);
- }
-
- public boolean filterContainsRequiredProperties(String filter) {
- if (filter == null)
- return false;
- if (filter.equals("*"))
- return true;
- if (!filter.contains(PropertyIds.NAME))
- return false;
- if (!filter.contains(PropertyIds.CREATED_BY))
- return false;
- if (!filter.contains(PropertyIds.CREATION_DATE))
- return false;
- if (!filter.contains(PropertyIds.LAST_MODIFICATION_DATE))
- return false;
- if (!filter.contains(PropertyIds.OBJECT_TYPE_ID))
- return false;
- if (!filter.contains(PropertyIds.BASE_TYPE_ID))
- return false;
- if (!filter.contains(PropertyIds.CONTENT_STREAM_FILE_NAME))
- return false;
- if (!filter.contains(PropertyIds.CONTENT_STREAM_MIME_TYPE))
- return false;
- if (!filter.contains(PropertyIds.CONTENT_STREAM_ID))
- return false;
- return true;
-
- }
-
- /**
- * fill an ObjectInfoHolder object with required information needed for Atom
- * binding to be able to generate the necessary links in AtomPub
- *
- * @param context
- * call context of the current request
- * @param repositoryId
- * id of repository
- * @param objData
- * object data to grab information from
- * @param objectInfos
- * Holder to fill with information
- */
- public void fillObjectInfoHolder(CallContext context, String repositoryId, ObjectData objData,
- ObjectInfoHolder objectInfos) {
-
- if (null == objData || null == objectInfos)
- return;
-
- // Get required information about the repository and cache it for later
- // use:
-
- Map<String, PropertyData<?>> properties = objData.getProperties().getProperties();
- RepositoryCapabilities repoCaps = _repos.get(repositoryId);
- if (null == repoCaps) {
- RepositoryInfo repoInfo = _repSvc.getRepositoryInfo(null, repositoryId, null);
- repoCaps = repoInfo.getCapabilities();
- _repos.put(repositoryId, repoCaps);
- }
-
- Boolean supportsRelationships = _mapRelationships.get(repositoryId);
- Boolean supportsPolicies = _mapPolicies.get(repositoryId);
- if (null == supportsRelationships || null == supportsPolicies) {
- supportsPolicies = supportsRelationships = false;
- TypeDefinitionList children = _repSvc.getTypeChildren(context, repositoryId, null, false, BigInteger
- .valueOf(100), BigInteger.ZERO, null);
- for (TypeDefinition typeDefinition : children.getList()) {
- if (typeDefinition.getId().equals(BaseTypeId.CMIS_RELATIONSHIP))
- supportsRelationships = true;
- if (typeDefinition.getId().equals(BaseTypeId.CMIS_POLICY))
- supportsPolicies = true;
- }
- _mapRelationships.put(repositoryId, supportsRelationships);
- _mapPolicies.put(repositoryId, supportsPolicies);
- }
-
- ObjectInfoImpl objInfo = new ObjectInfoImpl();
- // Fill all setters:
- objInfo.setId(objData.getId());
- objInfo.setName(getStringProperty(properties, PropertyIds.NAME));
- objInfo.setCreatedBy(getStringProperty(properties, PropertyIds.CREATED_BY));
- objInfo.setCreationDate(getDateProperty(properties, PropertyIds.CREATION_DATE));
- objInfo.setLastModificationDate(getDateProperty(properties, PropertyIds.LAST_MODIFICATION_DATE));
- objInfo.setTypeId(getStringProperty(properties, PropertyIds.OBJECT_TYPE_ID));
- String baseId = getStringProperty(properties, PropertyIds.BASE_TYPE_ID);
- objInfo.setBaseType(BaseTypeId.fromValue(baseId));
-
- boolean isVersioned = getStringProperty(properties, PropertyIds.VERSION_SERIES_ID) != null;
- // versioning information:
- if (isVersioned) {
- objInfo.setIsCurrentVersion(getBooleanProperty(properties, PropertyIds.IS_LATEST_VERSION));
- objInfo.setVersionSeriesId(getStringProperty(properties, PropertyIds.VERSION_SERIES_ID));
- objInfo.setWorkingCopyId(getStringProperty(properties, PropertyIds.VERSION_SERIES_CHECKED_OUT_ID));
- objInfo.setWorkingCopyOriginalId(null);
- } else { // unversioned document
- objInfo.setIsCurrentVersion(true);
- objInfo.setVersionSeriesId(null);
- objInfo.setWorkingCopyId(null);
- objInfo.setWorkingCopyOriginalId(null);
- }
-
- String fileName = getStringProperty(properties, PropertyIds.CONTENT_STREAM_FILE_NAME);
- String mimeType = getStringProperty(properties, PropertyIds.CONTENT_STREAM_MIME_TYPE);
- String streamId = getStringProperty(properties, PropertyIds.CONTENT_STREAM_ID);
- BigInteger length = getIntegerProperty(properties, PropertyIds.CONTENT_STREAM_LENGTH);
- boolean hasContent = fileName != null || mimeType != null || streamId != null || length != null;
- if (hasContent) {
- objInfo.setHasContent(hasContent);
- objInfo.setContentType(mimeType);
- objInfo.setFileName(fileName);
- } else {
- objInfo.setHasContent(false);
- objInfo.setContentType(null);
- objInfo.setFileName(null);
- }
-
- if (objInfo.getBaseType() == BaseTypeId.CMIS_FOLDER)
- objInfo.setHasParent(getStringProperty(properties, PropertyIds.PARENT_ID) != null);
- else if (objInfo.getBaseType() == BaseTypeId.CMIS_DOCUMENT) {
- if (repoCaps.isUnfilingSupported())
- objInfo.setHasParent(documentHasParent(context, repositoryId, objData.getId()));
- else
- objInfo.setHasParent(true);
- } else
- objInfo.setHasParent(false);
-
- // Renditions, currently not supported by in-memory provider
- objInfo.setRenditionInfos(convertRenditions(objData.getRenditions()));
-
- List<String> sourceIds = new ArrayList<String>();
- List<String> targetIds = new ArrayList<String>();
- getRelationshipIds(objData, sourceIds, targetIds);
-
- // Relationships, currently not supported
- objInfo.setSupportsRelationships(supportsRelationships);
- objInfo.setRelationshipSourceIds(sourceIds);
- objInfo.setRelationshipTargetIds(targetIds);
-
- objInfo.setSupportsPolicies(supportsPolicies);
-
- objInfo.setHasAcl(repoCaps.getAclCapability() != CapabilityAcl.NONE);
-
- String baseTypeId = getStringProperty(properties, PropertyIds.BASE_TYPE_ID);
- boolean isFolder = baseTypeId != null && baseTypeId.equals(BaseTypeId.CMIS_FOLDER.value());
-
- objInfo.setSupportsDescendants(isFolder && repoCaps.isGetDescendantsSupported());
- ;
- objInfo.setSupportsFolderTree(isFolder && repoCaps.isGetFolderTreeSupported());
-
- objectInfos.addObjectInfo(objInfo);
- }
-
- /**
- * fill an ObjectInfoHolder object with required information needed for Atom
- * binding to be able to generate the necessary links in AtomPub
- *
- * @param context
- * call context of the current request
- * @param repositoryId
- * id of repository
- * @param objList
- * object list, fill information for each element
- * @param objectInfos
- * Holder to fill with information
- */
- public void fillObjectInfoHolder(CallContext context, String repositoryId, ObjectList objList,
- ObjectInfoHolder objectInfos) {
-
- if (null != objectInfos && null != objList && null != objList.getObjects()) {
- // Fill object information for all children in result list
- List<ObjectData> listObjects = objList.getObjects();
- if (null != listObjects)
- for (ObjectData object : listObjects) {
- fillObjectInfoHolder(context, repositoryId, object.getId(), objectInfos);
- }
- }
- }
-
- /**
- * fill an ObjectInfoHolder object with required information needed for Atom
- * binding to be able to generate the necessary links in AtomPub
- *
- * @param context
- * call context of the current request
- * @param repositoryId
- * id of repository
- * @param objList
- * object list, fill information for each element
- * @param objectInfos
- * Holder to fill with information
- */
- public void fillObjectInfoHolder(CallContext context, String repositoryId, List<ObjectData> objList,
- ObjectInfoHolder objectInfos) {
- if (null == objectInfos || null == objList)
- return;
-
- // Fill object information for all children in result list
- for (ObjectData object : objList) {
- fillObjectInfoHolder(context, repositoryId, object.getId(), objectInfos);
- }
- }
-
- /**
- * fill an ObjectInfoHolder object with required information needed for Atom
- * binding to be able to generate the necessary links in AtomPub
- *
- * @param context
- * call context of the current request
- * @param repositoryId
- * id of repository
- * @param objList
- * object list, fill information for each element
- * @param objectInfos
- * Holder to fill with information
- */
- public void fillObjectInfoHolder(CallContext context, String repositoryId, ObjectInFolderList objList,
- ObjectInfoHolder objectInfos) {
- if (null == objectInfos || null == objList || objList.getObjects() == null)
- return;
-
- // Fill object information for all children in result list
- for (ObjectInFolderData object : objList.getObjects()) {
- fillObjectInfoHolder(context, repositoryId, object.getObject().getId(), objectInfos);
- }
- }
-
- /**
- * fill an ObjectInfoHolder object with required information needed for Atom
- * binding to be able to generate the necessary links in AtomPub
- *
- * @param context
- * call context of the current request
- * @param repositoryId
- * id of repository
- * @param objList
- * object list, fill information for each element
- * @param objectInfos
- * Holder to fill with information
- */
- public void fillObjectInfoHolderObjectParentData(CallContext context, String repositoryId,
- List<ObjectParentData> objParents, ObjectInfoHolder objectInfos) {
- if (null == objectInfos || null == objParents)
- return;
-
- for (ObjectParentData object : objParents) {
- fillObjectInfoHolder(context, repositoryId, object.getObject().getId(), objectInfos);
- }
- }
-
- /**
- * fill an ObjectInfoHolder object with required information needed for Atom
- * binding to be able to generate the necessary links in AtomPub
- *
- * @param context
- * call context of the current request
- * @param repositoryId
- * id of repository
- * @param objList
- * object list, fill information for each element recursively
- * @param objectInfos
- * Holder to fill with information
- */
- public void fillObjectInfoHolderFolderContainer(CallContext context, String repositoryId,
- List<ObjectInFolderContainer> oifcList, ObjectInfoHolder objectInfos) {
- if (null == objectInfos || null == oifcList)
- return;
-
- for (ObjectInFolderContainer object : oifcList) {
- fillObjectInfoHolderFolderContainer(context, repositoryId, object, objectInfos);
- }
- }
-
- private void fillObjectInfoHolderFolderContainer(CallContext context, String repositoryId,
- ObjectInFolderContainer oifc, ObjectInfoHolder objectInfos) {
- if (null == objectInfos || null == oifc || oifc.getObject() == null || oifc.getObject().getObject() == null)
- return;
-
- fillObjectInfoHolder(context, repositoryId, oifc.getObject().getObject(), objectInfos);
-
- if (null != oifc.getChildren())
- for (ObjectInFolderContainer object : oifc.getChildren()) {
- // call recursively
- fillObjectInfoHolderFolderContainer(context, repositoryId, object, objectInfos);
- }
- }
-
- private Boolean getBooleanProperty(Map<String, PropertyData<?>> props, String key) {
- PropertyData<?> pdVal = props.get(key);
- Boolean val = null == pdVal ? null : (Boolean) pdVal.getFirstValue();
- return val;
- }
-
- private String getStringProperty(Map<String, PropertyData<?>> props, String key) {
- PropertyData<?> pdVal = props.get(key);
- String val = null == pdVal ? null : (String) pdVal.getFirstValue();
- return val;
- }
-
- private GregorianCalendar getDateProperty(Map<String, PropertyData<?>> props, String key) {
- PropertyData<?> pdVal = props.get(key);
- GregorianCalendar val = null == pdVal ? null : (GregorianCalendar) pdVal.getFirstValue();
- return val;
- }
-
- private BigInteger getIntegerProperty(Map<String, PropertyData<?>> props, String key) {
- PropertyData<?> pdVal = props.get(key);
- BigInteger val = null == pdVal ? null : (BigInteger) pdVal.getFirstValue();
- return val;
- }
-
- private ObjectData getObject(CallContext context, String repositoryId, String objectId) {
-
- ObjectData od = _objSvc.getObject(context, repositoryId, objectId, null, false, IncludeRelationships.BOTH, "*",
- true, true, null, null);
- return od;
- }
-
- private List<RenditionInfo> convertRenditions(List<RenditionData> renditions) {
-
- if (null == renditions)
- return null;
-
- List<RenditionInfo> rendInfos = new ArrayList<RenditionInfo>(renditions.size());
- RenditionInfoImpl ri = new RenditionInfoImpl();
- for (RenditionData rd : renditions) {
- ri.setContentType(rd.getMimeType());
- ri.setId(rd.getStreamId());
- ri.setKind(rd.getKind());
- ri.setLength(rd.getBigLength());
- ri.setTitle(rd.getTitle());
- rendInfos.add(ri);
- }
- return rendInfos;
- }
-
- private void getRelationshipIds(ObjectData objData, List<String> sourceIds, List<String> targetIds) {
- if (null == objData || null == objData.getRelationships())
- return;
-
- String objectId = objData.getId();
- for (ObjectData rel : objData.getRelationships()) {
- String relId = getStringProperty(rel.getProperties().getProperties(), PropertyIds.OBJECT_ID);
- String sourceId = getStringProperty(rel.getProperties().getProperties(), PropertyIds.SOURCE_ID);
- String targetId = getStringProperty(rel.getProperties().getProperties(), PropertyIds.TARGET_ID);
- if (objectId.equals(sourceId))
- sourceIds.add(relId);
- if (objectId.equals(targetId))
- targetIds.add(relId);
- }
- }
-
- private boolean documentHasParent(CallContext context, String repositoryId, String objectId) {
- List<ObjectParentData> opd = _navSvc.getObjectParents(context, repositoryId, objectId, null, false,
- IncludeRelationships.NONE, null, false, null, null);
+ private CmisObjectService _objSvc;
+ private CmisRepositoryService _repSvc;
+ private CmisNavigationService _navSvc;
+
+ private Map<String, RepositoryCapabilities> _repos = new HashMap<String, RepositoryCapabilities>();
+ private Map<String, Boolean> _mapPolicies = new HashMap<String, Boolean>();
+ private Map<String, Boolean> _mapRelationships = new HashMap<String, Boolean>();
+
+ public ObjectInfoHelper(CmisRepositoryService repSvc, CmisObjectService objSvc, CmisNavigationService navSvc) {
+ _objSvc = objSvc;
+ _repSvc = repSvc;
+ _navSvc = navSvc;
+ }
+
+ /**
+ * fill an ObjectInfoHolder object with required information needed for Atom
+ * binding to be able to generate the necessary links in AtomPub
+ *
+ * @param context
+ * call context of the current request
+ * @param repositoryId
+ * id of repository
+ * @param objectId
+ * object to retrieve information for
+ * @param objectInfos
+ * Holder to fill with information
+ */
+ public ObjectData fillObjectInfoHolder(CallContext context, String repositoryId, String objectId,
+ ObjectInfoHolder objectInfos) {
+
+ if (null == objectInfos || null == objectId)
+ return null;
+
+ // call getObject to get the required information to fill
+ // ObjectInfoHolder
+ ObjectData objData = getObject(context, repositoryId, objectId);
+ fillObjectInfoHolder(context, repositoryId, objData, objectInfos);
+
+ return objData; // might be useful as return value in some service
+ // methods
+ }
+
+ /**
+ * Fill object in
+ *
+ * @param context
+ * @param repositoryId
+ * @param objData
+ * @param filter
+ * @param objectInfos
+ */
+ public void fillObjectInfoHolder(CallContext context, String repositoryId, ObjectData objData, String filter,
+ ObjectInfoHolder objectInfos) {
+ // fill objectInfos
+ if (filterContainsRequiredProperties(filter))
+ fillObjectInfoHolder(context, repositoryId, objData, objectInfos);
+ else
+ // get object again as we need almost all system properties
+ fillObjectInfoHolder(context, repositoryId, objData.getId(), objectInfos);
+ }
+
+ public boolean filterContainsRequiredProperties(String filter) {
+ if (filter == null)
+ return false;
+ if (filter.equals("*"))
+ return true;
+ if (!filter.contains(PropertyIds.NAME))
+ return false;
+ if (!filter.contains(PropertyIds.CREATED_BY))
+ return false;
+ if (!filter.contains(PropertyIds.CREATION_DATE))
+ return false;
+ if (!filter.contains(PropertyIds.LAST_MODIFICATION_DATE))
+ return false;
+ if (!filter.contains(PropertyIds.OBJECT_TYPE_ID))
+ return false;
+ if (!filter.contains(PropertyIds.BASE_TYPE_ID))
+ return false;
+ if (!filter.contains(PropertyIds.CONTENT_STREAM_FILE_NAME))
+ return false;
+ if (!filter.contains(PropertyIds.CONTENT_STREAM_MIME_TYPE))
+ return false;
+ if (!filter.contains(PropertyIds.CONTENT_STREAM_ID))
+ return false;
+ return true;
+
+ }
+
+ /**
+ * fill an ObjectInfoHolder object with required information needed for Atom
+ * binding to be able to generate the necessary links in AtomPub
+ *
+ * @param context
+ * call context of the current request
+ * @param repositoryId
+ * id of repository
+ * @param objData
+ * object data to grab information from
+ * @param objectInfos
+ * Holder to fill with information
+ */
+ public void fillObjectInfoHolder(CallContext context, String repositoryId, ObjectData objData,
+ ObjectInfoHolder objectInfos) {
+
+ if (null == objData || null == objectInfos)
+ return;
+
+ // Get required information about the repository and cache it for later
+ // use:
+
+ Map<String, PropertyData<?>> properties = objData.getProperties().getProperties();
+ RepositoryCapabilities repoCaps = _repos.get(repositoryId);
+ if (null == repoCaps) {
+ RepositoryInfo repoInfo = _repSvc.getRepositoryInfo(null, repositoryId, null);
+ repoCaps = repoInfo.getCapabilities();
+ _repos.put(repositoryId, repoCaps);
+ }
+
+ Boolean supportsRelationships = _mapRelationships.get(repositoryId);
+ Boolean supportsPolicies = _mapPolicies.get(repositoryId);
+ if (null == supportsRelationships || null == supportsPolicies) {
+ supportsPolicies = supportsRelationships = false;
+ TypeDefinitionList children = _repSvc.getTypeChildren(context, repositoryId, null, false, BigInteger
+ .valueOf(100), BigInteger.ZERO, null);
+ for (TypeDefinition typeDefinition : children.getList()) {
+ if (typeDefinition.getId().equals(BaseTypeId.CMIS_RELATIONSHIP))
+ supportsRelationships = true;
+ if (typeDefinition.getId().equals(BaseTypeId.CMIS_POLICY))
+ supportsPolicies = true;
+ }
+ _mapRelationships.put(repositoryId, supportsRelationships);
+ _mapPolicies.put(repositoryId, supportsPolicies);
+ }
+
+ ObjectInfoImpl objInfo = new ObjectInfoImpl();
+ // Fill all setters:
+ objInfo.setId(objData.getId());
+ objInfo.setName(getStringProperty(properties, PropertyIds.NAME));
+ objInfo.setCreatedBy(getStringProperty(properties, PropertyIds.CREATED_BY));
+ objInfo.setCreationDate(getDateProperty(properties, PropertyIds.CREATION_DATE));
+ objInfo.setLastModificationDate(getDateProperty(properties, PropertyIds.LAST_MODIFICATION_DATE));
+ objInfo.setTypeId(getStringProperty(properties, PropertyIds.OBJECT_TYPE_ID));
+ String baseId = getStringProperty(properties, PropertyIds.BASE_TYPE_ID);
+ objInfo.setBaseType(BaseTypeId.fromValue(baseId));
+
+ boolean isVersioned = getStringProperty(properties, PropertyIds.VERSION_SERIES_ID) != null;
+ // versioning information:
+ if (isVersioned) {
+ objInfo.setIsCurrentVersion(getBooleanProperty(properties, PropertyIds.IS_LATEST_VERSION));
+ objInfo.setVersionSeriesId(getStringProperty(properties, PropertyIds.VERSION_SERIES_ID));
+ objInfo.setWorkingCopyId(getStringProperty(properties, PropertyIds.VERSION_SERIES_CHECKED_OUT_ID));
+ objInfo.setWorkingCopyOriginalId(null);
+ } else { // unversioned document
+ objInfo.setIsCurrentVersion(true);
+ objInfo.setVersionSeriesId(null);
+ objInfo.setWorkingCopyId(null);
+ objInfo.setWorkingCopyOriginalId(null);
+ }
+
+ String fileName = getStringProperty(properties, PropertyIds.CONTENT_STREAM_FILE_NAME);
+ String mimeType = getStringProperty(properties, PropertyIds.CONTENT_STREAM_MIME_TYPE);
+ String streamId = getStringProperty(properties, PropertyIds.CONTENT_STREAM_ID);
+ BigInteger length = getIntegerProperty(properties, PropertyIds.CONTENT_STREAM_LENGTH);
+ boolean hasContent = fileName != null || mimeType != null || streamId != null || length != null;
+ if (hasContent) {
+ objInfo.setHasContent(hasContent);
+ objInfo.setContentType(mimeType);
+ objInfo.setFileName(fileName);
+ } else {
+ objInfo.setHasContent(false);
+ objInfo.setContentType(null);
+ objInfo.setFileName(null);
+ }
+
+ if (objInfo.getBaseType() == BaseTypeId.CMIS_FOLDER)
+ objInfo.setHasParent(getStringProperty(properties, PropertyIds.PARENT_ID) != null);
+ else if (objInfo.getBaseType() == BaseTypeId.CMIS_DOCUMENT) {
+ if (repoCaps.isUnfilingSupported())
+ objInfo.setHasParent(documentHasParent(context, repositoryId, objData.getId()));
+ else
+ objInfo.setHasParent(true);
+ } else
+ objInfo.setHasParent(false);
+
+ // Renditions, currently not supported by in-memory provider
+ objInfo.setRenditionInfos(convertRenditions(objData.getRenditions()));
+
+ List<String> sourceIds = new ArrayList<String>();
+ List<String> targetIds = new ArrayList<String>();
+ getRelationshipIds(objData, sourceIds, targetIds);
+
+ // Relationships, currently not supported
+ objInfo.setSupportsRelationships(supportsRelationships);
+ objInfo.setRelationshipSourceIds(sourceIds);
+ objInfo.setRelationshipTargetIds(targetIds);
+
+ objInfo.setSupportsPolicies(supportsPolicies);
+
+ objInfo.setHasAcl(repoCaps.getAclCapability() != CapabilityAcl.NONE);
+
+ String baseTypeId = getStringProperty(properties, PropertyIds.BASE_TYPE_ID);
+ boolean isFolder = baseTypeId != null && baseTypeId.equals(BaseTypeId.CMIS_FOLDER.value());
+
+ objInfo.setSupportsDescendants(isFolder && repoCaps.isGetDescendantsSupported());
+ ;
+ objInfo.setSupportsFolderTree(isFolder && repoCaps.isGetFolderTreeSupported());
+
+ objectInfos.addObjectInfo(objInfo);
+ }
+
+ /**
+ * fill an ObjectInfoHolder object with required information needed for Atom
+ * binding to be able to generate the necessary links in AtomPub
+ *
+ * @param context
+ * call context of the current request
+ * @param repositoryId
+ * id of repository
+ * @param objList
+ * object list, fill information for each element
+ * @param objectInfos
+ * Holder to fill with information
+ */
+ public void fillObjectInfoHolder(CallContext context, String repositoryId, ObjectList objList,
+ ObjectInfoHolder objectInfos) {
+
+ if (null != objectInfos && null != objList && null != objList.getObjects()) {
+ // Fill object information for all children in result list
+ List<ObjectData> listObjects = objList.getObjects();
+ if (null != listObjects)
+ for (ObjectData object : listObjects) {
+ fillObjectInfoHolder(context, repositoryId, object.getId(), objectInfos);
+ }
+ }
+ }
+
+ /**
+ * fill an ObjectInfoHolder object with required information needed for Atom
+ * binding to be able to generate the necessary links in AtomPub
+ *
+ * @param context
+ * call context of the current request
+ * @param repositoryId
+ * id of repository
+ * @param objList
+ * object list, fill information for each element
+ * @param objectInfos
+ * Holder to fill with information
+ */
+ public void fillObjectInfoHolder(CallContext context, String repositoryId, List<ObjectData> objList,
+ ObjectInfoHolder objectInfos) {
+ if (null == objectInfos || null == objList)
+ return;
+
+ // Fill object information for all children in result list
+ for (ObjectData object : objList) {
+ fillObjectInfoHolder(context, repositoryId, object.getId(), objectInfos);
+ }
+ }
+
+ /**
+ * fill an ObjectInfoHolder object with required information needed for Atom
+ * binding to be able to generate the necessary links in AtomPub
+ *
+ * @param context
+ * call context of the current request
+ * @param repositoryId
+ * id of repository
+ * @param objList
+ * object list, fill information for each element
+ * @param objectInfos
+ * Holder to fill with information
+ */
+ public void fillObjectInfoHolder(CallContext context, String repositoryId, ObjectInFolderList objList,
+ ObjectInfoHolder objectInfos) {
+ if (null == objectInfos || null == objList || objList.getObjects() == null)
+ return;
+
+ // Fill object information for all children in result list
+ for (ObjectInFolderData object : objList.getObjects()) {
+ fillObjectInfoHolder(context, repositoryId, object.getObject().getId(), objectInfos);
+ }
+ }
+
+ /**
+ * fill an ObjectInfoHolder object with required information needed for Atom
+ * binding to be able to generate the necessary links in AtomPub
+ *
+ * @param context
+ * call context of the current request
+ * @param repositoryId
+ * id of repository
+ * @param objList
+ * object list, fill information for each element
+ * @param objectInfos
+ * Holder to fill with information
+ */
+ public void fillObjectInfoHolderObjectParentData(CallContext context, String repositoryId,
+ List<ObjectParentData> objParents, ObjectInfoHolder objectInfos) {
+ if (null == objectInfos || null == objParents)
+ return;
+
+ for (ObjectParentData object : objParents) {
+ fillObjectInfoHolder(context, repositoryId, object.getObject().getId(), objectInfos);
+ }
+ }
+
+ /**
+ * fill an ObjectInfoHolder object with required information needed for Atom
+ * binding to be able to generate the necessary links in AtomPub
+ *
+ * @param context
+ * call context of the current request
+ * @param repositoryId
+ * id of repository
+ * @param objList
+ * object list, fill information for each element recursively
+ * @param objectInfos
+ * Holder to fill with information
+ */
+ public void fillObjectInfoHolderFolderContainer(CallContext context, String repositoryId,
+ List<ObjectInFolderContainer> oifcList, ObjectInfoHolder objectInfos) {
+ if (null == objectInfos || null == oifcList)
+ return;
+
+ for (ObjectInFolderContainer object : oifcList) {
+ fillObjectInfoHolderFolderContainer(context, repositoryId, object, objectInfos);
+ }
+ }
+
+ private void fillObjectInfoHolderFolderContainer(CallContext context, String repositoryId,
+ ObjectInFolderContainer oifc, ObjectInfoHolder objectInfos) {
+ if (null == objectInfos || null == oifc || oifc.getObject() == null || oifc.getObject().getObject() == null)
+ return;
+
+ fillObjectInfoHolder(context, repositoryId, oifc.getObject().getObject(), objectInfos);
+
+ if (null != oifc.getChildren())
+ for (ObjectInFolderContainer object : oifc.getChildren()) {
+ // call recursively
+ fillObjectInfoHolderFolderContainer(context, repositoryId, object, objectInfos);
+ }
+ }
+
+ private Boolean getBooleanProperty(Map<String, PropertyData<?>> props, String key) {
+ PropertyData<?> pdVal = props.get(key);
+ Boolean val = null == pdVal ? null : (Boolean) pdVal.getFirstValue();
+ return val;
+ }
+
+ private String getStringProperty(Map<String, PropertyData<?>> props, String key) {
+ PropertyData<?> pdVal = props.get(key);
+ String val = null == pdVal ? null : (String) pdVal.getFirstValue();
+ return val;
+ }
+
+ private GregorianCalendar getDateProperty(Map<String, PropertyData<?>> props, String key) {
+ PropertyData<?> pdVal = props.get(key);
+ GregorianCalendar val = null == pdVal ? null : (GregorianCalendar) pdVal.getFirstValue();
+ return val;
+ }
+
+ private BigInteger getIntegerProperty(Map<String, PropertyData<?>> props, String key) {
+ PropertyData<?> pdVal = props.get(key);
+ BigInteger val = null == pdVal ? null : (BigInteger) pdVal.getFirstValue();
+ return val;
+ }
+
+ private ObjectData getObject(CallContext context, String repositoryId, String objectId) {
+
+ ObjectData od = _objSvc.getObject(context, repositoryId, objectId, null, false, IncludeRelationships.BOTH, "*",
+ true, true, null, null);
+ return od;
+ }
+
+ private List<RenditionInfo> convertRenditions(List<RenditionData> renditions) {
+
+ if (null == renditions)
+ return null;
+
+ List<RenditionInfo> rendInfos = new ArrayList<RenditionInfo>(renditions.size());
+ RenditionInfoImpl ri = new RenditionInfoImpl();
+ for (RenditionData rd : renditions) {
+ ri.setContentType(rd.getMimeType());
+ ri.setId(rd.getStreamId());
+ ri.setKind(rd.getKind());
+ ri.setLength(rd.getBigLength());
+ ri.setTitle(rd.getTitle());
+ rendInfos.add(ri);
+ }
+ return rendInfos;
+ }
+
+ private void getRelationshipIds(ObjectData objData, List<String> sourceIds, List<String> targetIds) {
+ if (null == objData || null == objData.getRelationships())
+ return;
+
+ String objectId = objData.getId();
+ for (ObjectData rel : objData.getRelationships()) {
+ String relId = getStringProperty(rel.getProperties().getProperties(), PropertyIds.OBJECT_ID);
+ String sourceId = getStringProperty(rel.getProperties().getProperties(), PropertyIds.SOURCE_ID);
+ String targetId = getStringProperty(rel.getProperties().getProperties(), PropertyIds.TARGET_ID);
+ if (objectId.equals(sourceId))
+ sourceIds.add(relId);
+ if (objectId.equals(targetId))
+ targetIds.add(relId);
+ }
+ }
+
+ private boolean documentHasParent(CallContext context, String repositoryId, String objectId) {
+ List<ObjectParentData> opd = _navSvc.getObjectParents(context, repositoryId, objectId, null, false,
+ IncludeRelationships.NONE, null, false, null, null);
- return opd != null && opd.size() > 0;
- }
+ return opd != null && opd.size() > 0;
+ }
}