[exo-jcr-commits] exo-jcr SVN: r1141 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation: db and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Dec 21 11:49:12 EST 2009
Author: sergiykarpenko
Date: 2009-12-21 11:49:11 -0500 (Mon, 21 Dec 2009)
New Revision: 1141
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/DBConstants.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
Log:
EXOJCR-302: GET_PROPERTIES_BY_PARENTID and FIND_ITEM_BY_NAME new queries added
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/DBConstants.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/DBConstants.java 2009-12-21 16:41:15 UTC (rev 1140)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/DBConstants.java 2009-12-21 16:49:11 UTC (rev 1141)
@@ -153,6 +153,11 @@
protected String FIND_PROPERTIES_BY_PARENTID;
/**
+ * FIND_PROPERTIES_BY_PARENTID_NEW.
+ */
+ protected String GET_PROPERTIES_BY_PARENTID;
+
+ /**
* INSERT_NODE.
*/
protected String INSERT_NODE;
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCStorageConnection.java 2009-12-21 16:41:15 UTC (rev 1140)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCStorageConnection.java 2009-12-21 16:49:11 UTC (rev 1141)
@@ -642,6 +642,15 @@
children.add((PropertyData)itemData(parent.getQPath(), prop, I_CLASS_PROPERTY, null));
return children;
+
+ //TODO mine
+ // ResultSet prop = getChildPropertiesByParentIdentifier(getInternalId(parent.getIdentifier()));
+ // List<PropertyData> children = new ArrayList<PropertyData>();
+ // while (prop.next())
+ // children.add(loadPropertyRecord(prop, parent.getQPath()));
+ //
+ // return children;
+
}
catch (SQLException e)
{
@@ -655,6 +664,8 @@
/**
* {@inheritDoc}
+ *
+ * TODO left as current
*/
public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException
{
@@ -1818,7 +1829,6 @@
try
{
-
int cptype = item.getInt(COLUMN_PTYPE);
boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
try
@@ -1840,7 +1850,6 @@
data.add(vdata);
}
while (item.next() && item.getString(COLUMN_ID) == cid);
- //TODO avoid situation when there is valueDatas from another property (impossible but exception throwing need)
PersistedPropertyData pdata =
new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, data);
@@ -2251,4 +2260,6 @@
protected abstract ResultSet findItemByNameNew(String parentId, String name, int index) throws SQLException;
protected abstract ResultSet findChildNodesByParentIdentifierNew(String parentIdentifier) throws SQLException;
+
+ protected abstract ResultSet getChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-21 16:41:15 UTC (rev 1140)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-21 16:49:11 UTC (rev 1141)
@@ -86,6 +86,8 @@
protected PreparedStatement findPropertiesByParentId;
+ protected PreparedStatement getPropertiesByParentId;
+
protected PreparedStatement insertNode;
protected PreparedStatement insertProperty;
@@ -190,7 +192,7 @@
"select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
+ ", (select ID from JCR_MITEM where PARENT_ID=? and NAME=? and I_INDEX=?) I2"
+ " where (I.ID=I2.ID) or (I.PARENT_ID=I2.ID and I.I_CLASS=2 and I.NAME IN ('[http://www.jcp.org/jcr/1.0]primaryType','[http://www.jcp.org/jcr/1.0]mixinTypes'))"
- + " order by VERSION DESC, I.I_CLASS, I.NAME DESC";
+ + " order by I.I_CLASS, I.NAME DESC";
// "select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from (select * from JCR_MITEM where PARENT_ID=? and NAME=?) I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
// + ", (select ID from JCR_MITEM where I_CLASS=1 and PARENT_ID=? and NAME=?) I2"
@@ -220,12 +222,14 @@
+ " I.NAME IN ('[http://www.jcp.org/jcr/1.0]primaryType','[http://www.jcp.org/jcr/1.0]mixinTypes')) order by I.I_CLASS, I.N_ORDER_NUM";
//,'[http://www.exoplatform.com/jcr/exo/1.0]owner','[http://www.exoplatform.com/jcr/exo/1.0]permissions'
- String query = "";
-
FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=2 and PARENT_ID=?" + " order by ID";
+ GET_PROPERTIES_BY_PARENTID =
+ "select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I, JCR_MVALUE V"
+ + " where I.I_CLASS=2 and I.PARENT_ID=? and V.PROPERTY_ID=I.ID order by I.ID";
+
INSERT_NODE =
"insert into JCR_MITEM(ID, PARENT_ID, NAME, VERSION, I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,"
+ I_CLASS_NODE + ",?,?)";
@@ -646,4 +650,16 @@
findItemByIdNew.setString(2, identifier);
return findItemByIdNew.executeQuery();
}
+
+ @Override
+ protected ResultSet getChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException
+ {
+ if (getPropertiesByParentId == null)
+ getPropertiesByParentId = dbConnection.prepareStatement(GET_PROPERTIES_BY_PARENTID);
+ else
+ getPropertiesByParentId.clearParameters();
+
+ getPropertiesByParentId.setString(1, parentIdentifier);
+ return getPropertiesByParentId.executeQuery();
+ }
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2009-12-21 16:41:15 UTC (rev 1140)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2009-12-21 16:49:11 UTC (rev 1141)
@@ -627,4 +627,11 @@
return null;
}
+ @Override
+ protected ResultSet getChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
More information about the exo-jcr-commits
mailing list