[quickbuild] Created quick.build task and WAD window generation based on last changes
authorAsier Lostalé <asier.lostale@openbravo.com>
Thu, 29 Jan 2009 16:50:24 +0000
changeset 2826 9e138c46c6d1
parent 2825 f0b670db035d
child 2827 4e3c754aa2b8
[quickbuild] Created quick.build task and WAD window generation based on last changes
build.xml
src-wad/src/org/openbravo/wad/Tabs_data.xsql
src-wad/src/org/openbravo/wad/Wad.java
src/build.xml
--- a/build.xml	Thu Jan 29 16:39:03 2009 +0000
+++ b/build.xml	Thu Jan 29 16:50:24 2009 +0000
@@ -12,7 +12,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SL
-* All portions are Copyright (C) 2001-2008 Openbravo SL
+* All portions are Copyright (C) 2001-2009 Openbravo SL
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************
@@ -207,6 +207,11 @@
 	<target name="compile.complete" depends="init">
 		<ant dir="${base.src}" target="compile.complete" inheritAll="true" inheritRefs="true" />
 	</target>
+	
+	 <target name="build.quick" depends="init">
+	    <ant dir="${base.src}" target="build.quick" inheritAll="true" inheritRefs="true" />
+	  </target>
+	
 
 	<target name="compile" depends="init">
 		<ant dir="${base.src}" target="compile" inheritAll="true" inheritRefs="true" />
--- a/src-wad/src/org/openbravo/wad/Tabs_data.xsql	Thu Jan 29 16:39:03 2009 +0000
+++ b/src-wad/src/org/openbravo/wad/Tabs_data.xsql	Thu Jan 29 16:50:24 2009 +0000
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2001-2008 Openbravo SL 
+ * All portions are Copyright (C) 2001-2009 Openbravo SL 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -138,6 +138,77 @@
   </SqlMethod>
 
 
+  <SqlMethod name="selectQuick" type="preparedStatement" return="multiple">
+      <Sql><![CDATA[
+        SELECT distinct AD_TAB.ad_tab_id AS tabId, AD_TAB.NAME AS tabName, AD_WINDOW.NAME AS windowName, 
+        AD_TAB.seqno AS seqNo, AD_TAB.tablevel AS tabLevel, AD_TAB.NAME AS tabNameCompact, 
+        AD_TAB.AD_WINDOW_ID AS KEY, '' AS TD_Class, '' AS href, '' AS Td_Height, '' AS Parent_Key, 
+        AD_WINDOW.NAME AS realWindowName, AD_TAB.whereclause, AD_WINDOW.windowtype, ad_tab.issorttab, ad_tab.AD_COLUMNSORTORDER_ID, 
+        ad_tab.AD_COLUMNSORTYESNO_ID,
+        AD_TABLE.ACCESSLEVEL, AD_TAB.ad_process_id, AD_TAB.ISREADONLY, AD_TAB.NAME AS realTabName, AD_TAB.ORDERBYCLAUSE, 
+        '' as tabNameTrl, AD_TABLE.ad_table_id AS table_Id, ad_tab.isInfoTab, ad_tab.isTranslationTab, '' AS NameTab, 
+        replace(replace(AD_TAB.FILTERCLAUSE, CHR(10), ' '), CHR(13), ' ') AS FILTERCLAUSE, AD_TAB.EDITREFERENCE, AD_MODEL_OBJECT.CLASSNAME,
+        (CASE WHEN M1.AD_MODULE_ID='0' THEN NULL ELSE M1.JavaPackage END) AS JAVAPACKAGE
+        FROM AD_TAB, AD_WINDOW, AD_TABLE, AD_MODEL_OBJECT, AD_SYSTEM_INFO SI, AD_MODULE M1
+        WHERE AD_TAB.AD_WINDOW_ID = AD_WINDOW.AD_WINDOW_ID
+        AND AD_TAB.AD_TABLE_ID = AD_TABLE.AD_TABLE_ID 
+        AND AD_TAB.AD_TAB_ID = AD_MODEL_OBJECT.AD_TAB_ID 
+        AND AD_MODEL_OBJECT.ISACTIVE = 'Y' 
+        AND AD_MODEL_OBJECT.ISDEFAULT = 'Y' 
+        AND AD_WINDOW.IsActive = 'Y'
+        AND M1.AD_MODULE_ID = AD_WINDOW.AD_Module_ID
+        AND AD_TAB.ad_table_id IN
+        (SELECT AD_TABLE.ad_table_id FROM AD_COLUMN, AD_TABLE 
+         WHERE AD_COLUMN.ad_table_id = AD_TABLE.ad_table_id
+         AND (AD_COLUMN.iskey='Y' OR AD_COLUMN.issecondarykey='Y')
+        AND AD_TAB.ISACTIVE = 'Y'
+        AND EXISTS (SELECT 1 FROM AD_TAB, AD_COLUMN 
+        WHERE AD_TAB.AD_TABLE_ID = AD_COLUMN.ad_table_id
+        AND AD_TAB.TABLEVEL = 0 
+        AND (AD_COLUMN.iskey='Y' OR AD_COLUMN.issecondarykey='Y')
+        )
+        AND AD_TAB.ad_window_id = AD_WINDOW.ad_window_id)
+        AND EXISTS (SELECT 1
+                      FROM AD_WINDOW W
+                     WHERE AD_WINDOW.AD_WINDOW_ID = W.AD_WINDOW_ID
+                       AND W.UPDATED > SI.LAST_BUILD
+                    UNION
+                    SELECT 1
+                      FROM AD_TAB T,
+                           AD_WINDOW W
+                     WHERE AD_WINDOW.AD_WINDOW_ID = W.AD_WINDOW_ID
+                       AND T.UPDATED > SI.LAST_BUILD
+                       AND W.AD_WINDOW_ID = T.AD_WINDOW_ID
+                    UNION
+                    SELECT 1                     
+                      FROM AD_FIELD F,
+                           AD_TAB TB, AD_WINDOW W
+                     WHERE AD_WINDOW.AD_WINDOW_ID = W.AD_WINDOW_ID
+                       AND F.UPDATED > SI.LAST_BUILD
+                       AND F.AD_TAB_ID = TB.AD_TAB_ID
+                       AND W.AD_WINDOW_ID = TB.AD_WINDOW_ID
+                    UNION
+                    SELECT 1
+                      FROM AD_TABLE T,
+                           AD_TAB TB, AD_WINDOW W
+                     WHERE AD_WINDOW.AD_WINDOW_ID = W.AD_WINDOW_ID
+                       AND T.UPDATED > SI.LAST_BUILD
+                       AND T.AD_TABLE_ID = TB.AD_TABLE_ID
+                       AND W.AD_WINDOW_ID = TB.AD_WINDOW_ID
+                    UNION
+                     SELECT 1
+                       FROM AD_COLUMN C,
+                            AD_TAB TB, AD_WINDOW W
+                      WHERE AD_WINDOW.AD_WINDOW_ID = W.AD_WINDOW_ID
+                       AND C.UPDATED > SI.LAST_BUILD
+                        AND C.AD_TABLE_ID = TB.AD_TABLE_ID
+                        AND W.AD_WINDOW_ID = TB.AD_WINDOW_ID
+                       )
+        ORDER BY AD_WINDOW.name, AD_TAB.tablevel, AD_TAB.seqno
+          ]]>
+      </Sql>
+  </SqlMethod>
+
   <SqlMethod name="selectTabParent" type="preparedStatement" return="multiple">
       <SqlMethodComment>Parent Tab for the window</SqlMethodComment>
       <Sql><![CDATA[
--- a/src-wad/src/org/openbravo/wad/Wad.java	Thu Jan 29 16:39:03 2009 +0000
+++ b/src-wad/src/org/openbravo/wad/Wad.java	Thu Jan 29 16:50:24 2009 +0000
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2001-2006 Openbravo SL 
+ * All portions are Copyright (C) 2001-2009 Openbravo SL 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -137,6 +137,7 @@
         String webPath;
         String strBaseSrc;
         boolean complete;
+        boolean quick;
 
         if (argv.length < 1) {
             log4j
@@ -253,6 +254,19 @@
                         + argv[15].replace(", ", ",").replace(",", "', '")
                         + "'";
 
+            // Check for quick build
+            if (argv.length <= 16)
+                quick = false;
+            else
+                quick = argv[16].equals("quick");
+
+            System.out.println("16: " + argv[16] + " l " + argv.length);
+
+            if (quick) {
+                module = "%";
+                strWindowName = "xx";
+            }
+
             log4j.info("File connection: " + strFileConnection);
             log4j.info("window: " + strWindowName);
             log4j.info("module: " + module);
@@ -271,7 +285,7 @@
             log4j.info("Attach path: " + attachPath);
             log4j.info("Web path: " + webPath);
             log4j.info("Src path: " + strBaseSrc);
-            log4j.info("complete: " + complete);
+            log4j.info("Quick mode: " + quick);
 
             final File fileFin = new File(dirFin);
             if (!fileFin.exists()) {
@@ -373,7 +387,9 @@
             while (st.hasMoreTokens()) {
                 strCurrentWindow = st.nextToken().trim();
                 TabsData tabsData[];
-                if (module.equals("%"))
+                if (quick)
+                    tabsData = TabsData.selectQuick(wad.pool);
+                else if (module.equals("%"))
                     tabsData = TabsData.selectTabs(wad.pool, strCurrentWindow);
                 else
                     tabsData = TabsData.selectTabsinModules(wad.pool,
@@ -2010,8 +2026,8 @@
             discard[18] = "client";
             discard[1] = "org";
         } // else if (tableName.toUpperCase().startsWith("M_PRODUCT") ||
-          // tableName.toUpperCase().startsWith("C_BP") ||
-          // tableName.toUpperCase().startsWith("AD_ORG")) discard[1] = "org";
+        // tableName.toUpperCase().startsWith("C_BP") ||
+        // tableName.toUpperCase().startsWith("AD_ORG")) discard[1] = "org";
         if (dl.toString().equals(""))
             discard[2] = "selDisplayLogic";
         if (!isHighVolumen || !tablevel.equals("0")) {
@@ -2068,9 +2084,9 @@
 
         if (strWindow.equals("250"))
             discard[30] = "refreshTabParentSession"; // TODO: This fixes
-                                                     // [1879633] and shoudn't
-                                                     // be necessary in r2.5x
-                                                     // because of new PKs
+        // [1879633] and shoudn't
+        // be necessary in r2.5x
+        // because of new PKs
 
         xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/wad/javasource",
                 discard).createXmlDocument();
@@ -3007,8 +3023,8 @@
             discard[6] = "client";
             discard[1] = "org";
         } // else if (tableName.toUpperCase().startsWith("M_PRODUCT") ||
-          // tableName.toUpperCase().startsWith("C_BP") ||
-          // tableName.toUpperCase().startsWith("AD_ORG")) discard[1] = "org";
+        // tableName.toUpperCase().startsWith("C_BP") ||
+        // tableName.toUpperCase().startsWith("AD_ORG")) discard[1] = "org";
         if (selCol == null || selCol.length == 0) {
             discard[2] = "sectionHighVolume";
             discard[3] = "sectionHighVolume1";
@@ -4176,19 +4192,19 @@
                     + strTab + ", " + tabName);
 
         final boolean isReadOnlyDefinedTab = (isreadonly && editable); // isReadOnlyDefinedTab:
-                                                                       // the
-                                                                       // tab is
-                                                                       // defined
-                                                                       // as
-                                                                       // read-only
-                                                                       // but
-                                                                       // not
-                                                                       // for
-                                                                       // security
+        // the
+        // tab is
+        // defined
+        // as
+        // read-only
+        // but
+        // not
+        // for
+        // security
         if (!editable)
             isreadonly = true; // isreadonly: because it is not editable (for
-                               // security reasons) or because it is defined as
-                               // read-only
+        // security reasons) or because it is defined as
+        // read-only
 
         final HashMap<String, String> shortcuts = new HashMap<String, String>();
 
--- a/src/build.xml	Thu Jan 29 16:39:03 2009 +0000
+++ b/src/build.xml	Thu Jan 29 16:50:24 2009 +0000
@@ -13,7 +13,7 @@
  * and  limitations under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2005-2008 Openbravo SL 
+ * All portions are Copyright (C) 2005-2009 Openbravo SL 
  * All Rights Reserved. 
  * Contributor(s): Openbravo S.L.
  ************************************************************************
@@ -220,6 +220,14 @@
 		</java>
 		<antcall target="postwad" inheritall="true" inheritrefs="true" />
 	</target>
+	
+	<target name="wad.quick" depends="init">
+		<java classname="org.openbravo.wad.Wad" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
+		      <arg line="'${base.config}' '${tab}' '${build.AD}/org/openbravo/erpWindows' '${build.AD}/org/openbravo/erpCommon' '${build.sqlc}/src' '${webTab}' '${build.AD}/org/openbravo/erpCommon/ad_actionButton' '${base.design}' '${base.translate.structure}' '${client.web.xml}' '..' '${attach.path}' '${web.url}' '${base.src}' '${complete}' '${module}' 'quick'" />
+		      <classpath refid="project.class.path" />
+		    </java>
+		    <antcall target="postwad" inheritall="true" inheritrefs="true" />
+	</target>
 
 
 	<target name="postsrc" depends="postsrc.modules">
@@ -458,6 +466,12 @@
 	<target name="compile.complete" depends="clean,generate.entities,wad,compileSqlc,postsrc,translate">
 		<antcall target="update.build.timestamp"/>
 	</target>
+	
+	<target name="build.quick" depends="generate.entities,wad.quick,compileSqlc,postsrc,translate">
+		<antcall target="update.build.timestamp"/>
+	</target>
+	
+	
 
 	<target name="translate" if="translation">
 		<antcall inheritall="true" inheritrefs="true" target="compile.translate">