[exo-jcr-commits] exo-jcr SVN: r3928 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl/core/query/lucene and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sun Feb 6 11:30:32 EST 2011
Author: tolusha
Date: 2011-02-06 11:30:31 -0500 (Sun, 06 Feb 2011)
New Revision: 3928
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NodeDataIndexing.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
Log:
EXOJCR-1104: allow to get property directly from NodeDataIndexing
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NodeDataIndexing.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NodeDataIndexing.java 2011-02-05 15:50:17 UTC (rev 3927)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NodeDataIndexing.java 2011-02-06 16:30:31 UTC (rev 3928)
@@ -21,7 +21,8 @@
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.dataflow.ItemDataVisitor;
-import java.util.List;
+import java.util.Collection;
+import java.util.Map;
import javax.jcr.RepositoryException;
@@ -37,7 +38,7 @@
{
private final NodeData nodeData;
- private final List<PropertyData> properties;
+ private final Map<String, PropertyData> properties;
/**
* Constructor NodeDataIndexing.
@@ -50,22 +51,33 @@
/**
* Constructor NodeDataIndexing.
*/
- public NodeDataIndexing(NodeData nodeData, List<PropertyData> properties)
+ public NodeDataIndexing(NodeData nodeData, Map<String, PropertyData> properties)
{
this.nodeData = nodeData;
this.properties = properties;
}
/**
+ * List of properties data.
*
- * @return
+ * @return Collection
*/
- public List<PropertyData> getChildPropertiesData()
+ public Collection<PropertyData> getChildPropertiesData()
{
- return properties;
+ return properties == null ? null : properties.values();
}
/**
+ * Property data.
+ *
+ * @return PropertyData
+ */
+ public PropertyData getProperty(String name)
+ {
+ return properties == null ? null : properties.get(name);
+ }
+
+ /**
* {@inheritDoc}
*/
public QPath getQPath()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2011-02-05 15:50:17 UTC (rev 3927)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2011-02-06 16:30:31 UTC (rev 3928)
@@ -48,6 +48,7 @@
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@@ -219,7 +220,7 @@
// unknown uri<->prefix mappings
}
- List<PropertyData> props = node.getChildPropertiesData();
+ Collection<PropertyData> props = node.getChildPropertiesData();
if (props == null)
{
props = stateProvider.listChildPropertiesData(node);
@@ -327,9 +328,14 @@
{
// seems nt:file found, try for nt:resource props
- PropertyData pmime =
- (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_MIMETYPE, 0),
- ItemType.PROPERTY);
+ PropertyData pmime = node.getProperty(Constants.JCR_MIMETYPE.getAsString());
+ if (pmime == null)
+ {
+ pmime =
+ (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_MIMETYPE, 0),
+ ItemType.PROPERTY);
+ }
+
if (pmime != null)
{
// ok, have a reader
@@ -354,9 +360,13 @@
}
// check the jcr:encoding property
- PropertyData encProp =
+ PropertyData encProp = node.getProperty(Constants.JCR_ENCODING.getAsString());
+ if (encProp == null)
+ {
+ encProp =
(PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0),
- ItemType.PROPERTY);
+ ItemType.PROPERTY);
+ }
String encoding = null;
if (encProp != null)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-02-05 15:50:17 UTC (rev 3927)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-02-06 16:30:31 UTC (rev 3928)
@@ -2595,12 +2595,12 @@
}
}
- // build node data
+ // build node data. No need to load ACL. The node will be pushed directly for reindexing.
NodeData nodeData =
new PersistedNodeData(getIdentifier(tempNode.cid), parentPath, getIdentifier(parentCid),
tempNode.cversion, tempNode.cnordernumb, ptName, mixins.toArray(new InternalQName[mixins.size()]), null);
- List<PropertyData> childProps = new ArrayList<PropertyData>();
+ Map<String, PropertyData> childProps = new HashMap<String, PropertyData>();
for (String propName : tempNode.properties.keySet())
{
ExtendedTempPropertyData prop = (ExtendedTempPropertyData)tempNode.properties.get(propName).first();
@@ -2638,7 +2638,7 @@
new PersistedPropertyData(identifier, qpath, tempNode.cid, prop.version, prop.type, prop.multi,
valueData);
- childProps.add(pdata);
+ childProps.put(propName, pdata);
}
return new NodeDataIndexing(nodeData, childProps);
More information about the exo-jcr-commits
mailing list