reintroduced StringUtil.regexpReplace
[mir.git] / source / mir / servlet / AdminServletModule.java
index 402b5c5..27c422d 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001-2006 The Mir-coders group
  *
  * This file is part of Mir.
  *
@@ -19,8 +19,6 @@
  *
  * 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
@@ -36,6 +34,7 @@ import mir.module.ModuleExc;
 import mir.storage.Database;
 import mir.util.HTTPRequestParser;
 import mir.util.URLBuilder;
+import mir.util.StringRoutines;
 import mircoders.global.MirGlobal;
 import mircoders.localizer.MirLocalizerExc;
 import mircoders.servlet.ServletHelper;
@@ -130,8 +129,10 @@ public abstract class AdminServletModule extends ServletModule {
     String where = requestParser.getParameter("where");
     String order = requestParser.getParameterWithDefault("order", getDefaultListOrdering());
     int offset = requestParser.getIntegerWithDefault("offset", 0);
+    String mainTablePrefix = requestParser.getParameter("mainTablePrefix");
+    String extraTables = requestParser.getParameter("extraTables");
 
-    returnList(aRequest, aResponse, where, order, offset);
+    returnList(aRequest, aResponse, where, order, offset, Collections.EMPTY_MAP, mainTablePrefix, extraTables);
   }
 
 
@@ -143,14 +144,24 @@ public abstract class AdminServletModule extends ServletModule {
   public void returnList(HttpServletRequest aRequest, HttpServletResponse aResponse,
                          String aWhereClause, String anOrderByClause, int anOffset,
                          Map anOverridingRequestParameters) throws ServletModuleExc {
+    returnList(aRequest, aResponse, aWhereClause, anOrderByClause, anOffset, anOverridingRequestParameters, "", null);
+  }
+  public void returnList(HttpServletRequest aRequest, HttpServletResponse aResponse,
+                         String aWhereClause, String anOrderByClause, int anOffset,
+                         Map anOverridingRequestParameters, String aMainTablePrefix, String someExtraTables) throws ServletModuleExc {
     HTTPRequestParser requestParser = new HTTPRequestParser(aRequest, anOverridingRequestParameters);
     URLBuilder urlBuilder = new URLBuilder();
 
     try {
       Map responseData = ServletHelper.makeGenerationData(aRequest, aResponse, getLocales(aRequest));
 
+      List extraTables = null;
+      if (someExtraTables!=null && someExtraTables.length() > 0) {
+        extraTables = StringRoutines.splitString(someExtraTables, ",");
+      }
+
       List list =
-         EntityAdapterEngine.retrieveAdapterList(model, definition, aWhereClause, anOrderByClause, nrEntitiesPerListPage, anOffset);
+         EntityAdapterEngine.retrieveAdapterList(model, definition, aMainTablePrefix, extraTables, aWhereClause, anOrderByClause, nrEntitiesPerListPage, anOffset);
 
       responseData.put("nexturl", null);
       responseData.put("prevurl", null);
@@ -160,6 +171,8 @@ public abstract class AdminServletModule extends ServletModule {
       urlBuilder.setValue("do", "list");
       urlBuilder.setValue("where", aWhereClause);
       urlBuilder.setValue("order", anOrderByClause);
+      urlBuilder.setValue("extraTables", someExtraTables);
+      urlBuilder.setValue("mainTablePrefix", aMainTablePrefix);
 
 
       urlBuilder.setValue("offset", anOffset);
@@ -208,7 +221,7 @@ public abstract class AdminServletModule extends ServletModule {
 
       responseData.put("module", getName());
       responseData.put("entity", anObject);
-      responseData.put("new", Boolean.valueOf(anIsNew));
+      responseData.put("new", new Boolean(anIsNew));
 
 
       urlBuilder.setValue("module", getName());