Author: pnedonosko
Date: 2009-11-17 11:51:55 -0500 (Tue, 17 Nov 2009)
New Revision: 731
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
Log:
EXOJCR-203: JDBC conn new methods
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2009-11-17
16:51:35 UTC (rev 730)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2009-11-17
16:51:55 UTC (rev 731)
@@ -131,6 +131,11 @@
* FIND_PROPERTIES_BY_PARENTID.
*/
protected String FIND_PROPERTIES_BY_PARENTID;
+
+ /**
+ * FIND_PROPERTIES_IDNAME_BY_PARENTID.
+ */
+ protected String FIND_PROPERTIES_IDNAME_BY_PARENTID;
/**
* INSERT_NODE.
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-17
16:51:35 UTC (rev 730)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-17
16:51:55 UTC (rev 731)
@@ -2009,7 +2009,22 @@
public List<PropertyDataInfo> getChildProperties(String parentId) throws
RepositoryException, IllegalStateException
{
- return new ArrayList<PropertyDataInfo>(); // TODO
+ checkIfOpened();
+
+ List<PropertyDataInfo> children = new ArrayList<PropertyDataInfo>();
+ try
+ {
+ ResultSet prop =
findChildPropertiesIdNameByParentIdentifier(getInternalId(parentId));
+ while (prop.next()) {
+ //children.add((PropertyData)itemData(parent.getQPath(), prop,
I_CLASS_PROPERTY, null));
+ }
+
+ return children;
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
}
public List<String> getChildNodeNames(String parentId) throws
RepositoryException, IllegalStateException
@@ -2081,6 +2096,8 @@
protected abstract ResultSet findChildNodesByParentIdentifier(String parentIdentifier)
throws SQLException;
protected abstract ResultSet findChildPropertiesByParentIdentifier(String
parentIdentifier) throws SQLException;
+
+ protected abstract ResultSet findChildPropertiesIdNameByParentIdentifier(String
parentIdentifier) throws SQLException;
protected abstract int addReference(PropertyData data) throws SQLException,
IOException;
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java 2009-11-17
16:51:35 UTC (rev 730)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java 2009-11-17
16:51:55 UTC (rev 731)
@@ -83,6 +83,8 @@
"select * from JCR_SITEM" + " where PARENT_ID=? and I_CLASS=1 and
CONTAINER_NAME=?" + " order by N_ORDER_NUM";
FIND_PROPERTIES_BY_PARENTID =
"select * from JCR_SITEM" + " where PARENT_ID=? and I_CLASS=2 and
CONTAINER_NAME=?" + " order by ID";
+ FIND_PROPERTIES_IDNAME_BY_PARENTID =
+ "select ID, NAME from JCR_SITEM" + " where PARENT_ID=? and
I_CLASS=2 and CONTAINER_NAME=?";
}
/**
@@ -151,4 +153,20 @@
findPropertiesByParentId.setString(2, containerName);
return findPropertiesByParentId.executeQuery();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ResultSet findChildPropertiesIdNameByParentIdentifier(String parentCid)
throws SQLException
+ {
+ if (findPropertiesIdNameByParentId == null)
+ findPropertiesIdNameByParentId =
dbConnection.prepareStatement(FIND_PROPERTIES_IDNAME_BY_PARENTID);
+ else
+ findPropertiesIdNameByParentId.clearParameters();
+
+ findPropertiesIdNameByParentId.setString(1, parentCid);
+ findPropertiesIdNameByParentId.setString(2, containerName);
+ return findPropertiesIdNameByParentId.executeQuery();
+ }
}
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2009-11-17
16:51:35 UTC (rev 730)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2009-11-17
16:51:55 UTC (rev 731)
@@ -79,6 +79,8 @@
protected PreparedStatement findNodesByParentId;
protected PreparedStatement findPropertiesByParentId;
+
+ protected PreparedStatement findPropertiesIdNameByParentId;
protected PreparedStatement insertNode;
@@ -187,6 +189,8 @@
FIND_NODES_BY_PARENTID = "select * from JCR_MITEM" + " where
I_CLASS=1 and PARENT_ID=?" + " order by N_ORDER_NUM";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where
I_CLASS=2 and PARENT_ID=?" + " order by ID";
+
+ FIND_PROPERTIES_IDNAME_BY_PARENTID = "select ID, NAME from JCR_MITEM" +
" where I_CLASS=2 and PARENT_ID=?";
INSERT_NODE =
"insert into JCR_MITEM(ID, PARENT_ID, NAME, VERSION, I_CLASS, I_INDEX,
N_ORDER_NUM) VALUES(?,?,?,?,"
@@ -439,6 +443,17 @@
return findPropertiesByParentId.executeQuery();
}
+ protected ResultSet findChildPropertiesIdNameByParentIdentifier(String
parentIdentifier) throws SQLException
+ {
+ if (findPropertiesIdNameByParentId == null)
+ findPropertiesIdNameByParentId =
dbConnection.prepareStatement(FIND_PROPERTIES_IDNAME_BY_PARENTID);
+ else
+ findPropertiesIdNameByParentId.clearParameters();
+
+ findPropertiesIdNameByParentId.setString(1, parentIdentifier);
+ return findPropertiesIdNameByParentId.executeQuery();
+ }
+
// -------- values processing ------------
/**
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-11-17
16:51:35 UTC (rev 730)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-11-17
16:51:55 UTC (rev 731)
@@ -76,6 +76,8 @@
protected PreparedStatement findNodesByParentId;
protected PreparedStatement findPropertiesByParentId;
+
+ protected PreparedStatement findPropertiesIdNameByParentId;
protected PreparedStatement insertItem;
@@ -196,6 +198,9 @@
FIND_PROPERTIES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=2 and
CONTAINER_NAME=? and PARENT_ID=?" + " order by ID";
+ FIND_PROPERTIES_IDNAME_BY_PARENTID =
+ "select ID, NAME from JCR_SITEM" + " where I_CLASS=2 and
CONTAINER_NAME=? and PARENT_ID=?";
+
INSERT_NODE =
"insert into JCR_SITEM(ID, PARENT_ID, NAME, CONTAINER_NAME, VERSION,
I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,?,"
+ I_CLASS_NODE + ",?,?)";
@@ -350,7 +355,22 @@
findPropertiesByParentId.setString(2, parentCid);
return findPropertiesByParentId.executeQuery();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ResultSet findChildPropertiesIdNameByParentIdentifier(String parentCid)
throws SQLException
+ {
+ if (findPropertiesIdNameByParentId == null)
+ findPropertiesIdNameByParentId =
dbConnection.prepareStatement(FIND_PROPERTIES_IDNAME_BY_PARENTID);
+ else
+ findPropertiesIdNameByParentId.clearParameters();
+ findPropertiesIdNameByParentId.setString(1, containerName);
+ findPropertiesIdNameByParentId.setString(2, parentCid);
+ return findPropertiesIdNameByParentId.executeQuery();
+ }
+
/**
* {@inheritDoc}
*/