@@ -0,0 +1,1958 @@
+package info.limpet.data.operations;%0A%0Aimport info.limpet.ICollection;%0Aimport info.limpet.ICommand;%0Aimport info.limpet.IOperation;%0Aimport info.limpet.IStore;%0Aimport info.limpet.data.commands.AbstractCommand;%0Aimport info.limpet.data.impl.samples.SampleData;%0Aimport info.limpet.data.store.InMemoryStore;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0A%0Apublic class GenerateDummyDataOperation implements IOperation%3CICollection%3E%0A%7B%0A%09CollectionComplianceTests aTests = new CollectionComplianceTests();%0A%0A%09final private String _title;%0A%0A%09final private long _count;%0A%0A%09public GenerateDummyDataOperation(String title, long count)%0A%09%7B%0A%09%09_title = title;%0A%09%09_count = count;%0A%09%7D%0A%0A%09public Collection%3CICommand%3CICollection%3E%3E actionsFor(%0A%09%09%09List%3CICollection%3E selection, IStore destination)%0A%09%7B%0A%09%09Collection%3CICommand%3CICollection%3E%3E res = new ArrayList%3CICommand%3CICollection%3E%3E();%0A%09%09if (appliesTo(selection))%0A%09%09%7B%0A%09%09%09String thisTitle = %22Generate %22 + _title + %22 dataset (%22 + _count + %22)%22;%0A%09%09%09ICommand%3CICollection%3E newC = new GenerateDummyDataCommand(thisTitle,%0A%09%09%09%09%09destination, _count);%0A%09%09%09res.add(newC);%0A%09%09%7D%0A%0A%09%09return res;%0A%09%7D%0A%0A%09private boolean appliesTo(List%3CICollection%3E selection)%0A%09%7B%0A%09%09boolean emptySelection = aTests.exactNumber(selection, 0);%0A%09%09return emptySelection;%0A%09%7D%0A%0A%09public static class GenerateDummyDataCommand extends%0A%09%09%09AbstractCommand%3CICollection%3E%0A%09%7B%0A%09%09final long _count;%0A%0A%09%09public GenerateDummyDataCommand(String title, IStore store, long count)%0A%09%09%7B%0A%09%09%09super(title, %22Create some sample data%22, null, store, false, false, null);%0A%09%09%09_count = count;%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public void execute()%0A%09%09%7B%0A%09%09%09InMemoryStore newData = new SampleData().getData(_count);%0A%09%09%09Iterator%3CICollection%3E iter = newData.iterator();%0A%09%09%09while (iter.hasNext())%0A%09%09%09%7B%0A%09%09%09%09ICollection iCollection = (ICollection) iter.next();%0A%09%09%09%09getStore().add(iCollection);%0A%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09protected void recalculate()%0A%09%09%7B%0A%09%09%09// don't worry%0A%09%09%7D%0A%0A%09%7D%0A%0A%7D%0A

add operation to generate dummy data