details: /erp/devel/pi/rev/dcea0231fee9
changeset: 11113:dcea0231fee9
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Tue Mar 08 17:24:52 2011 +0100
summary: Modified log configuration so that DAL-initializing tasks show log
details: /erp/devel/pi/rev/c4bf3d9f768f
changeset: 11114:c4bf3d9f768f
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Tue Mar 08 17:49:56 2011 +0100
summary: Add check.window.compatibility task, which can be used to find out
what windows will be shown in classic mode.
diffstat:
build.xml
| 7 +
modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java
| 29 +++++-
modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowsInClassicModeTask.java
| 39 ++++++++++
src/log4j.properties
| 3 +-
4 files changed, 71 insertions(+), 7 deletions(-)
diffs (143 lines):
diff -r 1e4f6fe09807 -r c4bf3d9f768f build.xml
--- a/build.xml Tue Mar 08 17:38:14 2011 +0100
+++ b/build.xml Tue Mar 08 17:49:56 2011 +0100
@@ -1114,4 +1114,11 @@
</taskdef>
<checkConsistency userId="0" adminMode="true"
propertiesFile="${base.config}/Openbravo.properties"/>
</target>
+
+ <target name="check.window.compatibility">
+ <taskdef name="showclassicwindows"
classname="org.openbravo.client.application.WindowsInClassicModeTask">
+ <classpath refid="project.class.path" />
+ </taskdef>
+ <showclassicwindows userId="0" adminMode="true"
propertiesFile="${base.config}/Openbravo.properties"/>
+ </target>
</project>
diff -r 1e4f6fe09807 -r c4bf3d9f768f
modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java
Tue Mar 08 17:38:14 2011 +0100
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java
Tue Mar 08 17:49:56 2011 +0100
@@ -18,6 +18,7 @@
*/
package org.openbravo.client.application;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -49,35 +50,51 @@
private static Logger log = Logger.getLogger(ApplicationUtils.class);
static boolean showWindowInClassicMode(Window window) {
+ List<String> reasonsToBeShownInClassic = new ArrayList<String>();
+ showWindowInClassicMode(window, reasonsToBeShownInClassic);
+ return reasonsToBeShownInClassic.size() > 0;
+ }
+
+ static void showWindowInClassicMode(Window window, List<String>
reasonsToBeShownInClassic) {
// FIXME Remove this once ImageBLOB is implemented
// Currently, windows with ImageBLOB reference columns will be shown in
classic mode
String qryStr = "as f where f.column.reference.id =
'4AA6C3BE9D3B4D84A3B80489505A23E5' "
+ "and f.tab.window.id = :windowId ";
+ List<String> reasonsOfWindow = new ArrayList<String>();
OBQuery<Field> qry = OBDal.getInstance().createQuery(Field.class, qryStr);
qry.setNamedParameter("windowId", window.getId());
if (qry.count() > 0) {
- return true;
+ String reason = " One or more columns in the window " +
window.getName()
+ + " have an ImageBLOB reference ";
+ reasonsOfWindow.add(reason);
}
for (Tab tab : window.getADTabList()) {
if (tab.getSQLWhereClause() != null && tab.getHqlwhereclause() == null) {
// There is a tab with a SQL whereclause, but without a defined HQL
whereclause
- return true;
+ reasonsOfWindow.add(" The tab " + tab.getName() + " of the window "
+ window.getName()
+ + " has a SQLWhereClause, but not an HQLWhereClause");
}
if (tab.getSQLOrderByClause() != null && tab.getHqlorderbyclause() ==
null) {
// There is a tab with a SQL order by clause, but without a defined
HQL order by clause
- return true;
+ reasonsOfWindow.add(" The tab " + tab.getName() + " of the window "
+ window.getName()
+ + " has a SQLOrderByClause, but not an HQLOrderByClause");
}
if (tab.getFilterClause() != null && tab.getHqlfilterclause() == null) {
// There is a tab with a SQL filter clause, but without a defined HQL
filter clause
- return true;
+ reasonsOfWindow.add(" The tab " + tab.getName() + " of the window "
+ window.getName()
+ + " has a FilterClause, but not an HQLFilterClause");
}
if (tab.getMasterDetailForm() != null) {
// There is a tab which is a manual form
- return true;
+ reasonsOfWindow.add(" The tab " + tab.getName() + " of the window "
+ window.getName()
+ + " is a manual form");
}
}
- return false;
+ if (reasonsOfWindow.size() > 0) {
+ reasonsToBeShownInClassic.add("Window: " + window.getName());
+ reasonsToBeShownInClassic.addAll(reasonsOfWindow);
+ }
}
/**
diff -r 1e4f6fe09807 -r c4bf3d9f768f
modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowsInClassicModeTask.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowsInClassicModeTask.java
Tue Mar 08 17:49:56 2011 +0100
@@ -0,0 +1,39 @@
+package org.openbravo.client.application;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.hibernate.criterion.Expression;
+import org.openbravo.dal.core.DalInitializingTask;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.dal.service.OBDao;
+import org.openbravo.dal.service.OBQuery;
+import org.openbravo.model.ad.module.Module;
+import org.openbravo.model.ad.ui.Window;
+
+public class WindowsInClassicModeTask extends DalInitializingTask {
+ private static final Logger log =
Logger.getLogger(WindowsInClassicModeTask.class);
+
+ @Override
+ protected void doExecute() {
+ OBQuery<Module> modules = OBDal.getInstance().createQuery(Module.class,
"");
+ for (Module module : modules.list()) {
+ List<String> classicWindowMessages = new ArrayList<String>();
+ OBCriteria<Window> windowsOfModule =
OBDao.getFilteredCriteria(Window.class, Expression.eq(
+ Window.PROPERTY_MODULE, module));
+ for (Window window : windowsOfModule.list()) {
+ ApplicationUtils.showWindowInClassicMode(window,
classicWindowMessages);
+ }
+ if (classicWindowMessages.size() > 0) {
+ log.info("Module: " + module.getName());
+ log.info("The following windows will be shown in classic mode:");
+ for (String message : classicWindowMessages) {
+ log.info(" " + message);
+ }
+ }
+ }
+ log.info("The rest of the windows will be shown in new mode.");
+ }
+}
diff -r 1e4f6fe09807 -r c4bf3d9f768f src/log4j.properties
--- a/src/log4j.properties Tue Mar 08 17:38:14 2011 +0100
+++ b/src/log4j.properties Tue Mar 08 17:49:56 2011 +0100
@@ -21,10 +21,11 @@
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %x - %m%n
log4j.category.reloadXml=ERROR
log4j.category.org=WARN
+log4j.category.org.openbravo=INFO
# To error an specific class
#log4j.category.org.openbravo.erpCommon.ad_process=error
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits