merged 1.1 branch into head
[mir.git] / source / mir / generator / GeneratorHelper.java
index 298723d..4aa6b42 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2005 The Mir-coders group
  *
  * This file is part of Mir.
  *
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two.  You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries.  If you modify this file, you may extend this
+ * the code of this program with  any library licensed under the Apache Software License.
+ * You must obey the GNU General Public License in all respects for all of the code used
+ * other than the above mentioned libraries.  If you modify this file, you may extend this
  * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
-
 package mir.generator;
 
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ArrayList;
-import java.util.List;
-
-import mir.entity.adapter.EntityIteratorAdapter;
-import mir.util.CachingRewindableIterator;
 import mir.bundle.Bundle;
+import mir.entity.adapter.EntityAdapterEngine;
+import mir.entity.adapter.EntityAdapterModel;
 import mir.util.generator.BundleGeneratorFunction;
 import mircoders.global.MirGlobal;
 
+import java.util.*;
+
 
 
 public class GeneratorHelper {
@@ -49,18 +41,20 @@ public class GeneratorHelper {
    * Method to initialize the basic generation values for templates.  Does nothing which assumes a servlet context.
    */
 
-  public static Map makeBasicGenerationData(Locale[] aLocales, String aBundle, String aDefaultBundle) throws GeneratorExc{
+  public static Map makeBasicGenerationData(Locale[] aLocales, String aBundle, String aDefaultBundle) throws GeneratorExc {
     try {
       Map result = new HashMap();
       MirGlobal.localizer().producerAssistant().initializeGenerationValueSet(result);
 
-      Object languages = new CachingRewindableIterator(new EntityIteratorAdapter("", "id", 30, MirGlobal.localizer().dataModel().adapterModel(), "language"));
+      EntityAdapterModel model = MirGlobal.localizer().dataModel().adapterModel();
+
+      List languages = EntityAdapterEngine.retrieveAdapterList(model, "language", "", "id", -1, 0);
 
-      Object topics = new CachingRewindableIterator(new EntityIteratorAdapter("", "id", 30, MirGlobal.localizer().dataModel().adapterModel(), "topic"));
+      List topics = EntityAdapterEngine.retrieveAdapterList(model, "topic", "", "id", -1, 0);
 
-      Object articleTypes = new CachingRewindableIterator(new EntityIteratorAdapter("", "id", 30, MirGlobal.localizer().dataModel().adapterModel(), "articleType"));
+      List articleTypes  = EntityAdapterEngine.retrieveAdapterList(model, "articleType", "", "id", -1, 0);
 
-      Object commentStatuses = new CachingRewindableIterator(new EntityIteratorAdapter("", "id", 30, MirGlobal.localizer().dataModel().adapterModel(), "commentStatus"));
+      List commentStatuses  = EntityAdapterEngine.retrieveAdapterList(model, "commentStatus", "", "id", -1, 0);
 
       result.put("commentstatuses", commentStatuses);
       result.put("articletypes", articleTypes);