com.atlassian.crowd.util.persistence.hibernate.batch
Interface BatchProcessor

All Known Implementing Classes:
BatchProcessorImpl

public interface BatchProcessor

Threadsafe batch processor. Currently capable of performing "find", "saveOrUpdate" and "replicate" on a collection of entities. This processor is essentially a heavyweight generic DAO for processing batching inserts or updates to NamedEntities and for performing finds on DirectoryEntities. For more information on the implementation details, please see the javadoc for BatchProcessorImpl.


Method Summary
<E extends DirectoryEntity>
java.util.Collection<E>
find(long directoryID, java.util.Collection<java.lang.String> names, java.lang.Class<E> persistentClass)
          Find a set of entities by batching SQL disjunction queries.
<E extends NamedEntity>
BatchResult<E>
replicate(java.util.Collection<E> objects, org.hibernate.ReplicationMode replicationMode)
          Replicate a set of entities using Hibernate/JDBC batching.
<E extends NamedEntity>
BatchResult<E>
saveOrUpdate(java.util.Collection<E> objects)
          SaveOrUpdate a set of entities using Hibernate/JDBC batching.
 

Method Detail

replicate

<E extends NamedEntity> BatchResult<E> replicate(java.util.Collection<E> objects,
                                                 org.hibernate.ReplicationMode replicationMode)
Replicate a set of entities using Hibernate/JDBC batching. If some entities fail replication, the rest can still succeed.

Parameters:
objects - entities to replicate.
replicationMode - how to perform the replication, eg. ReplicationMode.OVERWRITE.
Returns:
a BatchResult indicating the number of total entities that were attempted to be processed and the collection of entities that failed to be processed.

saveOrUpdate

<E extends NamedEntity> BatchResult<E> saveOrUpdate(java.util.Collection<E> objects)
SaveOrUpdate a set of entities using Hibernate/JDBC batching. If some entities fail saving/updating, the rest can still succeed.

Parameters:
objects - entities to replicate.
Returns:
a BatchResult indicating the number of total entities that were attempted to be processed and the collection of entities that failed to be processed.

find

<E extends DirectoryEntity> java.util.Collection<E> find(long directoryID,
                                                         java.util.Collection<java.lang.String> names,
                                                         java.lang.Class<E> persistentClass)
Find a set of entities by batching SQL disjunction queries. If some entities are not found in the database, they are not present in the returned collection.

Parameters:
directoryID - directory ID of the entities to return.
names - collection of entity names. This, along with the directoryID should form the primary key of the entity.
persistentClass - the persistent class to lookup. This must be a Hibernate-mapped DirectoryEntity.
Returns:
a collection of the DirectoryEntities that exist matching any of the supplied names.


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.