You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2011/10/13 18:33:48 UTC
svn commit: r1182963 - in
/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src:
main/java/org/apache/chemistry/opencmis/inmemory/
main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/
main/java/org/apach...
Author: jens
Date: Thu Oct 13 16:33:47 2011
New Revision: 1182963
URL: http://svn.apache.org/viewvc?rev=1182963&view=rev
Log:
Fix a couiple of TCK failurs for InMemory Server
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java Thu Oct 13 16:33:47 2011
@@ -80,8 +80,10 @@ public class DataObjectCreator {
AllowableActionsImpl allowableActions = new AllowableActionsImpl();
Set<Action> set = allowableActions.getAllowableActions();
- set.add(Action.CAN_DELETE_OBJECT);
- set.add(Action.CAN_UPDATE_PROPERTIES);
+ if (!isRootFolder) {
+ set.add(Action.CAN_DELETE_OBJECT);
+ set.add(Action.CAN_UPDATE_PROPERTIES);
+ }
if (isFolder || isDocument) {
set.add(Action.CAN_GET_PROPERTIES);
@@ -94,16 +96,14 @@ public class DataObjectCreator {
if (isFolder) {
if (!isRootFolder) {
set.add(Action.CAN_GET_FOLDER_PARENT);
+ set.add(Action.CAN_DELETE_TREE);
}
set.add(Action.CAN_GET_FOLDER_TREE);
set.add(Action.CAN_GET_DESCENDANTS);
- set.add(Action.CAN_ADD_OBJECT_TO_FOLDER);
- set.add(Action.CAN_REMOVE_OBJECT_FROM_FOLDER);
set.add(Action.CAN_CREATE_DOCUMENT);
set.add(Action.CAN_CREATE_FOLDER);
set.add(Action.CAN_GET_CHILDREN);
- set.add(Action.CAN_DELETE_TREE);
}
if (hasContent) {
@@ -125,6 +125,8 @@ public class DataObjectCreator {
}
if (isDocument) {
+ set.add(Action.CAN_ADD_OBJECT_TO_FOLDER);
+ set.add(Action.CAN_REMOVE_OBJECT_FROM_FOLDER);
set.add(Action.CAN_SET_CONTENT_STREAM);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java Thu Oct 13 16:33:47 2011
@@ -81,7 +81,10 @@ public abstract class AbstractMultiFilin
}
public List<Folder> getParents() {
- return fParents;
+ if (null == fParents)
+ return Collections.emptyList();
+ else
+ return fParents;
}
/*
@@ -92,7 +95,7 @@ public abstract class AbstractMultiFilin
*/
public List<Folder> getParents(String user) {
if (null == fParents)
- return null;
+ return Collections.emptyList();
else if (null == user)
return Collections.unmodifiableList(fParents);
else {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java Thu Oct 13 16:33:47 2011
@@ -19,6 +19,7 @@
package org.apache.chemistry.opencmis.inmemory.storedobj.impl;
import java.io.IOException;
+import java.math.BigInteger;
import java.util.List;
import java.util.Map;
@@ -30,6 +31,7 @@ import org.apache.chemistry.opencmis.inm
import org.apache.chemistry.opencmis.inmemory.ConfigurationSettings;
import org.apache.chemistry.opencmis.inmemory.FilterParser;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.Document;
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -95,27 +97,77 @@ public class DocumentImpl extends Abstra
// but the spec requires some
// properties always to be set
+// if (FilterParser.isContainedInFilter(PropertyIds.PARENT_ID, requestedIds)) {
+// List<Folder> parents = getParents();
+// String parentId = parents == null || parents.isEmpty() ? null : parents.get(0).getId();
+// if (parentId != null) {
+// properties.put(PropertyIds.PARENT_ID, objFactory.createPropertyIdData(PropertyIds.PARENT_ID,
+// parentId));
+// }
+// }
+
if (FilterParser.isContainedInFilter(PropertyIds.IS_IMMUTABLE, requestedIds)) {
properties.put(PropertyIds.IS_IMMUTABLE, objFactory.createPropertyBooleanData(PropertyIds.IS_IMMUTABLE,
false));
}
// Set the content related properties
- if (null != fContent) {
- if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_FILE_NAME, requestedIds)) {
- properties.put(PropertyIds.CONTENT_STREAM_FILE_NAME, objFactory.createPropertyStringData(
- PropertyIds.CONTENT_STREAM_FILE_NAME, fContent.getFileName()));
- }
- // omit: PropertyIds.CMIS_CONTENT_STREAM_ID
- if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_LENGTH, requestedIds)) {
- properties.put(PropertyIds.CONTENT_STREAM_LENGTH, objFactory.createPropertyIntegerData(
- PropertyIds.CONTENT_STREAM_LENGTH, fContent.getBigLength()));
- }
- if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_MIME_TYPE, requestedIds)) {
- properties.put(PropertyIds.CONTENT_STREAM_MIME_TYPE, objFactory.createPropertyStringData(
- PropertyIds.CONTENT_STREAM_MIME_TYPE, fContent.getMimeType()));
- }
+ if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_FILE_NAME, requestedIds)) {
+ properties.put(PropertyIds.CONTENT_STREAM_FILE_NAME, objFactory.createPropertyStringData(
+ PropertyIds.CONTENT_STREAM_FILE_NAME, null != fContent ? fContent.getFileName() : (String)null) );
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_LENGTH, requestedIds)) {
+ properties.put(PropertyIds.CONTENT_STREAM_ID, objFactory.createPropertyStringData(
+ PropertyIds.CONTENT_STREAM_ID, (String) null));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_LENGTH, requestedIds)) {
+ properties.put(PropertyIds.CONTENT_STREAM_LENGTH, objFactory.createPropertyIntegerData(
+ PropertyIds.CONTENT_STREAM_LENGTH, null != fContent ? fContent.getBigLength() : BigInteger.ZERO));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_MIME_TYPE, requestedIds)) {
+ properties.put(PropertyIds.CONTENT_STREAM_MIME_TYPE, objFactory.createPropertyStringData(
+ PropertyIds.CONTENT_STREAM_MIME_TYPE, null != fContent ? fContent.getMimeType() : (String)null) );
+ }
+
+ // Spec requires versioning properties even for unversioned documents
+ // overwrite the version related properties
+ if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_ID, requestedIds)) {
+ properties.put(PropertyIds.VERSION_SERIES_ID, objFactory.createPropertyIdData(
+ PropertyIds.VERSION_SERIES_ID, (String)null));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, requestedIds)) {
+ properties.put(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, objFactory.createPropertyBooleanData(
+ PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, false));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, requestedIds)) {
+ properties.put(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, objFactory.createPropertyStringData(
+ PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, (String)null));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, requestedIds)) {
+ properties.put(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, objFactory.createPropertyIdData(
+ PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, (String)null));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.IS_LATEST_VERSION, requestedIds)) {
+ properties.put(PropertyIds.IS_LATEST_VERSION, objFactory.createPropertyBooleanData(
+ PropertyIds.IS_LATEST_VERSION, true));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.IS_MAJOR_VERSION, requestedIds)) {
+ properties.put(PropertyIds.IS_MAJOR_VERSION, objFactory.createPropertyBooleanData(
+ PropertyIds.IS_MAJOR_VERSION, true));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.IS_LATEST_MAJOR_VERSION, requestedIds)) {
+ properties.put(PropertyIds.IS_LATEST_MAJOR_VERSION, objFactory.createPropertyBooleanData(
+ PropertyIds.IS_LATEST_MAJOR_VERSION, true));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.CHECKIN_COMMENT, requestedIds)) {
+ properties.put(PropertyIds.CHECKIN_COMMENT, objFactory.createPropertyStringData(
+ PropertyIds.CHECKIN_COMMENT, (String )null));
+ }
+ if (FilterParser.isContainedInFilter(PropertyIds.VERSION_LABEL, requestedIds)) {
+ properties.put(PropertyIds.VERSION_LABEL, objFactory.createPropertyStringData(PropertyIds.VERSION_LABEL,
+ (String) null));
}
+
}
public boolean hasContent() {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java Thu Oct 13 16:33:47 2011
@@ -186,10 +186,8 @@ public class FolderImpl extends Abstract
if (FilterParser.isContainedInFilter(PropertyIds.PARENT_ID, requestedIds)) {
String parentId = getParent() == null ? null : getParent().getId();
- if (parentId != null) {
- properties.put(PropertyIds.PARENT_ID, objFactory.createPropertyIdData(PropertyIds.PARENT_ID,
- parentId));
- }
+ properties.put(PropertyIds.PARENT_ID, objFactory.createPropertyIdData(PropertyIds.PARENT_ID,
+ parentId));
}
if (FilterParser.isContainedInFilter(PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS, requestedIds)) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java Thu Oct 13 16:33:47 2011
@@ -30,6 +30,7 @@ public class InMemoryAce {
private final String principalId;
private Permission permission;
+ private static InMemoryAce DEFAULT_ACE = new InMemoryAce(InMemoryAce.getAnyoneUser(), Permission.ALL);
public static final String getAnyoneUser() {
return "anyone";
@@ -38,7 +39,11 @@ public class InMemoryAce {
public static final String getAnonymousUser() {
return "anonymous";
}
-
+
+ public static final InMemoryAce getDefaultAce() {
+ return DEFAULT_ACE;
+ }
+
public InMemoryAce(Ace commonsAce) {
if (null == commonsAce || null == commonsAce.getPrincipalId() || null == commonsAce.getPermissions())
throw new IllegalArgumentException("Cannot create InMemoryAce with null value");
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java Thu Oct 13 16:33:47 2011
@@ -63,7 +63,7 @@ public class InMemoryAcl {
public static InMemoryAcl getDefaultAcl() {
List<InMemoryAce> defaultAcl = new ArrayList<InMemoryAce>();
- defaultAcl.add(new InMemoryAce(InMemoryAce.getAnyoneUser(), Permission.ALL));
+ defaultAcl.add(InMemoryAce.getDefaultAce());
return new InMemoryAcl(defaultAcl);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java Thu Oct 13 16:33:47 2011
@@ -378,6 +378,8 @@ public class ObjectStoreImpl implements
if (null != addACEs)
for (Ace ace: addACEs.getAces()) {
InMemoryAce inMemAce = new InMemoryAce(ace);
+ if (inMemAce.equals(InMemoryAce.getDefaultAce()))
+ return 0; // if everyone has full access there is no need to add additional ACLs.
newAcl.addAce(inMemAce);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java Thu Oct 13 16:33:47 2011
@@ -22,6 +22,7 @@ import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -43,6 +44,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
import org.apache.chemistry.opencmis.commons.enums.CapabilityRenditions;
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+import org.apache.chemistry.opencmis.commons.enums.SupportedPermissions;
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AclCapabilitiesDataImpl;
@@ -215,7 +217,7 @@ public class StoreManagerImpl implements
return null;
}
- RepositoryInfo repoInfo = createDefaultRepositoryInfo(repositoryId);
+ RepositoryInfo repoInfo = createRepositoryInfo(repositoryId);
return repoInfo;
}
@@ -256,7 +258,7 @@ public class StoreManagerImpl implements
}
} else {
// create a default repository info
- createDefaultRepositoryInfo(repositoryId);
+ createRepositoryInfo(repositoryId);
}
}
@@ -310,7 +312,7 @@ public class StoreManagerImpl implements
typeManager.initTypeSystem(typeDefs);
}
- private RepositoryInfo createDefaultRepositoryInfo(String repositoryId) {
+ private RepositoryInfo createRepositoryInfo(String repositoryId) {
ObjectStore objStore = getObjectStore(repositoryId);
String rootFolderId = objStore.getRootFolder().getId();
// repository info
@@ -320,14 +322,13 @@ public class StoreManagerImpl implements
repoInfo.setName("InMemory Repository");
repoInfo.setDescription("InMemory Test Repository");
repoInfo.setCmisVersionSupported("1.0");
- repoInfo.setCapabilities(null);
repoInfo.setRootFolder(rootFolderId);
repoInfo.setPrincipalAnonymous(InMemoryAce.getAnonymousUser());
repoInfo.setPrincipalAnyone(InMemoryAce.getAnyoneUser());
- repoInfo.setThinClientUri(null);
+ repoInfo.setThinClientUri("");
repoInfo.setChangesIncomplete(Boolean.TRUE);
repoInfo.setChangesOnType(null);
- repoInfo.setLatestChangeLogToken(null);
+ repoInfo.setLatestChangeLogToken(Long.valueOf(new Date(0).getTime()).toString());
repoInfo.setVendorName("OpenCMIS");
repoInfo.setProductName("OpenCMIS InMemory-Server");
repoInfo.setProductVersion("0.1");
@@ -336,8 +337,7 @@ public class StoreManagerImpl implements
RepositoryCapabilitiesImpl caps = new RepositoryCapabilitiesImpl();
caps.setAllVersionsSearchable(false);
caps.setCapabilityAcl(CapabilityAcl.MANAGE);
- caps.setCapabilityChanges(CapabilityChanges.PROPERTIES); // just for
- // testing
+ caps.setCapabilityChanges(CapabilityChanges.NONE);
caps.setCapabilityContentStreamUpdates(CapabilityContentStreamUpdates.PWCONLY);
caps.setCapabilityJoin(CapabilityJoin.NONE);
caps.setCapabilityQuery(CapabilityQuery.BOTHCOMBINED);
@@ -353,8 +353,7 @@ public class StoreManagerImpl implements
AclCapabilitiesDataImpl aclCaps = new AclCapabilitiesDataImpl();
aclCaps.setAclPropagation(AclPropagation.OBJECTONLY);
- aclCaps.setPermissionDefinitionData(null);
- aclCaps.setPermissionMappingData(null);
+ aclCaps.setSupportedPermissions(SupportedPermissions.BASIC);
// permissions
List<PermissionDefinition> permissions = new ArrayList<PermissionDefinition>();
@@ -362,7 +361,7 @@ public class StoreManagerImpl implements
permissions.add(createPermission(CMIS_WRITE, "Write"));
permissions.add(createPermission(CMIS_ALL, "All"));
aclCaps.setPermissionDefinitionData(permissions);
-
+
// mapping
List<PermissionMapping> list = new ArrayList<PermissionMapping>();
list.add(createMapping(PermissionMapping.CAN_GET_DESCENDENTS_FOLDER, CMIS_READ));
@@ -406,6 +405,7 @@ public class StoreManagerImpl implements
}
aclCaps.setPermissionMappingData(map);
+
repoInfo.setAclCapabilities(aclCaps);
repoInfo.setCapabilities(caps);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java Thu Oct 13 16:33:47 2011
@@ -33,6 +33,8 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
import org.apache.chemistry.opencmis.commons.data.ObjectList;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
import org.apache.chemistry.opencmis.inmemory.DataObjectCreator;
@@ -202,6 +204,7 @@ public class StoredObjectImpl implements
}
}
}
+
}
// ///////////////////////////////////////////
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java Thu Oct 13 16:33:47 2011
@@ -18,16 +18,17 @@
*/
package org.apache.chemistry.opencmis.inmemory.types;
+import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.chemistry.opencmis.commons.data.Ace;
import org.apache.chemistry.opencmis.commons.data.Acl;
import org.apache.chemistry.opencmis.commons.data.AllowableActions;
import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
@@ -46,21 +47,26 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyData;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyDefinition;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlPrincipalDataImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChoiceImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriImpl;
import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
import org.apache.chemistry.opencmis.inmemory.DataObjectCreator;
import org.apache.chemistry.opencmis.inmemory.FilterParser;
@@ -211,6 +217,16 @@ public class PropertyCreationHelper {
baseTypeId));
}
}
+
+ // fill not-set properties from type definition (as spec requires)
+ Map<String, PropertyDefinition<?>> propDefs = td.getPropertyDefinitions();
+ for (PropertyDefinition<?> propDef : propDefs.values()) {
+ if (!properties.containsKey(propDef.getId()))
+ properties.put(propDef.getId(), getEmptyValue(propDef));
+ }
+
+
+
List<PropertyData<?>> propertiesList = new ArrayList<PropertyData<?>>(properties.values());
if (fillOptionalPropertyData) { // add query name, local name, display name
@@ -373,6 +389,7 @@ public class PropertyCreationHelper {
} else {
prop.setDisplayName(displayName);
}
+ prop.setDescription( "This is a " + prop.getDisplayName() + " property.");
prop.setLocalName(id);
prop.setLocalNamespace("local");
prop.setQueryName(id);
@@ -381,6 +398,7 @@ public class PropertyCreationHelper {
prop.setIsOpenChoice(false);
prop.setIsQueryable(true);
prop.setIsRequired(false);
+ prop.setIsOrderable(true);
prop.setPropertyType(propType);
prop.setUpdatability(Updatability.READWRITE);
}
@@ -403,4 +421,24 @@ public class PropertyCreationHelper {
}
}
+ private static PropertyData<?> getEmptyValue(PropertyDefinition<?> propDef) {
+ if (propDef.getPropertyType().equals(PropertyType.BOOLEAN))
+ return new PropertyBooleanImpl(propDef.getId(), (Boolean) null);
+ else if (propDef.getPropertyType().equals(PropertyType.DATETIME))
+ return new PropertyDateTimeImpl(propDef.getId(), (GregorianCalendar) null);
+ else if (propDef.getPropertyType().equals(PropertyType.DECIMAL))
+ return new PropertyDecimalImpl(propDef.getId(), (BigDecimal) null);
+ else if (propDef.getPropertyType().equals(PropertyType.HTML))
+ return new PropertyHtmlImpl(propDef.getId(), (String) null);
+ else if (propDef.getPropertyType().equals(PropertyType.ID))
+ return new PropertyIdImpl(propDef.getId(), (String) null);
+ else if (propDef.getPropertyType().equals(PropertyType.INTEGER))
+ return new PropertyIntegerImpl(propDef.getId(), (BigInteger) null);
+ else if (propDef.getPropertyType().equals(PropertyType.STRING))
+ return new PropertyStringImpl(propDef.getId(), (String) null);
+ else if (propDef.getPropertyType().equals(PropertyType.URI))
+ return new PropertyUriImpl(propDef.getId(), (String) null);
+ else
+ return null;
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java?rev=1182963&r1=1182962&r2=1182963&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java Thu Oct 13 16:33:47 2011
@@ -696,7 +696,7 @@ public class ObjectServiceTest extends A
log.info(" return property id: " + pd2.getId() + ", value: " + pd2.getValues());
}
pd = props.get(TEST_DOCUMENT_MY_STRING_PROP_ID);
- assertNull(pd);
+ assertNull(pd.getFirstValue());
// delete a required property and expect exception:
properties = new ArrayList<PropertyData<?>>();
properties.add(fFactory.createPropertyIntegerData(TEST_DOCUMENT_MY_INT_PROP_ID, (BigInteger) null));
@@ -899,8 +899,8 @@ public class ObjectServiceTest extends A
assertFalse(actions.contains(Action.CAN_GET_CONTENT_STREAM));
assertFalse(actions.contains(Action.CAN_GET_RENDITIONS));
}
- assertFalse(actions.contains(Action.CAN_ADD_OBJECT_TO_FOLDER));
- assertFalse(actions.contains(Action.CAN_REMOVE_OBJECT_FROM_FOLDER));
+ assertTrue(actions.contains(Action.CAN_ADD_OBJECT_TO_FOLDER));
+ assertTrue(actions.contains(Action.CAN_REMOVE_OBJECT_FROM_FOLDER));
if (isVersioned) {
assertTrue(actions.contains(Action.CAN_CANCEL_CHECK_OUT));