chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1370026 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: query/ storedobj/impl/ types/
Date Mon, 06 Aug 2012 21:22:54 GMT
Author: jens
Date: Mon Aug  6 21:22:53 2012
New Revision: 1370026

URL: http://svn.apache.org/viewvc?rev=1370026&view=rev
Log:
InMemory bug fixes: return score() 1.0 and not 100, Versioning: create by default major version,
text search: restrict to mime type text/

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.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/query/InMemoryQueryProcessor.java?rev=1370026&r1=1370025&r2=1370026&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java
Mon Aug  6 21:22:53 2012
@@ -41,6 +41,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.Cardinality;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.enums.PropertyType;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Content;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
@@ -603,14 +604,20 @@ public class InMemoryQueryProcessor {
         }
         
         private boolean findText(String nodeText) {
-            Content cont;
+            Content cont = (Content)so;
             String pattern = StringUtil.unescape(nodeText, null);
-            if (so instanceof Content && (cont=(Content)so).hasContent()) {
+            if (null == pattern)
+            	throw new CmisInvalidArgumentException("Illegal Escape sequence in text search
expression " + nodeText);
+            
+            if (so instanceof Content && cont.hasContent()) {
                 ContentStreamDataImpl cdi = (ContentStreamDataImpl) cont.getContent(0, -1);
-                byte[] ba = cdi.getBytes();
-                String text = new String(ba);
-                int match = text.indexOf(pattern);
-                return match >= 0;
+                if (cdi.getMimeType().startsWith("text/")) {
+	                byte[] ba = cdi.getBytes();
+	                String text = new String(ba);
+	                int match = text.indexOf(pattern);
+	                return match >= 0;
+                } else
+                	return false;
             }
             return false;
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.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/DocumentVersionImpl.java?rev=1370026&r1=1370025&r2=1370026&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
Mon Aug  6 21:22:53 2012
@@ -58,7 +58,7 @@ public class DocumentVersionImpl extends
         setRepositoryId(repositoryId);
         fContainer = container;
         setContent(content, false);
-        fIsMajor = verState == VersioningState.MAJOR;
+        fIsMajor = verState == VersioningState.MAJOR || verState == null;
         fIsPwc = verState == VersioningState.CHECKEDOUT;
         fProperties = new HashMap<String, PropertyData<?>>(); // ensure that
we
         // have a map

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.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/DocumentTypeCreationHelper.java?rev=1370026&r1=1370025&r2=1370026&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
Mon Aug  6 21:22:53 2012
@@ -143,6 +143,7 @@ public class DocumentTypeCreationHelper 
 
         PropertyIdDefinitionImpl propId = PropertyCreationHelper.createIdDefinition(PropertyIds.VERSION_SERIES_ID,
                 "Version Series Id", Updatability.READONLY);
+        propId.setIsQueryable(false);
         propertyDefinitions.put(propId.getId(), propId);
 
         propB = PropertyCreationHelper.createBooleanDefinition(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT,

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=1370026&r1=1370025&r2=1370026&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
Mon Aug  6 21:22:53 2012
@@ -35,6 +35,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 import org.apache.chemistry.opencmis.commons.data.Properties;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
+import org.apache.chemistry.opencmis.commons.data.PropertyDecimal;
 import org.apache.chemistry.opencmis.commons.data.PropertyInteger;
 import org.apache.chemistry.opencmis.commons.definitions.Choice;
 import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
@@ -301,9 +302,9 @@ public class PropertyCreationHelper {
         // add functions:
         BindingsObjectFactory objFactory = new BindingsObjectFactoryImpl();
         for (Entry<String, String> funcEntry : requestedFuncs.entrySet()) {
-            PropertyInteger pi = objFactory.createPropertyIntegerData(funcEntry.getValue(),
BigInteger.valueOf(100));
+            PropertyDecimal pd = objFactory.createPropertyDecimalData(funcEntry.getValue(),
BigDecimal.valueOf(1.0));
             // fixed dummy value
-            mappedProperties.put(funcEntry.getKey(), pi);
+            mappedProperties.put(funcEntry.getKey(), pd);
         }
 
         Properties props = new PropertiesImpl(mappedProperties.values());



Mime
View raw message