Permalink
Browse files

CI Changes

Bug fixes related to bi direction
  • Loading branch information...
1 parent 20883c2 commit ef4acebc435c466a85c9b054b401f6a9e7ee260c @kkmishra kkmishra committed May 30, 2012
@@ -101,6 +101,7 @@ Object fromThriftRow(Selector selector, Class<?> clazz, EntityMetadata m, String
{
List<ByteBuffer> rowKeys = new ArrayList<ByteBuffer>(1);
+
ByteBuffer rKeyAsByte = ByteBufferUtil.bytes(rowKey);
rowKeys.add(ByteBufferUtil.bytes(rowKey));
@@ -152,13 +153,16 @@ Object fromThriftRow(Selector selector, Class<?> clazz, EntityMetadata m, String
List<Object> fromThriftRow(Selector selector, Class<?> clazz, EntityMetadata m, List<String> relationNames,
boolean isWrapReq, Object... rowIds) throws Exception
{
- List<Object> entities = new ArrayList<Object>(rowIds.length);
+ List<Object> entities = new ArrayList<Object>();
if (rowIds != null)
{
for (Object rowKey : rowIds)
{
Object e = fromThriftRow(selector, clazz, m, rowKey.toString(), relationNames, isWrapReq);
- entities.add(e);
+ if( e != null)
+ {
+ entities.add(e);
+ }
}
}
return entities;
@@ -15,7 +15,7 @@
# limitations under the License.
-log4j.rootLogger=INFO, DRFA, CONSOLE
+log4j.rootLogger=WARN, DRFA, CONSOLE
# rolling log file ("system.log
log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
@@ -13,25 +13,46 @@
<property name="kundera.keyspace" value="UUIDCassandra" />
<property name="kundera.dialect" value="cassandra" />
<property name="kundera.client" value="pelops" />
- <property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
+ <property name="kundera.client.lookup.class"
+ value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
<property name="kundera.cache.provider.class"
value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
<property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
</properties>
</persistence-unit>
-
- <persistence-unit name="secIdxCassandraTest">
- <provider>com.impetus.kundera.KunderaPersistence</provider>
- <properties>
- <property name="kundera.nodes" value="localhost"/>
- <property name="kundera.port" value="9160"/>
- <property name="kundera.keyspace" value="KunderaExamples"/>
- <property name="kundera.dialect" value="cassandra"/>
- <!-- <property name="kundera_ddl_auto_prepare" value="create"/> -->
- <property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
- <property name="kundera.cache.provider.class" value="com.impetus.kundera.cache.ehcache.EhCacheProvider"/>
- <property name="kundera.cache.config.resource" value="/ehcache-test.xml"/>
- </properties>
+
+ <persistence-unit name="secIdxCassandraTest">
+ <provider>com.impetus.kundera.KunderaPersistence</provider>
+ <properties>
+ <property name="kundera.nodes" value="localhost" />
+ <property name="kundera.port" value="9160" />
+ <property name="kundera.keyspace" value="KunderaExamples" />
+ <property name="kundera.dialect" value="cassandra" />
+ <!-- <property name="kundera_ddl_auto_prepare" value="create"/> -->
+ <property name="kundera.client.lookup.class"
+ value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
+ <property name="kundera.cache.provider.class"
+ value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
+ <property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
+ </properties>
</persistence-unit>
-
+
+ <persistence-unit name="twissandraTest">
+ <provider>com.impetus.kundera.KunderaPersistence</provider>
+ <properties>
+ <property name="kundera.nodes" value="localhost" />
+ <property name="kundera.port" value="9160" />
+ <property name="kundera.keyspace" value="KunderaExamples" />
+ <property name="kundera.dialect" value="cassandra" />
+ <!-- <property name="kundera_ddl_auto_prepare" value="create"/> -->
+ <property name="kundera.client.lookup.class"
+ value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
+ <property name="kundera.cache.provider.class"
+ value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
+ <property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
+ <property name="index_home_dir" value="/home/impadmin/lucene" />
+ </properties>
+ </persistence-unit>
+
+
</persistence>
@@ -64,7 +64,9 @@
Client client;
// Reference to Persistence cache where this node is stored
- private PersistenceCache persistenceCache;;
+ private PersistenceCache persistenceCache;
+
+ private boolean isGraphCompleted;
PersistenceDelegator pd;
@@ -499,4 +501,20 @@ public void setPersistenceCache(PersistenceCache persistenceCache)
this.persistenceCache = persistenceCache;
}
+ /**
+ * @return the isGraphCompleted
+ */
+ public boolean isGraphCompleted()
+ {
+ return isGraphCompleted;
+ }
+
+ /**
+ * @param isGraphCompleted the isGraphCompleted to set
+ */
+ public void setGraphCompleted(boolean isGraphCompleted)
+ {
+ this.isGraphCompleted = isGraphCompleted;
+ }
+
}
@@ -77,18 +77,25 @@ private Node getNode(Object entity, ObjectGraph graph, NodeState initialNodeStat
// If this node is already there in graph (may happen for bidirectional
// relationship, do nothing and return null)
- if (graph.getNode(nodeId) != null)
+ Node node = graph.getNode(nodeId);
+ if (node != null)
{
-
- return null;
+ if (node.isGraphCompleted())
+ {
+ return node;
+ }
+ else
+ {
+ return null;
+ }
}
/*
* Node node = graph.getNode(nodeId); if(node != null) { return node; }
*/
// Construct this Node first, if one not already there in Persistence
// Cache
- Node node = null;
+ node = null;
Node nodeInPersistenceCache = persistenceCache.getMainCache().getNodeFromCache(nodeId);
// Make a deep copy of entity data
@@ -162,7 +169,9 @@ private Node getNode(Object entity, ObjectGraph graph, NodeState initialNodeStat
}
}
-
+
+ // Means compelte graph is build.
+ node.setGraphCompleted(true);
return node;
}
@@ -193,7 +193,7 @@ else if (multiplicity.equals(Relation.ForeignKey.ONE_TO_MANY))
.getClass().getCanonicalName().toLowerCase(),
DocumentIndexer.PARENT_ID_FIELD, e.getEntityId(), childClass
.getCanonicalName().toLowerCase());
-
+
Map<String, String> results = childClient.getIndexManager().search(query);
Set<String> rsSet = new HashSet<String>(results.values());
// childs = (List<Object>)
@@ -228,23 +228,27 @@ else if (multiplicity.equals(Relation.ForeignKey.ONE_TO_MANY))
List childCol = new ArrayList(childs.size());
for (Object child : childs)
{
- Object o = child instanceof EnhanceEntity ? ((EnhanceEntity) child).getEntity()
- : child;
- // biDirectionalField =
- // getBiDirectionalField(e.getEntity().getClass(),
- // childClass);
- if (!o.getClass().equals(e.getEntity().getClass()))
+ if (child != null)
{
- recursivelyFindEntities(
- new EnhanceEntity(o, PropertyAccessorHelper.getId(o, childMetadata),
- null), childClient, childMetadata, pd);
- }
- onBiDirection(pd, e, client, relation, biDirectionalField,
- relation.getJoinColumnName(), m, o, childMetadata, childClient);
- childCol.add(o);
+ Object o = child instanceof EnhanceEntity ? ((EnhanceEntity) child).getEntity()
+ : child;
+ // biDirectionalField =
+ // getBiDirectionalField(e.getEntity().getClass(),
+ // childClass);
+ if (!o.getClass().equals(e.getEntity().getClass()))
+ {
+ recursivelyFindEntities(
+ new EnhanceEntity(o,
+ PropertyAccessorHelper.getId(o, childMetadata), null),
+ childClient, childMetadata, pd);
+ }
+ onBiDirection(pd, e, client, relation, biDirectionalField,
+ relation.getJoinColumnName(), m, o, childMetadata, childClient);
+ childCol.add(o);
+ }
+ relationValuesMap.put(relationalValue + childClass.getName(), childCol);
}
- relationValuesMap.put(relationalValue + childClass.getName(), childCol);
}
}
}
Oops, something went wrong.

0 comments on commit ef4aceb

Please sign in to comment.