Author: fmui
Date: Tue Dec 18 19:46:17 2012
New Revision: 1423601
URL: http://svn.apache.org/viewvc?rev=1423601&view=rev
Log:
CMIS 1.1: secondary types and bulk update improvements
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/TypeCache.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ServerTypeCacheImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java?rev=1423601&r1=1423600&r2=1423601&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ClientTypeCacheImpl.java
Tue Dec 18 19:46:17 2012
@@ -20,6 +20,7 @@ package org.apache.chemistry.opencmis.cl
import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
import org.apache.chemistry.opencmis.client.bindings.impl.TypeDefinitionCache;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
import org.apache.chemistry.opencmis.commons.impl.TypeCache;
@@ -53,4 +54,7 @@ public class ClientTypeCacheImpl impleme
return null;
}
+ public PropertyDefinition<?> getPropertyDefinition(String propId) {
+ return null;
+ }
}
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/TypeCache.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/TypeCache.java?rev=1423601&r1=1423600&r2=1423601&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/TypeCache.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/TypeCache.java
Tue Dec 18 19:46:17 2012
@@ -18,6 +18,7 @@
*/
package org.apache.chemistry.opencmis.commons.impl;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
/**
@@ -25,13 +26,18 @@ import org.apache.chemistry.opencmis.com
*/
public interface TypeCache {
- /**
- * Gets the type definition by type id.
- */
- public TypeDefinition getTypeDefinition(String typeId);
+ /**
+ * Gets the type definition by type id.
+ */
+ TypeDefinition getTypeDefinition(String typeId);
- /**
- * Gets the type definition of an object.
- */
- public TypeDefinition getTypeDefinitionForObject(String objectId);
+ /**
+ * Gets the type definition of an object.
+ */
+ TypeDefinition getTypeDefinitionForObject(String objectId);
+
+ /**
+ * Finds the property definition in all cached types.
+ */
+ PropertyDefinition<?> getPropertyDefinition(String propId);
}
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.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/browser/BrowserBindingUtils.java?rev=1423601&r1=1423600&r2=1423601&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java
Tue Dec 18 19:46:17 2012
@@ -207,7 +207,7 @@ public final class BrowserBindingUtils {
return (T) value;
}
- public static Properties createProperties(ControlParser controlParser,
String typeId, TypeCache typeCache) {
+ public static Properties createNewProperties(ControlParser controlParser,
TypeCache typeCache) {
List<String> propertyIds =
controlParser.getValues(Constants.CONTROL_PROP_ID);
if (propertyIds == null) {
return null;
@@ -217,33 +217,125 @@ public final class BrowserBindingUtils {
Map<Integer, Map<Integer, String>> multiValuePropertyMap =
controlParser
.getTwoDimMap(Constants.CONTROL_PROP_VALUE);
- if (typeId == null) {
- // it's a create call -> find type id in properties
+ // load types
+ int i = 0;
+ for (String propertId : propertyIds) {
+ if (PropertyIds.OBJECT_TYPE_ID.equals(propertId) &&
singleValuePropertyMap != null) {
+ String typeId = singleValuePropertyMap.get(i);
+ if (typeId != null) {
+ TypeDefinition typeDef =
typeCache.getTypeDefinition(typeId);
+ if (typeDef == null) {
+ throw new CmisInvalidArgumentException("Invalid type:
" + typeId);
+ }
+ }
+ }
+
+ if (PropertyIds.SECONDARY_OBJECT_TYPE_IDS.equals(propertId) &&
multiValuePropertyMap != null) {
+ Map<Integer, String> values = multiValuePropertyMap.get(i);
+ if (values != null) {
+ for (String secTypeId : values.values()) {
+ TypeDefinition typeDef =
typeCache.getTypeDefinition(secTypeId);
+ if (typeDef == null) {
+ throw new CmisInvalidArgumentException("Invalid
secondary type: " + secTypeId);
+ }
+ }
+ }
+ }
+
+ i++;
+ }
+
+ // create properties
+ PropertiesImpl result = new PropertiesImpl();
+
+ i = 0;
+ for (String propertyId : propertyIds) {
+ PropertyDefinition<?> propDef =
typeCache.getPropertyDefinition(propertyId);
+ if (propDef == null) {
+ throw new CmisInvalidArgumentException(propertyId + " is
unknown!");
+ }
+
+ PropertyData<?> propertyData = null;
+
+ if (singleValuePropertyMap != null &&
singleValuePropertyMap.containsKey(i)) {
+ propertyData = createPropertyData(propDef,
singleValuePropertyMap.get(i));
+ } else if (multiValuePropertyMap != null &&
multiValuePropertyMap.containsKey(i)) {
+ propertyData = createPropertyData(propDef,
controlParser.getValues(Constants.CONTROL_PROP_VALUE, i));
+ } else {
+ propertyData = createPropertyData(propDef, null);
+ }
+
+ result.addProperty(propertyData);
+
+ i++;
+ }
+
+ return result;
+ }
+
+ public static Properties createUpdateProperties(ControlParser
controlParser, String typeId,
+ List<String> secondaryTypeIds, List<String> objectIds, TypeCache
typeCache) {
+ List<String> propertyIds =
controlParser.getValues(Constants.CONTROL_PROP_ID);
+ if (propertyIds == null) {
+ return null;
+ }
+
+ Map<Integer, String> singleValuePropertyMap =
controlParser.getOneDimMap(Constants.CONTROL_PROP_VALUE);
+ Map<Integer, Map<Integer, String>> multiValuePropertyMap =
controlParser
+ .getTwoDimMap(Constants.CONTROL_PROP_VALUE);
+
+ // get type definition
+ if (typeId != null) {
+ TypeDefinition typeDef = typeCache.getTypeDefinition(typeId);
+ if (typeDef == null) {
+ throw new CmisInvalidArgumentException("Invalid type: " +
typeId);
+ }
+ }
+
+ // get secondary type definition
+ if (multiValuePropertyMap != null) {
int i = 0;
for (String propertId : propertyIds) {
- if (PropertyIds.OBJECT_TYPE_ID.equals(propertId)) {
- typeId = singleValuePropertyMap.get(i);
- break;
+ if (PropertyIds.SECONDARY_OBJECT_TYPE_IDS.equals(propertId)) {
+ Map<Integer, String> values = multiValuePropertyMap.get(i);
+ if (values != null) {
+ for (String secTypeId : values.values()) {
+ TypeDefinition typeDef =
typeCache.getTypeDefinition(secTypeId);
+ if (typeDef == null) {
+ throw new
CmisInvalidArgumentException("Invalid secondary type: " + secTypeId);
+ }
+ }
+ }
}
i++;
}
-
- if (typeId == null) {
- throw new
CmisInvalidArgumentException(PropertyIds.OBJECT_TYPE_ID + " not set!");
- }
}
- TypeDefinition typeDef = typeCache.getTypeDefinition(typeId);
- if (typeDef == null) {
- throw new CmisInvalidArgumentException("Invalid type: " + typeId);
+ if (secondaryTypeIds != null) {
+ for (String secTypeId : secondaryTypeIds) {
+ TypeDefinition typeDef =
typeCache.getTypeDefinition(secTypeId);
+ if (typeDef == null) {
+ throw new CmisInvalidArgumentException("Invalid secondary
type: " + secTypeId);
+ }
+ }
}
+ // create properties
PropertiesImpl result = new PropertiesImpl();
int i = 0;
for (String propertyId : propertyIds) {
- PropertyDefinition<?> propDef =
typeDef.getPropertyDefinitions().get(propertyId);
+ PropertyDefinition<?> propDef =
typeCache.getPropertyDefinition(propertyId);
+ if (propDef == null && objectIds != null) {
+ for (String objectId : objectIds) {
+ TypeDefinition typeDef =
typeCache.getTypeDefinitionForObject(objectId);
+ propDef = typeDef.getPropertyDefinitions().get(propertyId);
+ if (propDef != null) {
+ break;
+ }
+ }
+ }
if (propDef == null) {
throw new CmisInvalidArgumentException(propertyId + " is
unknown!");
}
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.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/browser/ObjectService.java?rev=1423601&r1=1423600&r2=1423601&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
Tue Dec 18 19:46:17 2012
@@ -41,8 +41,10 @@ import static org.apache.chemistry.openc
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createAddAcl;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createContentStream;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createCookieValue;
+import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createNewProperties;
+
+import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createUpdateProperties;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createPolicies;
-import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createProperties;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createRemoveAcl;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.getSimpleObject;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setCookie;
@@ -61,6 +63,7 @@ import java.io.OutputStream;
import java.math.BigInteger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
@@ -70,6 +73,7 @@ import javax.servlet.http.HttpServletRes
import org.apache.chemistry.opencmis.commons.PropertyIds;
import org.apache.chemistry.opencmis.commons.data.AllowableActions;
+import
org.apache.chemistry.opencmis.commons.data.BulkUpdateObjectIdAndChangeToken;
import org.apache.chemistry.opencmis.commons.data.ContentStream;
import org.apache.chemistry.opencmis.commons.data.FailedToDeleteData;
import org.apache.chemistry.opencmis.commons.data.LastModifiedContentStream;
@@ -77,16 +81,18 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.data.Properties;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.data.RenditionData;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
-import
org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
+import
org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.impl.Constants;
import org.apache.chemistry.opencmis.commons.impl.JSONConverter;
import org.apache.chemistry.opencmis.commons.impl.MimeHelper;
import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
import org.apache.chemistry.opencmis.commons.impl.TypeCache;
+import
org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateObjectIdAndChangeTokenImpl;
import org.apache.chemistry.opencmis.commons.impl.json.JSONArray;
import org.apache.chemistry.opencmis.commons.impl.json.JSONObject;
import org.apache.chemistry.opencmis.commons.server.CallContext;
@@ -118,7 +124,7 @@ public final class ObjectService {
ControlParser cp = new ControlParser(request);
TypeCache typeCache = new ServerTypeCacheImpl(repositoryId, service);
- String newObjectId = service.createDocument(repositoryId,
createProperties(cp, null, typeCache), folderId,
+ String newObjectId = service.createDocument(repositoryId,
createNewProperties(cp, typeCache), folderId,
createContentStream(request), versioningState,
createPolicies(cp), createAddAcl(cp),
createRemoveAcl(cp), null);
@@ -160,8 +166,8 @@ public final class ObjectService {
}
String newObjectId = service.createDocumentFromSource(repositoryId,
sourceId,
- createProperties(cp, sourceTypeId.getFirstValue().toString(),
typeCache), folderId, versioningState,
- createPolicies(cp), createAddAcl(cp), createRemoveAcl(cp),
null);
+ createUpdateProperties(cp,
sourceTypeId.getFirstValue().toString(), null, null, typeCache), folderId,
+ versioningState, createPolicies(cp), createAddAcl(cp),
createRemoveAcl(cp), null);
ObjectData object = getSimpleObject(service, repositoryId,
newObjectId);
if (object == null) {
@@ -192,7 +198,7 @@ public final class ObjectService {
ControlParser cp = new ControlParser(request);
TypeCache typeCache = new ServerTypeCacheImpl(repositoryId, service);
- String newObjectId = service.createFolder(repositoryId,
createProperties(cp, null, typeCache), folderId,
+ String newObjectId = service.createFolder(repositoryId,
createNewProperties(cp, typeCache), folderId,
createPolicies(cp), createAddAcl(cp), createRemoveAcl(cp),
null);
ObjectData object = getSimpleObject(service, repositoryId,
newObjectId);
@@ -224,7 +230,7 @@ public final class ObjectService {
ControlParser cp = new ControlParser(request);
TypeCache typeCache = new ServerTypeCacheImpl(repositoryId, service);
- String newObjectId = service.createPolicy(repositoryId,
createProperties(cp, null, typeCache), folderId,
+ String newObjectId = service.createPolicy(repositoryId,
createNewProperties(cp, typeCache), folderId,
createPolicies(cp), createAddAcl(cp), createRemoveAcl(cp),
null);
ObjectData object = getSimpleObject(service, repositoryId,
newObjectId);
@@ -256,7 +262,7 @@ public final class ObjectService {
ControlParser cp = new ControlParser(request);
TypeCache typeCache = new ServerTypeCacheImpl(repositoryId, service);
- String newObjectId = service.createItem(repositoryId,
createProperties(cp, null, typeCache), folderId,
+ String newObjectId = service.createItem(repositoryId,
createNewProperties(cp, typeCache), folderId,
createPolicies(cp), createAddAcl(cp), createRemoveAcl(cp),
null);
ObjectData object = getSimpleObject(service, repositoryId,
newObjectId);
@@ -287,7 +293,7 @@ public final class ObjectService {
ControlParser cp = new ControlParser(request);
TypeCache typeCache = new ServerTypeCacheImpl(repositoryId, service);
- String newObjectId = service.createRelationship(repositoryId,
createProperties(cp, null, typeCache),
+ String newObjectId = service.createRelationship(repositoryId,
createNewProperties(cp, typeCache),
createPolicies(cp), createAddAcl(cp), createRemoveAcl(cp),
null);
ObjectData object = getSimpleObject(service, repositoryId,
newObjectId);
@@ -324,7 +330,7 @@ public final class ObjectService {
Holder<String> changeTokenHolder = (changeToken == null ? null : new
Holder<String>(changeToken));
service.updateProperties(repositoryId, objectIdHolder,
changeTokenHolder,
- createProperties(cp, typeId, typeCache), null);
+ createUpdateProperties(cp, typeId, null, null, typeCache),
null);
String newObjectId = (objectIdHolder.getValue() == null ? objectId :
objectIdHolder.getValue());
@@ -352,28 +358,52 @@ public final class ObjectService {
*/
public static void bulkUpdateProperties(CallContext context, CmisService
service, String repositoryId,
HttpServletRequest request, HttpServletResponse response) throws
Exception {
+ ControlParser cp = new ControlParser(request);
+
+ // get object ids and change tokens
+ List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeToken = new
ArrayList<BulkUpdateObjectIdAndChangeToken>();
+
+ List<String> objectIds = cp.getValues(Constants.CONTROL_OBJECT_ID);
+ List<String> changeTokens =
cp.getValues(Constants.CONTROL_CHANGE_TOKEN);
- throw new CmisNotSupportedException("Not supported!");
+ if (objectIds == null || objectIds.size() == 0) {
+ throw new CmisInvalidArgumentException("No object ids provided!");
+ }
+
+ int n = objectIds.size();
+ for (int i = 0; i < n; i++) {
+ String id = objectIds.get(i);
+ String changeToken = (changeTokens != null && changeTokens.size()
> i ? changeTokens.get(i) : null);
+ objectIdAndChangeToken.add(new
BulkUpdateObjectIdAndChangeTokenImpl(id, changeToken));
+ }
- // ControlParser cp = new ControlParser(request);
- //
- // List<BulkUpdateObjectIdAndChangeToken> result =
- // service.bulkUpdateProperties(repositoryId,
- // objectIdAndChangeToken, properties,
- // cp.getValues(Constants.CONTROL_ADD_SECONDARY_TYPE),
- // cp.getValues(Constants.CONTROL_REMOVE_SECONDARY_TYPE), null);
- //
- // JSONArray jsonList = new JSONArray();
- // if (result != null) {
- // for (BulkUpdateObjectIdAndChangeToken oc : result) {
- // if (oc != null) {
- // jsonList.add(JSONConverter.convert(oc));
- // }
- // }
- // }
- //
- // response.setStatus(HttpServletResponse.SC_OK);
- // writeJSON(jsonList, request, response);
+ // get secondary type ids
+ List<String> addSecondaryTypes =
cp.getValues(Constants.CONTROL_ADD_SECONDARY_TYPE);
+ List<String> removeSecondaryTypes =
cp.getValues(Constants.CONTROL_REMOVE_SECONDARY_TYPE);
+
+ // compile properties
+ TypeCache typeCache = new ServerTypeCacheImpl(repositoryId, service);
+
+ // TODO: fix this!
+ TypeDefinition typeDef =
typeCache.getTypeDefinitionForObject(objectIds.get(0));
+ Properties properties = createUpdateProperties(cp, typeDef.getId(),
addSecondaryTypes, objectIds, typeCache);
+
+ // execute
+ List<BulkUpdateObjectIdAndChangeToken> result =
service.bulkUpdateProperties(repositoryId,
+ objectIdAndChangeToken, properties, addSecondaryTypes,
removeSecondaryTypes, null);
+
+ // return result
+ JSONArray jsonList = new JSONArray();
+ if (result != null) {
+ for (BulkUpdateObjectIdAndChangeToken oc : result) {
+ if (oc != null) {
+ jsonList.add(JSONConverter.convert(oc));
+ }
+ }
+ }
+
+ response.setStatus(HttpServletResponse.SC_OK);
+ writeJSON(jsonList, request, response);
}
/**
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ServerTypeCacheImpl.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/browser/ServerTypeCacheImpl.java?rev=1423601&r1=1423600&r2=1423601&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ServerTypeCacheImpl.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ServerTypeCacheImpl.java
Tue Dec 18 19:46:17 2012
@@ -25,6 +25,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.data.ObjectData;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.data.PropertyId;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
import org.apache.chemistry.opencmis.commons.impl.TypeCache;
@@ -81,4 +82,15 @@ public class ServerTypeCacheImpl impleme
return type;
}
+
+ public PropertyDefinition<?> getPropertyDefinition(String propId) {
+ for (TypeDefinition typeDef : typeDefinitions.values()) {
+ PropertyDefinition<?> propDef =
typeDef.getPropertyDefinitions().get(propId);
+ if (propDef != null) {
+ return propDef;
+ }
+ }
+
+ return null;
+ }
}
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.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/browser/VersioningService.java?rev=1423601&r1=1423600&r2=1423601&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
Tue Dec 18 19:46:17 2012
@@ -32,7 +32,7 @@ import static org.apache.chemistry.openc
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createContentStream;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createCookieValue;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createPolicies;
-import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createProperties;
+import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createUpdateProperties;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createRemoveAcl;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.getSimpleObject;
import static
org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setCookie;
@@ -134,7 +134,7 @@ public final class VersioningService {
TypeCache typeCache = new ServerTypeCacheImpl(repositoryId, service);
Holder<String> objectIdHolder = new Holder<String>(objectId);
- service.checkIn(repositoryId, objectIdHolder, major,
createProperties(cp, typeId, typeCache),
+ service.checkIn(repositoryId, objectIdHolder, major,
createUpdateProperties(cp, typeId, null, null, typeCache),
createContentStream(request), checkinComment,
createPolicies(cp), createAddAcl(cp),
createRemoveAcl(cp), null);