Commit 6d31524b authored by Andre Freyssinet's avatar Andre Freyssinet

Implements loadAll method (Joram-362).

parent 78020efe
......@@ -30,8 +30,8 @@ import java.io.ObjectOutputStream;
import java.io.ObjectStreamConstants;
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.util.Map;
import java.util.Hashtable;
import java.util.List;
import org.objectweb.util.monolog.api.BasicLevel;
......@@ -451,19 +451,30 @@ public abstract class AbstractTransaction extends BaseTransaction {
}
/**
* Fills the list with all objects of the component whose name begins with the prefix.
* Returns true if this Transaction implementation implements an optimized loadAll method.
*
* @return false.
*/
@Override
public boolean useLoadAll() {
return false;
}
/**
* Fills the map with all objects of the component whose name begins with the prefix.
*
* @param prefix The prefix of searched objects.
* @param list The list of corresponding objects.
* @param map The map of corresponding objects.
*/
public void loadAll(String prefix, List list) {
@Override
public void loadAll(String prefix, Map map) {
if (logmon.isLoggable(BasicLevel.DEBUG))
logmon.log(BasicLevel.DEBUG, "Transaction, loadAll(" + prefix + ")");
String[] names = getList(prefix);
for (String name : names) {
try {
list.add(load(name));
map.put(name, load(name));
} catch (ClassNotFoundException | IOException exc) {
if (logmon.isLoggable(BasicLevel.DEBUG))
logmon.log(BasicLevel.WARN, "Transaction, loadAll: cannot retrieve content for " + name, exc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment