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 2010/07/23 21:36:20 UTC
svn commit: r967219 - in
/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory:
storedobj/impl/StoredObjectImpl.java types/PropertyCreationHelper.java
Author: jens
Date: Fri Jul 23 19:36:20 2010
New Revision: 967219
URL: http://svn.apache.org/viewvc?rev=967219&view=rev
Log:
InMemory: Fix bug in buiding query result: fill PropertyData objects with query names, fix bug in evaluating SELECTed properties of custom properties
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
Modified: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=967219&r1=967218&r2=967219&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java Fri Jul 23 19:36:20 2010
@@ -315,7 +315,8 @@ public class StoredObjectImpl implements
// add custom properties of type definition to the collection
if (null != fProperties) {
for (Entry<String, PropertyData<?>> prop : fProperties.entrySet()) {
- properties.put(prop.getKey(), prop.getValue());
+ if (FilterParser.isContainedInFilter(prop.getKey(), requestedIds))
+ properties.put(prop.getKey(), prop.getValue());
}
}
}
Modified: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java?rev=967219&r1=967218&r2=967219&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java Fri Jul 23 19:36:20 2010
@@ -40,6 +40,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.Updatability;
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
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.BindingsObjectFactoryImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChoiceImpl;
@@ -250,15 +251,24 @@ public class PropertyCreationHelper {
}
}
- // replace all ids with query names or alias:
Map<String, PropertyData<?>> mappedProperties = new HashMap<String, PropertyData<?>>();
- for (Map.Entry<String, PropertyData<?>> prop : properties.entrySet()) {
- String key = requestedIds.get(prop.getKey());
- if (key == null)
- key = prop.getKey();
- mappedProperties.put(key, prop.getValue());
+ if (requestedIds.containsKey("*")) {
+ for (Map.Entry<String, PropertyData<?>> prop : properties.entrySet()) {
+ // map property id to property query name
+ String queryName = td.getPropertyDefinitions().get(prop.getKey()).getQueryName();
+ AbstractPropertyData<?> ad = (AbstractPropertyData<?>) prop.getValue(); // a bit dirty
+ ad.setQueryName(queryName);
+ mappedProperties.put(queryName, prop.getValue());
+ }
+ } else {
+ // replace all ids with query names or alias:
+ for (Map.Entry<String, PropertyData<?>> prop : properties.entrySet()) {
+ String queryNameOrAlias = requestedIds.get(prop.getKey());
+ AbstractPropertyData<?> ad = (AbstractPropertyData<?>) prop.getValue(); // a bit dirty
+ ad.setQueryName(queryNameOrAlias);
+ mappedProperties.put(queryNameOrAlias, prop.getValue());
+ }
}
-
// add functions:
BindingsObjectFactory objFactory = new BindingsObjectFactoryImpl();
for (String func : requestedFuncs.keySet()) {