svn commit: r1305581 [23/36] - in /ofbiz/branches/20111205EmailHandling: ./ applications/accounting/config/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/finaccount/ applications/ac...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1305581 [23/36] - in /ofbiz/branches/20111205EmailHandling: ./ applications/accounting/config/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/finaccount/ applications/ac...

erwan
Modified: ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/GroovyUtil.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/GroovyUtil.java Mon Mar 26 20:56:02 2012
@@ -30,6 +30,7 @@ import groovy.lang.GroovyShell;
 import javolution.util.FastMap;
 
 import org.codehaus.groovy.control.CompilationFailedException;
+import org.codehaus.groovy.control.CompilerConfiguration;
 import org.codehaus.groovy.runtime.InvokerHelper;
 import org.ofbiz.base.location.FlexibleLocation;
 import org.ofbiz.base.util.cache.UtilCache;
@@ -101,6 +102,9 @@ public class GroovyUtil {
     }
 
     public static Class<?> getScriptClassFromLocation(String location) throws GeneralException {
+        return getScriptClassFromLocation(location, null);
+    }
+    public static Class<?> getScriptClassFromLocation(String location, GroovyClassLoader groovyClassLoader) throws GeneralException {
         try {
             Class<?> scriptClass = parsedScripts.get(location);
             if (scriptClass == null) {
@@ -108,7 +112,11 @@ public class GroovyUtil {
                 if (scriptUrl == null) {
                     throw new GeneralException("Script not found at location [" + location + "]");
                 }
-                scriptClass = parseClass(scriptUrl.openStream(), location);
+                if (groovyClassLoader != null) {
+                    scriptClass = parseClass(scriptUrl.openStream(), location, groovyClassLoader);
+                } else {
+                    scriptClass = parseClass(scriptUrl.openStream(), location);
+                }
                 if (Debug.verboseOn()) {
                     Debug.logVerbose("Caching Groovy script at: " + location, module);
                 }
@@ -127,6 +135,9 @@ public class GroovyUtil {
     public static Class<?> parseClass(InputStream in, String location) throws IOException {
         return new GroovyClassLoader().parseClass(UtilIO.readString(in), location);
     }
+    public static Class<?> parseClass(InputStream in, String location, GroovyClassLoader groovyClassLoader) throws IOException {
+        return groovyClassLoader.parseClass(UtilIO.readString(in), location);
+    }
 
     public static Class<?> parseClass(String text) {
         return new GroovyClassLoader().parseClass(text);
@@ -137,7 +148,11 @@ public class GroovyUtil {
     }
 
     public static Object runScriptAtLocation(String location, Map<String, Object> context) throws GeneralException {
-        return InvokerHelper.createScript(getScriptClassFromLocation(location), getBinding(context)).run();
+        return runScriptAtLocation(location, context, null);
+    }
+
+    public static Object runScriptAtLocation(String location, Map<String, Object> context, GroovyClassLoader groovyClassLoader) throws GeneralException {
+        return InvokerHelper.createScript(getScriptClassFromLocation(location, groovyClassLoader), getBinding(context)).run();
     }
 
     public static Object runScriptFromClasspath(String script, Map<String,Object> context) throws GeneralException {

Modified: ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/ObjectType.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/ObjectType.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/ObjectType.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/ObjectType.java Mon Mar 26 20:56:02 2012
@@ -106,7 +106,7 @@ public class ObjectType {
         if (loader == null) loader = Thread.currentThread().getContextClassLoader();
 
         try {
-            theClass = loader.loadClass(className);
+            theClass = Class.forName(className, true, loader);
         } catch (Exception e) {
             theClass = classCache.get(className);
             if (theClass == null) {

Modified: ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/StringUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/StringUtil.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/StringUtil.java Mon Mar 26 20:56:02 2012
@@ -223,13 +223,14 @@ public class StringUtil {
     /**
      * Creates a Map from an encoded name/value pair string
      * @param str The string to decode and format
+     * @param delim the delimiter character(s) to join on (null will split on whitespace)
      * @param trim Trim whitespace off fields
      * @return a Map of name/value pairs
      */
-    public static Map<String, String> strToMap(String str, boolean trim) {
+    public static Map<String, String> strToMap(String str, String delim, boolean trim) {
         if (str == null) return null;
         Map<String, String> decodedMap = FastMap.newInstance();
-        List<String> elements = split(str, "|");
+        List<String> elements = split(str, delim);
 
         for (String s: elements) {
             List<String> e = split(s, "=");
@@ -260,12 +261,33 @@ public class StringUtil {
     /**
      * Creates a Map from an encoded name/value pair string
      * @param str The string to decode and format
+     * @param trim Trim whitespace off fields
+     * @return a Map of name/value pairs
+     */
+    public static Map<String, String> strToMap(String str, boolean trim) {
+        return strToMap(str, "|", trim);
+    }
+
+    /**
+     * Creates a Map from an encoded name/value pair string
+     * @param str The string to decode and format
+     * @param delim the delimiter character(s) to join on (null will split on whitespace)
+     * @return a Map of name/value pairs
+     */
+    public static Map<String, String> strToMap(String str, String delim) {
+        return strToMap(str, delim, false);
+    }
+
+    /**
+     * Creates a Map from an encoded name/value pair string
+     * @param str The string to decode and format
      * @return a Map of name/value pairs
      */
     public static Map<String, String> strToMap(String str) {
-        return strToMap(str, false);
+        return strToMap(str, "|", false);
     }
 
+    
     /**
      * Creates an encoded String from a Map of name/value pairs (MUST BE STRINGS!)
      * @param map The Map of name/value pairs

Modified: ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilIO.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilIO.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilIO.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilIO.java Mon Mar 26 20:56:02 2012
@@ -378,7 +378,7 @@ public final class UtilIO {
             for (i = offset; i < length && buffer[i] != ':'; i++);
             if (i > offset && i < length) {
                 String className = new String(buffer, offset, i);
-                Class<?> type = ClassLoaderContainer.getClassLoader().loadClass(className);
+                Class<?> type = Class.forName(className, true, ClassLoaderContainer.getClassLoader());
                 if (buffer[length - 1] == '\n') {
                     length--;
                 }

Modified: ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilMisc.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilMisc.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilMisc.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilMisc.java Mon Mar 26 20:56:02 2012
@@ -52,6 +52,8 @@ public class UtilMisc {
 
     public static final BigDecimal ZERO_BD = BigDecimal.ZERO;
 
+    private UtilMisc () {}
+
     public static final <T extends Throwable> T initCause(T throwable, Throwable cause) {
         throwable.initCause(cause);
         return throwable;

Modified: ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/UtilProperties.java Mon Mar 26 20:56:02 2012
@@ -964,8 +964,14 @@ public class UtilProperties implements S
                 throw new IllegalArgumentException("locale cannot be null");
             }
             String localeString = locale.toString();
+            String correctedLocaleString = localeString.replace('_','-');
             for (Element property : propertyList) {
-                Element value = UtilXml.firstChildElement(property, "value", "xml:lang", localeString);
+                // Support old way of specifying xml:lang value.
+                // Old way: en_AU, new way: en-AU
+                Element value = UtilXml.firstChildElement(property, "value", "xml:lang", correctedLocaleString);
+                if( value == null ) {
+                    value = UtilXml.firstChildElement(property, "value", "xml:lang", localeString);
+                }
                 if (value != null) {
                     if (properties == null) {
                         properties = new Properties();
@@ -1053,7 +1059,9 @@ public class UtilProperties implements S
                         bundle = new UtilResourceBundle(bundle.properties, locale, parentBundle);
                     }
                     double totalTime = System.currentTimeMillis() - startTime;
-                    Debug.logInfo("ResourceBundle " + resource + " (" + locale + ") created in " + totalTime/1000.0 + "s with " + numProperties + " properties", module);
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("ResourceBundle " + resource + " (" + locale + ") created in " + totalTime/1000.0 + "s with " + numProperties + " properties", module);
+                    }
                     bundleCache.put(resourceName, bundle);
                 }
             }

Modified: ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Mon Mar 26 20:56:02 2012
@@ -65,7 +65,7 @@ import com.googlecode.concurrentlinkedha
  */
 @SuppressWarnings("serial")
 public class UtilCache<K, V> implements Serializable, EvictionListener<Object, CacheLine<V>> {
-
+
     public static final String module = UtilCache.class.getName();
 
     /** A static Map to keep track of all of the UtilCache instances. */
@@ -190,11 +190,11 @@ public class UtilCache<K, V> implements
     public static String getPropertyParam(ResourceBundle res, String[] propNames, String parameter) {
         try {
             for (String propName: propNames) {
-         if(res.containsKey(propName+ '.' + parameter)) {
-            try {
-         return res.getString(propName + '.' + parameter);
-            } catch (MissingResourceException e) {}
-         }
+            if(res.containsKey(propName+ '.' + parameter)) {
+                try {
+                return res.getString(propName + '.' + parameter);
+                } catch (MissingResourceException e) {}
+            }
             }
             // don't need this, just return null
             //if (value == null) {
@@ -1032,8 +1032,8 @@ public class UtilCache<K, V> implements
         return (UtilCache<K, V>) UtilCache.utilCacheTable.get(cacheName);
     }
 
- @Override
- public void onEviction(Object key, CacheLine<V> value) {
- ExecutionPool.removePulse(value);
- }
+    @Override
+    public void onEviction(Object key, CacheLine<V> value) {
+        ExecutionPool.removePulse(value);
+    }
 }

Modified: ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java Mon Mar 26 20:56:02 2012
@@ -21,6 +21,7 @@ package org.ofbiz.base.util.string;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
@@ -29,19 +30,8 @@ import javax.el.PropertyNotFoundExceptio
 
 import org.ofbiz.base.lang.IsEmpty;
 import org.ofbiz.base.lang.SourceMonitored;
-import org.ofbiz.base.util.BshUtil;
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.GroovyUtil;
-import org.ofbiz.base.util.ObjectType;
-import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilFormatOut;
-import org.ofbiz.base.util.UtilGenerics;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.*;
 import org.ofbiz.base.util.cache.UtilCache;
-import org.codehaus.groovy.runtime.InvokerHelper;
-
-import bsh.EvalError;
 
 /** Expands String values that contain Unified Expression Language (JSR 245)
  * syntax. This class also supports the execution of bsh scripts by using the
@@ -268,10 +258,10 @@ public abstract class FlexibleStringExpa
             }
             if (expression.indexOf("bsh:", start + 2) == start + 2 && !escapedExpression) {
                 // checks to see if this starts with a "bsh:", if so treat the rest of the expression as a bsh scriptlet
-                strElems.add(new BshElem(chars, start, Math.min(end + 1, start + length) - start, start + 6, end - start - 6));
+                strElems.add(new ScriptElem(chars, start, Math.min(end + 1, start + length) - start, start + 6, end - start - 6));
             } else if (expression.indexOf("groovy:", start + 2) == start + 2 && !escapedExpression) {
                 // checks to see if this starts with a "groovy:", if so treat the rest of the expression as a groovy scriptlet
-                strElems.add(new GroovyElem(chars, start, Math.min(end + 1, start + length) - start, start + 9, end - start - 9));
+                strElems.add(new ScriptElem(chars, start, Math.min(end + 1, start + length) - start, start + 9, end - start - 9));
             } else {
                 // Scan for matching closing bracket
                 int ptr = expression.indexOf(openBracket, start + 2);
@@ -488,35 +478,6 @@ public abstract class FlexibleStringExpa
         }
     }
 
-    /** An object that represents a <code>${bsh:}</code> expression. */
-    protected static class BshElem extends ArrayOffsetString {
-        private final int parseStart;
-        private final int parseLength;
-
-        protected BshElem(char[] chars, int offset, int length, int parseStart, int parseLength) {
-            super(chars, offset, length);
-            this.parseStart = parseStart;
-            this.parseLength = parseLength;
-        }
-
-        @Override
-        protected Object get(Map<String, ? extends Object> context, TimeZone timeZone, Locale locale) {
-            try {
-                Object obj = BshUtil.eval(new String(this.chars, this.parseStart, this.parseLength), UtilMisc.makeMapWritable(context));
-                if (obj != null) {
-                    return obj;
-                } else {
-                    if (Debug.verboseOn()) {
-                        Debug.logVerbose("BSH scriptlet evaluated to null [" + this + "], got no return so inserting nothing.", module);
-                    }
-                }
-            } catch (EvalError e) {
-                Debug.logWarning(e, "Error evaluating BSH scriptlet [" + this + "], inserting nothing; error was: " + e, module);
-            }
-            return null;
-        }
-    }
-
     /** An object that represents a <code>String</code> constant portion of an expression. */
     protected static class ConstSimpleElem extends FlexibleStringExpander {
         protected ConstSimpleElem(char[] chars) {
@@ -613,29 +574,37 @@ public abstract class FlexibleStringExpa
         }
     }
 
-    /** An object that represents a <code>${groovy:}</code> expression. */
-    protected static class GroovyElem extends ArrayOffsetString {
+    /** An object that represents a <code>${[groovy|bsh]:}</code> expression. */
+    protected static class ScriptElem extends ArrayOffsetString {
+        private final String language;
+        private final int parseStart;
+        private final int parseLength;
+        private final String script;
         protected final Class<?> parsedScript;
 
-        protected GroovyElem(char[] chars, int offset, int length, int parseStart, int parseLength) {
+        protected ScriptElem(char[] chars, int offset, int length, int parseStart, int parseLength) {
             super(chars, offset, length);
-            this.parsedScript = GroovyUtil.parseClass(new String(chars, parseStart, parseLength));
+            this.language = new String(this.chars, offset + 2, parseStart - offset - 3);
+            this.parseStart = parseStart;
+            this.parseLength = parseLength;
+            this.script = new String(this.chars, this.parseStart, this.parseLength);
+            this.parsedScript = ScriptUtil.parseScript(this.language, this.script);
         }
 
         @Override
         protected Object get(Map<String, ? extends Object> context, TimeZone timeZone, Locale locale) {
             try {
-                Object obj = InvokerHelper.createScript(this.parsedScript, GroovyUtil.getBinding(context)).run();
+                Map <String, Object> contextCopy = new HashMap<String, Object>(context);
+                Object obj = ScriptUtil.evaluate(this.language, this.script, this.parsedScript, contextCopy);
                 if (obj != null) {
                     return obj;
                 } else {
                     if (Debug.verboseOn()) {
-                        Debug.logVerbose("Groovy scriptlet evaluated to null [" + this + "], got no return so inserting nothing.", module);
+                        Debug.logVerbose("Scriptlet evaluated to null [" + this + "].", module);
                     }
                 }
             } catch (Exception e) {
-                // handle other things, like the groovy.lang.MissingPropertyException
-                Debug.logWarning(e, "Error evaluating Groovy scriptlet [" + this + "], inserting nothing; error was: " + e, module);
+                Debug.logWarning(e, "Error evaluating scriptlet [" + this + "]; error was: " + e, module);
             }
             return null;
         }

Modified: ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Mon Mar 26 20:56:02 2012
@@ -277,6 +277,14 @@ public class FreeMarkerWorker {
         env.setTimeZone(timeZone);
     }
 
+    /**
+     * Returns a <code>Configuration</code> instance initialized to OFBiz defaults. Client code should
+     * call this method instead of creating its own <code>Configuration</code> instance. The instance
+     * returned by this method includes the <code>component://</code> resolver and the OFBiz custom
+     * transformations.
+     *
+     * @return A <code>Configuration</code> instance.
+     */
     public static Configuration getDefaultOfbizConfig() {
         return defaultOfbizConfig;
     }

Modified: ofbiz/branches/20111205EmailHandling/framework/base/testdef/basetests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/base/testdef/basetests.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/base/testdef/basetests.xml (original)
+++ ofbiz/branches/20111205EmailHandling/framework/base/testdef/basetests.xml Mon Mar 26 20:56:02 2012
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
@@ -33,7 +34,8 @@
         <junit-test-suite class-name="org.ofbiz.base.conversion.test.MiscTests"/>
         <junit-test-suite class-name="org.ofbiz.base.concurrent.test.DependencyPoolTests"/>
         <junit-test-suite class-name="org.ofbiz.base.json.test.JSONTests"/>
-        <junit-test-suite class-name="org.ofbiz.base.util.test.UtilIOTests"/>
+        <!--junit-test-suite class-name="org.ofbiz.base.util.test.UtilIOTests"/-->
         <junit-test-suite class-name="org.ofbiz.base.test.BaseUnitTests"/>
+        <junit-test-suite class-name="org.ofbiz.base.util.test.UtilPropertiesTests"/>
     </test-group>
 </test-suite>

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/data/helpdata/HELP_BIRT.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/data/helpdata/HELP_BIRT.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/data/helpdata/HELP_BIRT.xml (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/data/helpdata/HELP_BIRT.xml Mon Mar 26 20:56:02 2012
@@ -75,8 +75,12 @@ under the License.
         <title>Which are the supported content types?</title>
         <para>text/html</para>
         <para>application/pdf</para>
+        <para>application/postscript</para>
         <para>application/vnd.ms-excel</para>
         <para>application/vnd.ms-word</para>
         <para>application/vnd.ms-powerpoint</para>
+        <para>application/vnd.oasis.opendocument.text</para>
+        <para>application/vnd.oasis.opendocument.spreadsheet</para>
+        <para>application/vnd.oasis.opendocument.presentation</para>
     </section>
 </section>

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/documents/Birt.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/documents/Birt.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/documents/Birt.xml (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/documents/Birt.xml Mon Mar 26 20:56:02 2012
@@ -21,7 +21,7 @@
     version="5.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
     xsi:schemaLocation="http://docbook.org/ns/docbook ../../applications/content/dtd/docbook.xsd"
     xmlns="http://docbook.org/ns/docbook">
-    <title>Birt report generator.</title>
+    <title>BIRT report generator.</title>
     <para>
         An example report sales can be found in the example component.
     </para>

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/lib/viewservlets.jar
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/lib/viewservlets.jar?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
Binary files - no diff available.

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/ofbiz-component.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/ofbiz-component.xml (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/ofbiz-component.xml Mon Mar 26 20:56:02 2012
@@ -23,12 +23,6 @@ under the License.
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
     <resource-loader name="main" type="component"/>
     <classpath type="jar" location="lib/*"/>
-    <classpath type="jar" location="lib/platform/plugins/org.eclipse.emf.common_2.6.0.v20100607-0756.jar"/>
-    <classpath type="jar" location="lib/platform/plugins/org.eclipse.emf.ecore_2.6.0.v20100607-0756.jar"/>
-    <classpath type="jar" location="lib/platform/plugins/org.eclipse.emf.ecore.xmi_2.5.0.v20100521-1846.jar"/>
-    <classpath type="jar" location="lib/platform/plugins/org.w3c.css.sac_1.3.0.v200805290154.jar"/>
-    <classpath type="jar" location="lib/platform/plugins/org.mozilla.rhino_1.7.1.v20090608/lib/js.jar"/>
-    <classpath type="jar" location="lib/platform/plugins/org.w3c.sac_1.3.0.v20070710/lib/flute.jar"/>
     <classpath type="jar" location="build/lib/*"/>
     <classpath type="dir" location="config"/>
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/BirtWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/BirtWorker.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/BirtWorker.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/BirtWorker.java Mon Mar 26 20:56:02 2012
@@ -42,7 +42,6 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.birt.container.BirtContainer;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.LocalDispatcher;
@@ -83,78 +82,72 @@ public class BirtWorker {
              birtImageDirectory = "/";
         }
         Debug.logInfo("Get report engine", module);
-        IReportEngine engine = BirtContainer.getReportEngine();
-
-        /*
-        --- DISABLE JDBC FEATURE
-        // set the jdbc connection
-        String delegatorGroupHelperName = BirtContainer.getDelegatorGroupHelperName();
-        Delegator delegator = BirtContainer.getDelegator();
-        Debug.logInfo("Get the JDBC connection from group helper's name:" + delegatorGroupHelperName, module);
-        String helperName = delegator.getGroupHelperName(delegatorGroupHelperName);    // gets the helper (localderby, localmysql, localpostgres, etc.) for your entity group org.ofbiz
-        Connection connection = ConnectionFactory.getConnection(helperName);
-        engine.getConfig().getAppContext().put("OdaJDBCDriverPassInConnection", connection);
-        */
+        IReportEngine engine = BirtFactory.getReportEngine();
 
         IRunAndRenderTask task = engine.createRunAndRenderTask(design);
         if (birtLocale != null) {
-            Debug.logInfo("Set birt locale:" + birtLocale, module);
+            Debug.logInfo("Set BIRT locale:" + birtLocale, module);
             task.setLocale(birtLocale);
         }
 
         // set parameters if exists
         Map<String, Object> parameters = UtilGenerics.cast(context.get(BirtWorker.BIRT_PARAMETERS));
         if (parameters != null) {
-            Debug.logInfo("Set birt parameters:" + parameters, module);
+            Debug.logInfo("Set BIRT parameters:" + parameters, module);
             task.setParameterValues(parameters);
         }
 
         // set output options
         RenderOption options = new RenderOption();
-        if ("text/html".equalsIgnoreCase(contentType)) {
+        if ("text/html".equalsIgnoreCase(contentType)) { // HTML
             options.setOutputFormat(RenderOption.OUTPUT_FORMAT_HTML);
-        } else if ("application/pdf".equalsIgnoreCase(contentType)) {
-            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
-        } else if ("application/vnd.ms-word".equalsIgnoreCase(contentType)) {
-            options.setOutputFormat("doc");
-        }  else if ("application/vnd.ms-excel".equalsIgnoreCase(contentType)) {
-            options.setOutputFormat("xls");
-        } else if ("application/vnd.ms-powerpoint".equalsIgnoreCase(contentType)) {
-            options.setOutputFormat("ppt");
-        } else {
-            throw new GeneralException("Unknown content type : " + contentType);
-        }
-
-        if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_HTML)) {
-            // set html render options
             HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
             htmlOptions.setImageDirectory(birtImageDirectory);
             htmlOptions.setBaseImageURL(birtImageDirectory);
             options.setImageHandler(imageHandler);
-        } else if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_PDF)) {
-            // set pdf render options
+        } else if ("application/postscript".equalsIgnoreCase(contentType)) { // Post Script
+            options.setOutputFormat("postscript");
+        } else if ("application/pdf".equalsIgnoreCase(contentType)) { // PDF
+            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
             PDFRenderOption pdfOptions = new PDFRenderOption(options);
             pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, Boolean.TRUE );
-        } else if (options.getOutputFormat().equalsIgnoreCase("xls")) {
-            // set excel render options
+        } else if ("application/vnd.ms-word".equalsIgnoreCase(contentType)) { // MS Word
+            options.setOutputFormat("doc");
+        }  else if ("application/vnd.ms-excel".equalsIgnoreCase(contentType)) { // MS Excel
+            options.setOutputFormat("xls");
             new EXCELRenderOption(options);
+        } else if ("application/vnd.ms-powerpoint".equalsIgnoreCase(contentType)) { // MS Power Point
+            options.setOutputFormat("ppt");
+        } else if ("application/vnd.oasis.opendocument.text".equalsIgnoreCase(contentType)) { // Open Document Text
+            options.setOutputFormat("odt");
+        } else if ("application/vnd.oasis.opendocument.spreadsheet".equalsIgnoreCase(contentType)) { // Open Document Spreadsheet
+            options.setOutputFormat("ods");
+        } else if ("application/vnd.oasis.opendocument.presentation".equalsIgnoreCase(contentType)) { // Open Document Presentation
+            options.setOutputFormat("odp");
+        } else {
+            throw new GeneralException("Unknown content type : " + contentType);
         }
+
         options.setOutputStream(output);
         task.setRenderOption(options);
 
         // run report
-        Debug.logInfo("Birt's locale is: " + task.getLocale(), module);
+        Debug.logInfo("BIRT's locale is: " + task.getLocale(), module);
         Debug.logInfo("Run report's task", module);
         task.run();
         task.close();
     }
     
-    public static void setWebContextObjects(IReportEngine engine, HttpServletRequest request, HttpServletResponse response) {
+    /**
+     * set web context objects
+     * @param engine
+     * @param request
+     * @param response
+     */
+    public static void setWebContextObjects(Map<String, Object> appContext, HttpServletRequest request, HttpServletResponse response) {
         HttpSession session = request.getSession();
         ServletContext servletContext = session.getServletContext();
         
-        Map<String, Object> appContext = UtilGenerics.checkMap(engine.getConfig().getAppContext());
-        
         // set delegator
         Delegator delegator = (Delegator) session.getAttribute("delegator");
         if (UtilValidate.isEmpty(delegator)) {
@@ -167,7 +160,10 @@ public class BirtWorker {
             appContext.put("delegator", delegator);
         }
 
-        // set delegator
+        // set JDBC connection
+        //appContext.put("OdaJDBCDriverPassInConnection", connection);
+
+        // set dispatcher
         LocalDispatcher dispatcher = (LocalDispatcher) session.getAttribute("dispatcher");
         if (UtilValidate.isEmpty(dispatcher)) {
             dispatcher = (LocalDispatcher) servletContext.getAttribute("dispatcher");

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/container/BirtContainer.java Mon Mar 26 20:56:02 2012
@@ -19,47 +19,25 @@
 package org.ofbiz.birt.container;
 
 import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.logging.Level;
 
-import javolution.util.FastMap;
-
 import org.eclipse.birt.core.exception.BirtException;
 import org.eclipse.birt.core.framework.Platform;
-import org.eclipse.birt.core.framework.PlatformFileContext;
 import org.eclipse.birt.report.engine.api.EngineConfig;
-import org.eclipse.birt.report.engine.api.EngineConstants;
 import org.eclipse.birt.report.engine.api.IReportEngine;
 import org.eclipse.birt.report.engine.api.IReportEngineFactory;
 import org.ofbiz.base.container.Container;
 import org.ofbiz.base.container.ContainerConfig;
 import org.ofbiz.base.container.ContainerException;
 import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.FileUtil;
-import org.ofbiz.base.util.UtilGenerics;
-import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.DelegatorFactory;
-import org.ofbiz.service.GenericDispatcher;
-import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.birt.BirtFactory;
 
 public class BirtContainer implements Container {
 
     public static final String module = BirtContainer.class.getName();
-
-    public final static String CONFIG_FILE = "birt.properties";
-
-    protected EngineConfig config;
+    
     protected String configFile;
 
-    private static IReportEngine engine;
-    private static String delegatorGroupHelperName;
-    private static String delegatorName;
-    private static String dispatcherName;
-    private static Delegator delegator;
-    private static LocalDispatcher dispatcher;
-
     public void init(String[] args, String configFile)
             throws ContainerException {
         this.configFile = configFile;
@@ -69,7 +47,7 @@ public class BirtContainer implements Co
      * start container
      */
     public boolean start() throws ContainerException {
-        Debug.logInfo("Start birt container", module);
+        Debug.logInfo("Start BIRT container", module);
 
         // make sure the subclass sets the config name
         if (this.getContainerConfigName() == null) {
@@ -81,67 +59,32 @@ public class BirtContainer implements Co
             throw new ContainerException("No " + this.getContainerConfigName() + " configuration found in container config!");
         }
 
-        config = new EngineConfig();
-
-        // set osgi config
-        Map<String, String> osgiConfig = FastMap.newInstance();
-        osgiConfig.put("osgi.configuration.area", new File(System.getProperty("ofbiz.home"), "runtime" + File.separator + "tempfiles").getPath());
-        config.setOSGiConfig(osgiConfig);
-
-        HashMap<String, Object> context = UtilGenerics.cast(config.getAppContext());
-
-        // set delegator, dispatcher and security objects to report
-
-        delegatorGroupHelperName = ContainerConfig.getPropertyValue(cc, "delegator-group-helper-name", "org.ofbiz");
-
-        // get the delegator
-        delegatorName = ContainerConfig.getPropertyValue(cc, "delegator-name", "default");
-        delegator = DelegatorFactory.getDelegator(delegatorName);
-
-        // get the dispatcher
-        dispatcherName = ContainerConfig.getPropertyValue(cc, "dispatcher-name", "birt-dispatcher");
-        dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator);
-
-        context.put("delegator", delegator);
-        context.put("dispatcher", dispatcher);
-
-        // set classloader for engine
-        context.put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, BirtContainer.class.getClassLoader());
-        context.put(EngineConstants.WEBAPP_CLASSPATH_KEY, BirtContainer.class.getClassLoader());
-
-        // set log config to show all level in console
-        config.setLogConfig(null, Level.ALL);
-
-        // set engine home
-        String reportEnginePath = FileUtil.getFile("component://birt/lib/platform").getPath();
-        config.setEngineHome(reportEnginePath);
-        config.setBIRTHome(reportEnginePath);
-
-        // set OSGi arguments specific in properties
-        String argumentsString = UtilProperties.getPropertyValue(BirtContainer.CONFIG_FILE, "birt.osgi.arguments");
-        config.setOSGiArguments(argumentsString.split(","));
-
-        // set platform file context
-        config.setPlatformContext(new PlatformFileContext(config));
-        config.setAppContext(context);
+        // create engine config
+        EngineConfig config = new EngineConfig();
+        String ofbizHome = System.getProperty("ofbiz.home");
+        config.setTempDir(ofbizHome + File.separatorChar + "runtime" + File.separatorChar + "tempfiles");
+        config.setLogConfig(ofbizHome + File.separatorChar + "runtime" + File.separatorChar + "logs", Level.ALL);
 
         // startup platform
         try {
-            Debug.logInfo("Startup birt platform", module);
-            Platform.startup( config );
-        } catch ( BirtException e ) {
+            Debug.logInfo("Startup BIRT platform", module);
+            Platform.startup(config);
+        } catch (BirtException e) {
             throw new ContainerException(e);
         }
 
         // create report engine
         Debug.logInfo("Create factory object", module);
         IReportEngineFactory factory = (IReportEngineFactory) Platform
-              .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
+              .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
         if (factory == null) {
             throw new ContainerException("can not create birt engine factory");
         }
         Debug.logInfo("Create report engine", module);
-        engine = factory.createReportEngine( config );
+        IReportEngine engine = factory.createReportEngine(config);
+        BirtFactory.setReportEngine(engine);
+        
+        // print supported formats
         String[] supportedFormats = engine.getSupportedFormats();
         String formatList = null;
         for (String supportedFormat : supportedFormats) {
@@ -161,28 +104,4 @@ public class BirtContainer implements Co
     public String getContainerConfigName() {
         return "birt-container";
     }
-
-    public static IReportEngine getReportEngine() {
-        return engine;
-    }
-
-    public static String getDelegatorGroupHelperName() {
-        return delegatorGroupHelperName;
-    }
-
-    public static String getDelegatorName() {
-        return delegatorName;
-    }
-
-    public static String getDispatcherName() {
-        return dispatcherName;
-    }
-
-    public static Delegator getDelegator() {
-        return delegator;
-    }
-
-    public static LocalDispatcher getDispatcher() {
-        return dispatcher;
-    }
 }

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java Mon Mar 26 20:56:02 2012
@@ -44,15 +44,14 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.collections.MapStack;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
+import org.ofbiz.birt.BirtFactory;
 import org.ofbiz.birt.BirtWorker;
-import org.ofbiz.birt.container.BirtContainer;
 import org.ofbiz.common.email.NotificationServices;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceUtil;
-import org.ofbiz.birt.widget.BirtFactory;
 import org.ofbiz.widget.html.HtmlScreenRenderer;
 import org.ofbiz.widget.screen.ScreenRenderer;
 import org.xml.sax.SAXException;
@@ -158,7 +157,7 @@ public class BirtEmailServices {
                 if (birtContentType == null) {
                     birtContentType = "application/pdf";
                 }
-                IReportEngine engine = BirtContainer.getReportEngine();
+                IReportEngine engine = BirtFactory.getReportEngine();
                 HashMap<String, Object> appContext = UtilGenerics.cast(engine.getConfig().getAppContext());
                 appContext.put("delegator", delegator);
                 appContext.put("dispatcher", dispatcher);

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/context/BirtViewerAttributeBean.java Mon Mar 26 20:56:02 2012
@@ -39,8 +39,7 @@ public class BirtViewerAttributeBean ext
     }
 
     @Override
-    protected void __init( HttpServletRequest request ) throws Exception
-    {
+    protected void __init(HttpServletRequest request) throws Exception {
         String reportParam = DataUtil.trimString( ParameterAccessor.getParameter( request, ParameterAccessor.PARAM_REPORT ));
         if (reportParam.startsWith("component://")) {
             ClassLoader loader = Thread.currentThread().getContextClassLoader();

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/context/OFBizBirtContext.java Mon Mar 26 20:56:02 2012
@@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletRes
 import org.eclipse.birt.report.IBirtConstants;
 import org.eclipse.birt.report.context.BirtContext;
 import org.eclipse.birt.report.context.ViewerAttributeBean;
+import org.ofbiz.base.util.UtilValidate;
 
 public class OFBizBirtContext extends BirtContext {
 
@@ -36,12 +37,10 @@ public class OFBizBirtContext extends Bi
 
     @Override
     protected void __init() {
-        this.bean = (ViewerAttributeBean) request
-                .getAttribute( IBirtConstants.ATTRIBUTE_BEAN );
-        if ( bean == null )
-        {
-            bean = new BirtViewerAttributeBean( request );
+        this.bean = (ViewerAttributeBean) request.getAttribute(IBirtConstants.ATTRIBUTE_BEAN);
+        if (UtilValidate.isEmpty(bean)) {
+            bean = new BirtViewerAttributeBean(request);
         }
-        request.setAttribute( IBirtConstants.ATTRIBUTE_BEAN, bean );
+        request.setAttribute(IBirtConstants.ATTRIBUTE_BEAN, bean);
     }
 }

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java Mon Mar 26 20:56:02 2012
@@ -18,20 +18,18 @@
  *******************************************************************************/
 package org.ofbiz.birt.report.servlet;
 
-import javax.servlet.ServletConfig;
+import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.eclipse.birt.core.exception.BirtException;
 import org.eclipse.birt.report.context.IContext;
-import org.eclipse.birt.report.engine.api.IReportEngine;
-import org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment;
-import org.eclipse.birt.report.presentation.aggregation.layout.RequesterFragment;
 import org.eclipse.birt.report.service.BirtReportServiceFactory;
+import org.eclipse.birt.report.service.ReportEngineService;
+import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.birt.BirtWorker;
-import org.ofbiz.birt.container.BirtContainer;
 import org.ofbiz.birt.report.context.OFBizBirtContext;
-import org.ofbiz.birt.report.service.OFBizBirtViewerReportService;
 
 @SuppressWarnings("serial")
 public class BirtEngineServlet extends org.eclipse.birt.report.servlet.BirtEngineServlet {
@@ -39,27 +37,13 @@ public class BirtEngineServlet extends o
     public final static String module = BirtEngineServlet.class.getName();
 
     @Override
-    protected void __init( ServletConfig config )
-    {
-        BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config
-                .getServletContext( ) ) );
-
-        engine = new EngineFragment( );
-
-        requester = new RequesterFragment( );
-        requester.buildComposite( );
-        requester.setJSPRootPath( "/webcontent/birt" );
-    }
-
-    @Override
-    protected IContext __getContext( HttpServletRequest request,
-            HttpServletResponse response ) throws BirtException
-    {
-        IReportEngine reportEngine = BirtContainer.getReportEngine();
-        BirtWorker.setWebContextObjects(reportEngine, request, response);
+    protected IContext __getContext(HttpServletRequest request, HttpServletResponse response) throws BirtException {
+        BirtReportServiceFactory.getReportService().setContext(getServletContext( ), null);
+        
+        // set app context
+        Map<String, Object> appContext = UtilGenerics.cast(ReportEngineService.getInstance().getEngineConfig().getAppContext());
+        BirtWorker.setWebContextObjects(appContext, request, response);
         
-        BirtReportServiceFactory.getReportService( ).setContext(
-                getServletContext( ), null );
         return new OFBizBirtContext( request, response );
     }
 }

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java Mon Mar 26 20:56:02 2012
@@ -18,21 +18,19 @@
  *******************************************************************************/
 package org.ofbiz.birt.report.servlet;
 
-import javax.servlet.ServletConfig;
+import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.eclipse.birt.core.exception.BirtException;
 import org.eclipse.birt.report.context.IContext;
-import org.eclipse.birt.report.engine.api.IReportEngine;
-import org.eclipse.birt.report.presentation.aggregation.layout.FramesetFragment;
-import org.eclipse.birt.report.presentation.aggregation.layout.RunFragment;
 import org.eclipse.birt.report.service.BirtReportServiceFactory;
+import org.eclipse.birt.report.service.ReportEngineService;
 import org.eclipse.birt.report.servlet.ViewerServlet;
+import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.birt.BirtWorker;
-import org.ofbiz.birt.container.BirtContainer;
 import org.ofbiz.birt.report.context.OFBizBirtContext;
-import org.ofbiz.birt.report.service.OFBizBirtViewerReportService;
 
 @SuppressWarnings("serial")
 public class BirtViewerServlet extends ViewerServlet {
@@ -40,30 +38,13 @@ public class BirtViewerServlet extends V
     public final static String module = BirtViewerServlet.class.getName();
 
     @Override
-    protected void __init(ServletConfig config) {
-        BirtReportServiceFactory.init( new OFBizBirtViewerReportService( config
-                .getServletContext( ) ) );
-
-        // handle 'frameset' pattern
-        viewer = new FramesetFragment( );
-        viewer.buildComposite( );
-        viewer.setJSPRootPath( "/webcontent/birt" );
-
-        // handle 'run' pattern
-        run = new RunFragment( );
-        run.buildComposite( );
-        run.setJSPRootPath( "/webcontent/birt" );
-    }
-
-    @Override
-    protected IContext __getContext( HttpServletRequest request,
-            HttpServletResponse response ) throws BirtException
-    {
-        IReportEngine reportEngine = BirtContainer.getReportEngine();
-        BirtWorker.setWebContextObjects(reportEngine, request, response);
+    protected IContext __getContext(HttpServletRequest request, HttpServletResponse response) throws BirtException {
+        BirtReportServiceFactory.getReportService().setContext(getServletContext( ), null);
+        
+        // set app context
+        Map<String, Object> appContext = UtilGenerics.cast(ReportEngineService.getInstance().getEngineConfig().getAppContext());
+        BirtWorker.setWebContextObjects(appContext, request, response);
         
-        BirtReportServiceFactory.getReportService( ).setContext(
-                getServletContext( ), null );
         return new OFBizBirtContext( request, response );
     }
 }

Modified: ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java (original)
+++ ofbiz/branches/20111205EmailHandling/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java Mon Mar 26 20:56:02 2012
@@ -40,12 +40,11 @@ import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.birt.BirtFactory;
 import org.ofbiz.birt.BirtWorker;
-import org.ofbiz.birt.container.BirtContainer;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.webapp.view.ViewHandler;
 import org.ofbiz.webapp.view.ViewHandlerException;
-import org.ofbiz.birt.widget.BirtFactory;
 import org.xml.sax.SAXException;
 
 public class BirtViewHandler implements ViewHandler {
@@ -73,7 +72,7 @@ public class BirtViewHandler implements
             HttpServletResponse response) throws ViewHandlerException {
         
         try {
-            IReportEngine engine = BirtContainer.getReportEngine();
+            IReportEngine engine = org.ofbiz.birt.BirtFactory.getReportEngine();
             // open report design
             IReportRunnable design = null;
             if (page.startsWith("component://")) {
@@ -83,7 +82,8 @@ public class BirtViewHandler implements
                 design = engine.openReportDesign(servletContext.getRealPath(page));
             }
             
-            BirtWorker.setWebContextObjects(engine, request, response);
+            Map<String, Object> appContext = UtilGenerics.cast(engine.getConfig().getAppContext());
+            BirtWorker.setWebContextObjects(appContext, request, response);
 
             Map<String, Object> context = FastMap.newInstance();
             // set parameters from request
@@ -105,6 +105,12 @@ public class BirtViewHandler implements
                 response.setHeader("Content-Disposition", "attachment; filename=" + outputFileName);
             }
             
+            // set override content type
+            String overrideContentType = (String) request.getAttribute(BirtWorker.BIRT_CONTENT_TYPE);
+            if (UtilValidate.isNotEmpty(overrideContentType)) {
+                contentType = overrideContentType;
+            }
+            
             context.put(BirtWorker.BIRT_LOCALE, locale);
             String birtImageDirectory = UtilProperties.getPropertyValue("birt", "birt.html.image.directory");
             context.put(BirtWorker.BIRT_IMAGE_DIRECTORY, birtImageDirectory);

Modified: ofbiz/branches/20111205EmailHandling/framework/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/build.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/build.xml (original)
+++ ofbiz/branches/20111205EmailHandling/framework/build.xml Mon Mar 26 20:56:02 2012
@@ -25,8 +25,7 @@ under the License.
         files="start/build.xml,base/build.xml,sql/build.xml,
                entity/build.xml,geronimo/build.xml,
                catalina/build.xml,jetty/build.xml,
-               security/build.xml,service/build.xml,entityext/build.xml,
-               webslinger/build.xml,
+               security/build.xml,service/build.xml,jcr/build.xml,entityext/build.xml,
                bi/build.xml,minilang/build.xml,
                webapp/build.xml,guiapp/build.xml,widget/build.xml,
                common/build.xml,datafile/build.xml,birt/build.xml,
@@ -52,7 +51,6 @@ under the License.
         <mkdir dir="../runtime/logs/test-results"/>
         <mkdir dir="../runtime/data"/>
         <mkdir dir="../runtime/data/derby"/>
-        <mkdir dir="../runtime/data/hsql"/>
 
         <condition property="isMac">
             <os family="mac"/>

Modified: ofbiz/branches/20111205EmailHandling/framework/common/config/CommonEntityLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/config/CommonEntityLabels.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/common/config/CommonEntityLabels.xml (original)
+++ ofbiz/branches/20111205EmailHandling/framework/common/config/CommonEntityLabels.xml Mon Mar 26 20:56:02 2012
@@ -8711,6 +8711,18 @@
         <value xml:lang="zh">合格的</value>
         <value xml:lang="zh_TW">合格的</value>
     </property>
+    <property key="StatusItem.description.LEAVE_CREATED">
+        <value xml:lang="en">Created</value>
+        <value xml:lang="fr">Créé</value>
+    </property>
+    <property key="StatusItem.description.LEAVE_APPROVED">
+        <value xml:lang="en">Approved</value>
+        <value xml:lang="fr">Validé</value>
+    </property>
+    <property key="StatusItem.description.LEAVE_REJECTED">
+        <value xml:lang="en">Rejected</value>
+        <value xml:lang="fr">Rejeté</value>
+    </property>
     <property key="StatusItem.description.MKTG_CAMP_APPROVED">
         <value xml:lang="de">Genehmigt</value>
         <value xml:lang="en">Approved</value>
@@ -10329,6 +10341,10 @@
         <value xml:lang="zh">处理中</value>
         <value xml:lang="zh_TW">處理中</value>
     </property>
+    <property key="StatusItem.description.TRAINING_APPLIED">
+        <value xml:lang="en">Applied</value>
+        <value xml:lang="fr">Postulée</value>
+    </property>
     <property key="StatusItem.description.TRAINING_APPROVED">
         <value xml:lang="en">Approved</value>
         <value xml:lang="es">Aprobado</value>
@@ -10338,6 +10354,10 @@
         <value xml:lang="pt_BR">Aprovado</value>
         <value xml:lang="zh">已批准</value>
     </property>
+    <property key="StatusItem.description.TRAINING_ASSIGNED">
+        <value xml:lang="en">Assigned</value>
+        <value xml:lang="fr">Affecté</value>
+    </property>
     <property key="StatusItem.description.TRAINING_PROPOSED">
         <value xml:lang="de">Vorgeschlagen</value>
         <value xml:lang="en">Proposed</value>

Modified: ofbiz/branches/20111205EmailHandling/framework/common/config/CommonPortalEntityLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/framework/common/config/CommonPortalEntityLabels.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/framework/common/config/CommonPortalEntityLabels.xml (original)
+++ ofbiz/branches/20111205EmailHandling/framework/common/config/CommonPortalEntityLabels.xml Mon Mar 26 20:56:02 2012
@@ -25,18 +25,42 @@
         <value xml:lang="fr">Accueil</value>
         <value xml:lang="pt_BR">Principal</value>
     </property>
+    <property key="PortalPage.portalPageName.MYPORTAL_EMPLOYEE0">
+        <value xml:lang="en">My Comms</value>
+        <value xml:lang="fr">Mes communications</value>
+    </property>
     <property key="PortalPage.portalPageName.MYPORTAL_EMPLOYEE1">
         <value xml:lang="en">My Profile</value>
         <value xml:lang="es">Mi perfil</value>
         <value xml:lang="fr">Mon profil</value>
         <value xml:lang="pt_BR">Meu Perfil</value>
     </property>
+    <property key="PortalPage.portalPageName.MYPORTAL_EMPLOYEE2">
+        <value xml:lang="en">Other Party Comms</value>
+        <value xml:lang="fr">Autres communications</value>
+    </property>
     <property key="PortalPage.portalPageName.MYPORTAL_EMPLOYEE4">
         <value xml:lang="en">My Time Sheet</value>
         <value xml:lang="es">Mi hoja de tiempos</value>
         <value xml:lang="fr">Mes feuilles de temps</value>
         <value xml:lang="pt_BR">Minha folha de tempo</value>
     </property>
+    <property key="PortalPage.portalPageName.MYPORTAL_EMPLOYEE5">
+        <value xml:lang="en">My Tasks</value>
+        <value xml:lang="fr">Mes tâches</value>
+    </property>
+    <property key="PortalPage.portalPageName.MYPORTAL_EMPLOYEE6">
+        <value xml:lang="en">My Leave</value>
+        <value xml:lang="fr">Mes congés</value>
+    </property>
+    <property key="PortalPage.portalPageName.MYPORTAL_EMPLOYEE7">
+        <value xml:lang="en">My trainings</value>
+        <value xml:lang="fr">Mes formations</value>
+    </property>
+    <property key="PortalPage.portalPageName.MYPORTAL_EMPLOYEE8">
+        <value xml:lang="en">My Payments</value>
+        <value xml:lang="fr">Mes paiements</value>
+    </property>
     <property key="PortalPage.portalPageName.ProductStoreFacility">
         <value xml:lang="de">Lager</value>
         <value xml:lang="en">Facility</value>