svn commit: r584727 [1/2] - in /ofbiz/trunk: framework/entity/config/ specialpurpose/ specialpurpose/bi/ specialpurpose/bi/config/ specialpurpose/bi/data/ specialpurpose/bi/entitydef/ specialpurpose/bi/script/ specialpurpose/bi/script/org/ specialpurpo...

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

svn commit: r584727 [1/2] - in /ofbiz/trunk: framework/entity/config/ specialpurpose/ specialpurpose/bi/ specialpurpose/bi/config/ specialpurpose/bi/data/ specialpurpose/bi/entitydef/ specialpurpose/bi/script/ specialpurpose/bi/script/org/ specialpurpo...

jacopoc
Author: jacopoc
Date: Mon Oct 15 03:55:07 2007
New Revision: 584727

URL: http://svn.apache.org/viewvc?rev=584727&view=rev
Log:
First version/poc (proof of concept) for an integrated framework for business intelligence in OFBiz.
For now everything is in a separate specialpurpose component to facilitate the community review but as soon as everything will be consolidated the component will probably disappear (absorbed by the existing framework/applications components).

Added:
    ofbiz/trunk/specialpurpose/bi/   (with props)
    ofbiz/trunk/specialpurpose/bi/build.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/config/
    ofbiz/trunk/specialpurpose/bi/data/
    ofbiz/trunk/specialpurpose/bi/data/DimensionTypeData.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/entitydef/
    ofbiz/trunk/specialpurpose/bi/entitydef/entitygroup.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/entitydef/entitymodel.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/ofbiz-component.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/script/
    ofbiz/trunk/specialpurpose/bi/script/org/
    ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/
    ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/
    ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/DimensionServices.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/FactServices.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/servicedef/
    ofbiz/trunk/specialpurpose/bi/servicedef/secas.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/servicedef/services.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/src/
    ofbiz/trunk/specialpurpose/bi/src/org/
    ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/
    ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/
    ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/util/
    ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/util/DimensionServices.java   (with props)
    ofbiz/trunk/specialpurpose/bi/webapp/
    ofbiz/trunk/specialpurpose/bi/webapp/bi/
    ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/
    ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/
    ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/
    ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh   (with props)
    ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh   (with props)
    ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh   (with props)
    ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/controller.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/web.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/webapp/bi/reportbuilder/
    ofbiz/trunk/specialpurpose/bi/webapp/bi/reportbuilder/RenderStarSchemaReport.ftl   (with props)
    ofbiz/trunk/specialpurpose/bi/webapp/bi/reportbuilder/SelectStarSchemaFields.ftl   (with props)
    ofbiz/trunk/specialpurpose/bi/widget/
    ofbiz/trunk/specialpurpose/bi/widget/BiForms.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/widget/BiMenus.xml   (with props)
    ofbiz/trunk/specialpurpose/bi/widget/BiScreens.xml   (with props)
Modified:
    ofbiz/trunk/framework/entity/config/entityengine.xml
    ofbiz/trunk/specialpurpose/build.xml
    ofbiz/trunk/specialpurpose/component-load.xml

Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=584727&r1=584726&r2=584727&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
+++ ofbiz/trunk/framework/entity/config/entityengine.xml Mon Oct 15 03:55:07 2007
@@ -51,6 +51,7 @@
 
     <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
         <group-map group-name="org.ofbiz" datasource-name="localderby"/>
+        <group-map group-name="org.ofbiz.olap" datasource-name="localderby"/>
     </delegator>
     <delegator name="default-no-eca" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" entity-eca-enabled="false" distributed-cache-clear-enabled="false">
         <group-map group-name="org.ofbiz" datasource-name="localderby"/>
@@ -180,6 +181,28 @@
             isolation-level="ReadCommitted"
             pool-minsize="2"
             pool-maxsize="250"/>
+        <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
+    </datasource>
+    <datasource name="localderbyolap"
+            helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
+            schema-name="OFBIZ"
+            field-type-name="derby"
+            check-on-start="true"
+            add-missing-on-start="true"
+            use-pk-constraint-names="false"
+            use-indices-unique="false"
+            alias-view-columns="false">
+        <read-data reader-name="seed"/>
+        <read-data reader-name="demo"/>
+        <read-data reader-name="ext"/>
+        <inline-jdbc
+                jdbc-driver="org.apache.derby.jdbc.EmbeddedDriver"
+                jdbc-uri="jdbc:derby:ofbizolap;create=true"
+                jdbc-username="ofbiz"
+                jdbc-password="ofbiz"
+                isolation-level="ReadCommitted"
+                pool-minsize="2"
+                pool-maxsize="250"/>
         <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
     </datasource>
     

Propchange: ofbiz/trunk/specialpurpose/bi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Oct 15 03:55:07 2007
@@ -0,0 +1 @@
+build

Added: ofbiz/trunk/specialpurpose/bi/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/build.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/build.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/build.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,121 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="OFBiz - Business Intelligence" default="jar" basedir=".">
+
+    <!-- ================================================================== -->
+    <!-- Initialization of all property settings                            -->
+    <!-- ================================================================== -->
+
+    <target name="init">
+        <property environment="env"/>
+        <property name="desc" value="Business Intelligence Component"/>
+        <property name="name" value="ofbiz-bi"/>
+        <property name="ofbiz.home.dir" value="../.."/>
+        <property name="src.dir" value="src"/>
+        <property name="build.dir" value="build"/>
+    </target>
+
+    <target name="classpath">
+        <path id="local.class.path">
+            <fileset dir="../../framework/base/lib" includes="*.jar"/>
+            <fileset dir="../../framework/base/lib/commons" includes="*.jar"/>
+            <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>
+            <fileset dir="../../framework/base/lib/scripting" includes="*.jar"/>
+            <fileset dir="../../framework/base/build/lib" includes="*.jar"/>
+            <fileset dir="../../framework/entity/lib" includes="*.jar"/>
+            <fileset dir="../../framework/entity/build/lib" includes="*.jar"/>
+            <fileset dir="../../framework/security/build/lib" includes="*.jar"/>
+            <fileset dir="../../framework/service/lib" includes="*.jar"/>
+            <fileset dir="../../framework/service/build/lib" includes="*.jar"/>
+            <fileset dir="../../framework/entityext/build/lib" includes="*.jar"/>
+            <fileset dir="../../framework/guiapp/lib" includes="*.jar"/>
+            <fileset dir="../../framework/guiapp/build/lib" includes="*.jar"/>
+            <fileset dir="../../framework/webapp/build/lib" includes="*.jar"/>
+            <fileset dir="../../applications/party/build/lib" includes="*.jar"/>
+            <fileset dir="../../applications/product/build/lib" includes="*.jar"/>
+        </path>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Removes all created files and directories                          -->
+    <!-- ================================================================== -->
+
+    <target name="clean" depends="clean-lib">
+        <delete dir="${build.dir}"/>
+    </target>
+
+    <target name="clean-lib" depends="init">
+        <delete dir="${build.dir}/lib"/>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Makes sure the needed directory structure is in place              -->
+    <!-- ================================================================== -->
+
+    <target name="prepare" depends="clean-lib">
+        <mkdir dir="${build.dir}/classes"/>
+        <mkdir dir="${build.dir}/lib"/>
+    </target>
+
+    <target name="prepare-docs" depends="init">
+        <mkdir dir="${build.dir}/javadocs"/>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Compilation of the source files                                                                                                                         -->
+    <!-- ================================================================== -->
+
+    <target name="classes" depends="prepare,classpath">
+     <javac debug="on" source="1.5" deprecation="on" destdir="${build.dir}/classes">
+            <classpath>
+                <path refid="local.class.path"/>
+            </classpath>
+            <src path="${src.dir}"/>
+        </javac>
+        <copy todir="${build.dir}/classes">
+            <fileset dir="${src.dir}" includes="**/*.properties,**/*.xml,**/*.bsh,**/*.logic,**/*.js,**/*.jacl,**/*.py"/>
+        </copy>
+        
+        <!-- now add the NOTICE and LICENSE files to allow the jar file to be distributed alone -->
+        <copy todir="${build.dir}/classes/META-INF">
+            <fileset dir="${ofbiz.home.dir}" includes="NOTICE,LICENSE"/>
+        </copy>        
+    </target>
+
+    <target name="jar" depends="classes">
+        <jar jarfile="${build.dir}/lib/${name}.jar" basedir="${build.dir}/classes"/>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Build JavaDoc                                                      -->
+    <!-- ================================================================== -->
+
+    <target name="docs" depends="prepare-docs,classpath">
+        <javadoc packagenames="org.ofbiz.bi.*"
+                 classpathref="local.class.path"
+                 destdir="${build.dir}/javadocs"
+                 Windowtitle="Open for Business - ${desc}">
+            <sourcepath path="${src.dir}"/>
+        </javadoc>
+    </target>
+
+    <target name="all" depends="jar,docs"/>
+</project>

Propchange: ofbiz/trunk/specialpurpose/bi/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/build.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/bi/data/DimensionTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/data/DimensionTypeData.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/data/DimensionTypeData.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/data/DimensionTypeData.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,31 @@
+<?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
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<entity-engine-xml>
+
+    <CurrencyDimension dimensionId="_NF_" description="Currency Not Found."/>
+    <CurrencyDimension dimensionId="_NA_" description="Currency Not Set."/>
+
+    <DateDimension dimensionId="_NF_" description="Date Not Found."/>
+    <DateDimension dimensionId="_NA_" description="Date Not Set."/>
+
+    <ProductDimension dimensionId="_NF_" description="Product Not Found."/>
+    <ProductDimension dimensionId="_NA_" description="Product Not Set."/>
+
+</entity-engine-xml>

Propchange: ofbiz/trunk/specialpurpose/bi/data/DimensionTypeData.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/data/DimensionTypeData.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/data/DimensionTypeData.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/bi/entitydef/entitygroup.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/entitydef/entitygroup.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/entitydef/entitygroup.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/entitydef/entitygroup.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,45 @@
+<?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
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<entitygroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitygroup.xsd">
+
+    <!-- ========================================================= -->
+    <!-- org.ofbiz.bi.dimension                                    -->
+    <!-- ========================================================= -->
+
+    <entity-group group="org.ofbiz.olap" entity="CurrencyDimension" />
+    <entity-group group="org.ofbiz.olap" entity="DateDimension" />
+    <entity-group group="org.ofbiz.olap" entity="ProductDimension" />
+
+    <!-- ========================================================= -->
+    <!-- org.ofbiz.bi.fact                                         -->
+    <!-- ========================================================= -->
+
+    <entity-group group="org.ofbiz.olap" entity="SalesInvoiceItemFact" />
+
+    <!-- ========================================================= -->
+    <!-- org.ofbiz.bi.starschema                                   -->
+    <!-- ========================================================= -->
+
+    <entity-group group="org.ofbiz.olap" entity="SalesInvoiceItemStarSchema" />
+
+</entitygroup>
+

Propchange: ofbiz/trunk/specialpurpose/bi/entitydef/entitygroup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/entitydef/entitygroup.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/entitydef/entitygroup.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/bi/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/entitydef/entitymodel.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/entitydef/entitymodel.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/entitydef/entitymodel.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,252 @@
+<?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
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
+    <!-- ========================================================= -->
+    <!-- ======================== Defaults ======================= -->
+    <!-- ========================================================= -->
+    <title>Entity of an Open For Business Project Component</title>
+    <description>None</description>
+    <copyright>Copyright 2001-2007 The Apache Software Foundation</copyright>
+
+    <!-- ========================================================= -->
+    <!-- org.ofbiz.bi.dimension                                    -->
+    <!-- ========================================================= -->
+    
+    <entity entity-name="DateDimension" package-name="org.ofbiz.bi.dimension" title="Date Dimension">
+        <description>Date (days) dimension. The natural key is [dateValue]</description>
+        <field name="dimensionId" type="id-ne">
+            <description>Unique identifier of the Date dimension record</description>
+        </field>
+        <field name="dateValue" type="date">
+            <description>The date (day)</description>
+        </field>
+        <field name="description" type="description">
+            <description>Full date description</description>
+        </field>
+        <field name="dayName" type="short-varchar">
+            <description>The name of the day (Monday, Tuesday, etc...)</description>
+        </field>
+        <field name="dayOfMonth" type="numeric">
+            <description>The number of the day in the month</description>
+        </field>
+        <field name="dayOfYear" type="numeric">
+            <description>The number of the day in the year</description>
+        </field>
+        <field name="monthName" type="short-varchar">
+            <description>The name of the month (January, February, etc...)</description>
+        </field>
+        <field name="monthOfYear" type="numeric">
+            <description>The number of the month (1-12)</description>
+        </field>
+        <field name="yearName" type="numeric">
+            <description>The year (2008, 2009, etc...)</description>
+        </field>
+        <field name="weekOfMonth" type="numeric">
+            <description>The number of the week in the month</description>
+        </field>
+        <field name="weekOfYear" type="numeric">
+            <description>The number of the week in the year</description>
+        </field>
+        <field name="yearMonthDay" type="short-varchar">
+            <description>YYYY-MM-DD</description>
+        </field>
+        <field name="yearMonth" type="short-varchar">
+            <description>YYYY-MM</description>
+        </field>
+        <field name="weekdayType" type="short-varchar">
+            <description>Weekday indicator (Weekday or Weekend)</description>
+        </field>
+        <prim-key field="dimensionId"/>
+    </entity>
+
+    <entity entity-name="CurrencyDimension" package-name="org.ofbiz.bi.dimension" title="Currency Dimension">
+        <description>Currency dimension. The natural key is [currencyId]</description>
+        <field name="dimensionId" type="id-ne">
+            <description>Unique identifier of the Currency dimension record</description>
+        </field>
+        <field name="currencyId" type="id-ne">
+            <description>The currency id (natural key).</description>
+        </field>
+        <field name="description" type="description">
+            <description>Full currency description</description>
+        </field>
+        <prim-key field="dimensionId"/>
+    </entity>
+
+    <!-- ========================================================= -->
+    <!-- org.ofbiz.bi.dimension.product                            -->
+    <!-- ========================================================= -->
+    
+    <entity entity-name="ProductDimension" package-name="org.ofbiz.bi.dimension.product" title="Product Dimension">
+        <description>Product dimension. The natural key is [productId]</description>
+        <field name="dimensionId" type="id-ne">
+            <description>Unique identifier of the Product dimension record</description>
+        </field>
+        <field name="productId" type="id-ne">
+            <description>The natural key. From Product.productId</description>
+        </field>
+        <field name="productType" type="description">
+            <description>The product type. From ProductType.description</description>
+        </field>
+        <field name="brandName" type="name"></field>
+        <field name="internalName" type="description"></field>
+        <prim-key field="dimensionId"/>
+    </entity>
+
+    <!-- ========================================================= -->
+    <!-- org.ofbiz.bi.fact.accounting                              -->
+    <!-- ========================================================= -->
+    
+    <entity entity-name="SalesInvoiceItemFact" package-name="org.ofbiz.bi.fact.accounting" title="Sales Invoice Item Fact">
+        <description>A transaction fact entity with invoice item grain.</description>
+        <field name="invoiceId" type="id-ne"></field> <!-- degenerate dimension -->
+        <field name="invoiceItemSeqId" type="id-ne"></field> <!-- degenerate dimension -->
+        <field name="orderId" type="id-ne"></field> <!-- degenerate dimension -->
+        <field name="invoiceDateDimId" type="id-ne"></field>
+        <field name="productDimId" type="id-ne"></field>
+        <field name="billToCustomerDimId" type="id-ne"></field> <!-- TODO: implement the dimension -->
+        <field name="origCurrencyDimId" type="id-ne"></field>
+
+        <field name="quantity" type="floating-point">
+            <description>Quantity invoiced. From InvoiceItem.quantity</description>
+        </field>
+
+        <field name="extGrossAmount" type="currency-precise">
+            <description>Extended gross amount: quantity invoiced multiplied by the list unit price.</description>
+        </field>
+        <field name="extDiscountAmount" type="currency-precise">
+            <description>Extended discount amount.</description>
+        </field>
+        <field name="extNetAmount" type="currency-precise">
+            <description>Extended net amount: gross amount less discounts.</description>
+        </field>
+        <field name="extTaxAmount" type="currency-precise">
+            <description>Extended tax amount.</description>
+        </field>
+        <field name="extManFixedCost" type="currency-precise">
+            <description>Extended manufacturing fixed cost.</description>
+        </field>
+        <field name="extManVarCost" type="currency-precise">
+            <description>Extended manufacturing variable cost.</description>
+        </field>
+        <field name="extStorageCost" type="currency-precise">
+            <description>Extended storage cost.</description>
+        </field>
+        <field name="extDistributionCost" type="currency-precise">
+            <description>Extended distribution cost.</description>
+        </field>
+        <field name="contributionAmount" type="currency-precise">
+            <description>Extended net amount less all the costs.</description>
+        </field>
+        <!--
+        TODO: implement multy currency fields
+        <field name="extGrossAmountOrig" type="currency-precise">
+            <description>Extended gross amount in the original currency: quantity invoiced multiplied by the list unit price.</description>
+        </field>
+        <field name="extDiscountAmountOrig" type="currency-precise">
+            <description>Extended discount amount in the original currency.</description>
+        </field>
+        <field name="extNetAmountOrig" type="currency-precise">
+            <description>Extended net amount in the original currency: gross amount less discounts.</description>
+        </field>
+        <field name="extManFixedCostOrig" type="currency-precise">
+            <description>Extended manufacturing fixed cost in the original currency.</description>
+        </field>
+        <field name="extManVarCostOrig" type="currency-precise">
+            <description>Extended manufacturing variable cost in the original currency.</description>
+        </field>
+        <field name="extStorageCostOrig" type="currency-precise">
+            <description>Extended storage cost in the original currency.</description>
+        </field>
+        <field name="extDistributionCostOrig" type="currency-precise">
+            <description>Extended distribution cost in the original currency.</description>
+        </field>
+        <field name="contributionAmountOrig" type="currency-precise">
+            <description>Extended net amount less all the costs in the original currency.</description>
+        </field>
+        -->
+
+        <prim-key field="invoiceId"/>
+        <prim-key field="invoiceItemSeqId"/>
+        
+        <relation type="one" fk-name="SIIF_INVDATE" rel-entity-name="DateDimension">
+            <key-map field-name="invoiceDateDimId" rel-field-name="dimensionId"/>
+        </relation>
+        <relation type="one" fk-name="SIIF_CURRENCY" rel-entity-name="CurrencyDimension">
+            <key-map field-name="origCurrencyDimId" rel-field-name="dimensionId"/>
+        </relation>
+        <relation type="one" fk-name="SIIF_PRODUCT" rel-entity-name="ProductDimension">
+            <key-map field-name="productDimId" rel-field-name="dimensionId"/>
+        </relation>
+
+    </entity>
+
+    <!-- ========================================================= -->
+    <!-- org.ofbiz.bi.starschema.accounting                        -->
+    <!-- ========================================================= -->
+    
+    <view-entity entity-name="SalesInvoiceItemStarSchema" package-name="org.ofbiz.bi.starschema.accounting" title="Sales Invoice Item Star Schema">
+        <description>Invoice Item star schema (Profit and Loss Statement).</description>
+        
+        <member-entity entity-alias="SIIF" entity-name="SalesInvoiceItemFact"/>
+        <member-entity entity-alias="IDD" entity-name="DateDimension"/>
+        <member-entity entity-alias="PD" entity-name="ProductDimension"/>
+        <member-entity entity-alias="CD" entity-name="CurrencyDimension"/>
+
+        <alias-all entity-alias="IDD" prefix="invoiceDate" group-by="true">
+            <exclude field="dimensionId"/>
+        </alias-all>
+        <alias-all entity-alias="PD" prefix="product" group-by="true">
+            <exclude field="dimensionId"/>
+        </alias-all>
+        <alias-all entity-alias="CD" prefix="currency" group-by="true">
+            <exclude field="dimensionId"/>
+        </alias-all>
+        <alias-all entity-alias="SIIF" function="sum">
+            <exclude field="invoiceItemSeqId"/>
+            <exclude field="invoiceDateDimId"/>
+            <exclude field="productDimId"/>
+            <exclude field="billToCustomerDimId"/>
+            <exclude field="origCurrencyDimId"/>
+            <exclude field="orderId"/>
+            <exclude field="invoiceId"/>
+            <exclude field="invoiceItemSeqId"/>
+        </alias-all>
+        <alias entity-alias="SIIF" name="invoiceId" group-by="true">
+            <description>Invoice id</description>
+        </alias>
+        <alias entity-alias="SIIF" name="invoiceItemSeqId" group-by="true"/>
+        <alias entity-alias="SIIF" name="orderId" group-by="true"/>
+
+        <view-link entity-alias="SIIF" rel-entity-alias="IDD">
+            <key-map field-name="invoiceDateDimId" rel-field-name="dimensionId"/>
+        </view-link>
+        <view-link entity-alias="SIIF" rel-entity-alias="PD">
+            <key-map field-name="productDimId" rel-field-name="dimensionId"/>
+        </view-link>
+        <view-link entity-alias="SIIF" rel-entity-alias="CD">
+            <key-map field-name="origCurrencyDimId" rel-field-name="dimensionId"/>
+        </view-link>
+
+    </view-entity>
+    
+</entitymodel>

Propchange: ofbiz/trunk/specialpurpose/bi/entitydef/entitymodel.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/entitydef/entitymodel.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/entitydef/entitymodel.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/bi/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/ofbiz-component.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/ofbiz-component.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/ofbiz-component.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,44 @@
+<?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
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<ofbiz-component name="bi"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
+    <resource-loader name="main" type="component"/>
+    <classpath type="dir" location="script"/>
+    <classpath type="dir" location="config"/>
+    <classpath type="jar" location="build/lib/*"/>
+
+    <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
+    <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/>
+
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/DimensionTypeData.xml"/>
+    
+    <service-resource type="model" loader="main" location="servicedef/services.xml"/>
+    <service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
+
+    <webapp name="bi"
+        title="Business Intelligence"
+        server="default-server"
+        location="webapp/bi"
+        base-permission="OFBTOOLS"
+        mount-point="/bi"
+        app-bar-display="true"/>
+</ofbiz-component>

Propchange: ofbiz/trunk/specialpurpose/bi/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/DimensionServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/DimensionServices.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/DimensionServices.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/DimensionServices.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,112 @@
+<?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
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
+
+    <simple-method method-name="loadCurrencyDimension" short-description="">
+        <entity-and entity-name="Uom" list-name="currencies">
+            <field-map field-name="uomTypeId" value="CURRENCY_MEASURE"/>
+        </entity-and>
+        <iterate list-name="currencies" entry-name="currency">
+            <entity-and entity-name="CurrencyDimension" list-name="currencyDims">
+                <field-map field-name="currencyId" env-name="currency.uomId"/>
+            </entity-and>
+            <if-not-empty field-name="currencyDims">
+                <iterate list-name="currencyDims" entry-name="currencyDim">
+                    <set field="currencyDim.description" from-field="currency.description"/>
+                    <store-value value-name="currencyDim"/>
+                </iterate>
+            <else>
+                <make-value value-name="currencyDim" entity-name="CurrencyDimension"/>
+                <sequenced-id-to-env sequence-name="CurrencyDimension" env-name="currencyDim.dimensionId"/>
+                <set field="currencyDim.currencyId" from-field="currency.uomId"/>
+                <set field="currencyDim.description" from-field="currency.description"/>
+                <create-value value-name="currencyDim"/>
+            </else>
+            </if-not-empty>
+        </iterate>
+    </simple-method>
+
+    <simple-method method-name="prepareProductDimensionData" short-description="">
+        <entity-one entity-name="Product" value-name="product"/>
+        <if-empty field-name="product">
+            <add-error><fail-message message="Product with id [${productId}] doesn't exist."/></add-error>
+        </if-empty>
+        <check-errors/>
+        <make-value value-name="productDimension" entity-name="ProductDimension"/>
+        <set-nonpk-fields map-name="product" value-name="productDimension"/>
+
+        <get-related-one value-name="product" relation-name="ProductType" to-value-name="productType"/>
+        <set field="productDimension.productType" from-field="productType.description"/>
+
+        <field-to-result field-name="productDimension"/>
+    </simple-method>
+
+    <simple-method method-name="loadProductInProductDimension" short-description="">
+        <set-service-fields service-name="prepareProductDimensionData" map-name="parameters" to-map-name="inMap"/>
+        <call-service service-name="prepareProductDimensionData" in-map-name="inMap">
+            <result-to-field result-name="productDimension"/>
+        </call-service>
+        <clear-field field-name="inMap"/>
+        <set-service-fields service-name="storeGenericDimension" map-name="parameters" to-map-name="inMap"/>
+        <set field="inMap.naturalKeyFields[]" value="productId"/>
+        <set field="inMap.dimensionValue" from-field="productDimension"/>
+        <call-service service-name="storeGenericDimension" in-map-name="inMap"/>
+    </simple-method>
+    <simple-method method-name="loadAllProductsInProductDimension" short-description="">
+        <entity-condition entity-name="Product" list-name="products"/>
+        <iterate list-name="products" entry-name="product">
+            <set-service-fields service-name="loadProductInProductDimension" map-name="parameters" to-map-name="inMap"/>
+            <set field="inMap.productId" from-field="product.productId"/>
+            <call-service service-name="loadProductInProductDimension" in-map-name="inMap"/>
+            <clear-field field-name="inMap"/>
+        </iterate>
+    </simple-method>
+    <simple-method method-name="quickInitDataWarehouse" short-description="">
+        <set-service-fields service-name="loadDateDimension" map-name="parameters" to-map-name="inMap"/>
+        <call-service service-name="loadDateDimension" in-map-name="inMap"/>
+        <check-errors/>
+
+        <clear-field field-name="inMap"/>
+        <call-service service-name="loadCurrencyDimension" in-map-name="inMap"/>
+        <check-errors/>
+
+        <!-- loads all products in the ProductDimension -->
+        <clear-field field-name="inMap"/>
+        <call-service service-name="loadAllProductsInProductDimension" in-map-name="inMap"/>
+        <check-errors/>
+        
+        <!-- loads the invoice items in the SalesInvoiceItemFact fact entity -->
+        <entity-condition entity-name="Invoice" list-name="invoices">
+            <condition-list>
+                <condition-expr field-name="invoiceTypeId" value="SALES_INVOICE"/>
+                <condition-expr field-name="invoiceDate" operator="greater-equals" env-name="parameters.fromDate"/>
+                <condition-expr field-name="invoiceDate" operator="less-equals" env-name="parameters.thruDate"/>
+            </condition-list>
+        </entity-condition>
+        <iterate list-name="invoices" entry-name="invoice">
+            <clear-field field-name="inMap"/>
+            <set field="inMap.invoiceId" from-field="invoice.invoiceId"/>
+            <call-service service-name="loadSalesInvoiceFact" in-map-name="inMap"/>
+            <check-errors/>
+        </iterate>
+    </simple-method>
+</simple-methods>

Propchange: ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/DimensionServices.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/DimensionServices.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/DimensionServices.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/FactServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/FactServices.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/FactServices.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/FactServices.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,178 @@
+<?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
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
+
+    <simple-method method-name="loadSalesInvoiceFact" short-description="">
+        <entity-one entity-name="Invoice" value-name="invoice"/>
+        <if-empty field-name="invoice">
+            <add-error><fail-message message="Invoice with id [${parameters.invoiceId}] doesn't exist."/></add-error>
+        </if-empty>
+        <check-errors/>
+        <if-compare field-name="invoice.invoiceTypeId" operator="equals" value="SALES_INVOICE">
+            <set field="andConditions.invoiceItemTypeId" value="INV_FPROD_ITEM"/>
+            <get-related relation-name="InvoiceItem" value-name="invoice" list-name="invoiceItems" map-name="andConditions"/>
+            <iterate list-name="invoiceItems" entry-name="invoiceItem">
+                <clear-field field-name="inMap"/>
+                <set field="inMap.invoice" from-field="invoice"/>
+                <set field="inMap.invoiceItem" from-field="invoiceItem"/>
+                <call-service service-name="loadSalesInvoiceItemFact" in-map-name="inMap"/>
+            </iterate>
+        </if-compare>
+    </simple-method>
+    <simple-method method-name="loadSalesInvoiceItemFact" short-description="">
+        <set field="invoice" from-field="parameters.invoice"/>
+        <set field="invoiceItem" from-field="parameters.invoiceItem"/>
+        <if-empty field-name="invoice">
+            <entity-one entity-name="Invoice" value-name="invoice"/>
+        </if-empty>
+        <if-empty field-name="invoiceItem">
+            <entity-one entity-name="InvoiceItem" value-name="invoiceItem"/>
+        </if-empty>
+        <if-empty field-name="invoice">
+            <add-error><fail-message message="Invoice with id [${parameters.invoiceId}] doesn't exist."/></add-error>
+        </if-empty>
+        <if-empty field-name="invoiceItem">
+            <add-error><fail-message message="The Invoice Item with id [${parameters.invoiceItemSeqId}] doesn't exist."/></add-error>
+        </if-empty>
+        <check-errors/>
+
+        <if-compare field-name="invoice.invoiceTypeId" operator="equals" value="SALES_INVOICE">
+            <entity-one entity-name="SalesInvoiceItemFact" value-name="fact" auto-fields-map="false">
+                <field-map field-name="invoiceId" env-name="invoiceItem.invoiceId"/>
+                <field-map field-name="invoiceItemSeqId" env-name="invoiceItem.invoiceItemSeqId"/>
+            </entity-one>
+            <!-- key handling -->
+            <if-empty field-name="fact">
+                <make-value entity-name="SalesInvoiceItemFact" value-name="fact"/>
+                <set field="fact.invoiceId" from-field="invoice.invoiceId"/>
+                <set field="fact.invoiceItemSeqId" from-field="invoiceItem.invoiceItemSeqId"/>
+                <!-- conversion of the invoice date -->
+                <if-not-empty field-name="invoice.invoiceDate">
+                    <clear-field field-name="inMap"/>
+                    <set field="inMap.dimensionEntityName" value="DateDimension"/>
+                    <set field="inMap.naturalKeyFields.dateValue" from-field="invoice.invoiceDate"/>
+                    <call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
+                        <result-to-field result-name="dimensionId" field-name="fact.invoiceDateDimId"/>
+                    </call-service>
+                    <if-empty field-name="fact.invoiceDateDimId">
+                        <set field="fact.invoiceDateDimId" value="_NF_"/>
+                    </if-empty>
+                <else>
+                    <set field="fact.invoiceDateDimId" value="_NA_"/>
+                </else>
+                </if-not-empty>
+                <!-- conversion of the product id -->
+                <if-not-empty field-name="invoiceItem.productId">
+                    <clear-field field-name="inMap"/>
+                    <set field="inMap.dimensionEntityName" value="ProductDimension"/>
+                    <set field="inMap.naturalKeyFields.productId" from-field="invoiceItem.productId"/>
+                    <call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
+                        <result-to-field result-name="dimensionId" field-name="fact.productDimId"/>
+                    </call-service>
+                    <if-empty field-name="fact.productDimId">
+                        <set field="fact.productDimId" value="_NF_"/>
+                    </if-empty>
+                <else>
+                    <set field="fact.productDimId" value="_NA_"/>
+                </else>
+                </if-not-empty>
+                <!-- conversion of the invoice currency -->
+                <if-not-empty field-name="invoice.currencyUomId">
+                    <clear-field field-name="inMap"/>
+                    <set field="inMap.dimensionEntityName" value="CurrencyDimension"/>
+                    <set field="inMap.naturalKeyFields.currencyId" from-field="invoice.currencyUomId"/>
+                    <call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
+                        <result-to-field result-name="dimensionId" field-name="fact.origCurrencyDimId"/>
+                    </call-service>
+                    <if-empty field-name="fact.origCurrencyDimId">
+                        <set field="fact.origCurrencyDimId" value="_NF_"/>
+                    </if-empty>
+                <else>
+                    <set field="fact.origCurrencyDimId" value="_NA_"/>
+                </else>
+                </if-not-empty>
+                <!-- TODO -->
+                <set field="fact.orderId" value="_NA_"/>
+                <set field="fact.billToCustomerDimId" value="_NA_"/>
+                <create-value value-name="fact"/>
+            </if-empty>
+            <!-- =============== -->
+            <!-- facts handling  -->
+            <!-- =============== -->
+            <set field="fact.quantity" from-field="invoiceItem.quantity" type="BigDecimal"/>
+            <set field="fact.extGrossAmount" value="0.0" type="BigDecimal"/>
+            <set field="fact.extDiscountAmount" value="0.0" type="BigDecimal"/>
+            <set field="fact.extTaxAmount" value="0.0" type="BigDecimal"/>
+            <set field="fact.extNetAmount" value="0.0" type="BigDecimal"/>
+            <calculate field-name="fact.extGrossAmount" type="BigDecimal">
+                <calcop field-name="invoiceItem.quantity" operator="multiply">
+                    <calcop field-name="invoiceItem.amount" operator="get"/>
+                </calcop>
+            </calculate>
+            <!-- taxes -->
+            <clear-field field-name="andConditions"/>
+            <set field="andConditions.invoiceItemTypeId" value="ITM_SALES_TAX"/>
+            <get-related relation-name="ChildrenInvoiceItem" value-name="invoiceItem" list-name="taxes" map-name="andConditions"/>
+            <iterate list-name="taxes" entry-name="tax">
+                <calculate field-name="fact.extTaxAmount" type="BigDecimal">
+                    <calcop field-name="fact.extTaxAmount" operator="add">
+                        <calcop field-name="tax.amount" operator="get"/>
+                    </calcop>
+                </calculate>
+            </iterate>
+            <!-- discounts -->
+            <clear-field field-name="andConditions"/>
+            <set field="andConditions.invoiceItemTypeId" value="ITM_PROMOTION_ADJ"/>
+            <get-related relation-name="ChildrenInvoiceItem" value-name="invoiceItem" list-name="discounts" map-name="andConditions"/>
+            <iterate list-name="discounts" entry-name="discount">
+                <calculate field-name="fact.extDiscountAmount" type="BigDecimal">
+                    <calcop field-name="fact.extDiscountAmount" operator="add">
+                        <calcop field-name="discount.amount" operator="negative"/>
+                    </calcop>
+                </calculate>
+            </iterate>
+            
+            <calculate field-name="fact.extNetAmount" type="BigDecimal">
+                <calcop field-name="fact.extGrossAmount" operator="subtract">
+                    <calcop field-name="fact.extDiscountAmount" operator="get"/>
+                </calcop>
+            </calculate>
+            <!-- TODO: prorate invoice header discounts and shipping charges -->
+            <!-- TODO: costs -->
+            <set field="fact.extManFixedCost" value="0.0" type="BigDecimal"/>
+            <set field="fact.extManVarCost" value="0.0" type="BigDecimal"/>
+            <set field="fact.extStorageCost" value="0.0" type="BigDecimal"/>
+            <set field="fact.extDistributionCost" value="0.0" type="BigDecimal"/>
+
+            <calculate field-name="fact.contributionAmount" type="BigDecimal">
+                <calcop field-name="fact.extNetAmount" operator="subtract">
+                    <calcop field-name="fact.extManFixedCost" operator="get"/>
+                    <calcop field-name="fact.extManVarCost" operator="get"/>
+                    <calcop field-name="fact.extStorageCost" operator="get"/>
+                    <calcop field-name="fact.extDistributionCost" operator="get"/>
+                </calcop>
+            </calculate>
+
+            <store-value value-name="fact"/>
+        </if-compare>
+    </simple-method>
+</simple-methods>

Propchange: ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/FactServices.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/FactServices.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/FactServices.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/bi/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/servicedef/secas.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/servicedef/secas.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/servicedef/secas.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,40 @@
+<?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
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
+
+    <!-- dimension entities -->
+    <eca service="createProduct" event="commit">
+        <action service="loadType1ProductInProductDimension" mode="sync"/>
+    </eca>
+    <eca service="updateProduct" event="commit">
+        <action service="loadType2ProductInProductDimension" mode="sync"/>
+    </eca>
+
+    <!-- fact entities -->
+    <!-- Load data into the SalesInvoiceItemFact olap entity when a sales invoice is set to ready -->
+    <eca service="setInvoiceStatus" event="commit">
+        <condition field-name="statusId" operator="equals" value="INVOICE_READY"/>
+        <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
+        <action service="loadSalesInvoiceFact" mode="sync" run-as-user="system"/>
+    </eca>
+
+</service-eca>

Propchange: ofbiz/trunk/specialpurpose/bi/servicedef/secas.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/servicedef/secas.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/servicedef/secas.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/bi/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/servicedef/services.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/servicedef/services.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/servicedef/services.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,108 @@
+<?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
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
+
+    <service name="storeGenericDimension" engine="java"
+        location="org.ofbiz.bi.util.DimensionServices" invoke="storeGenericDimension" auth="true">
+        <description>Generic service to load data into a dimension entity (olap entity).</description>
+        <attribute name="dimensionValue" type="GenericEntity" mode="IN" optional="false"/>
+        <attribute name="naturalKeyFields" type="List" mode="IN" optional="false"/> <!-- the names of the fields that compose the natural key of the dimension -->
+        <attribute name="updateMode" type="String" mode="IN" optional="false"/> <!-- TYPE1, TYPE2, TYPE3 -->
+    </service>
+
+    <service name="getDimensionIdFromNaturalKey" engine="java"
+        location="org.ofbiz.bi.util.DimensionServices" invoke="getDimensionIdFromNaturalKey" auth="true">
+        <description>Generic service to get the dimensionId for a natural key.</description>
+        <attribute name="dimensionEntityName" type="String" mode="IN" optional="false"/>
+        <attribute name="naturalKeyFields" type="Map" mode="IN" optional="false"/> <!-- the names/values pairs of the fields that compose the natural key of the dimension -->
+        <attribute name="dimensionId" type="String" mode="OUT" optional="true"/>
+    </service>
+
+    <!-- Common Dimension -->
+    <service name="loadDateDimension" engine="java" transaction-timeout="300"
+        location="org.ofbiz.bi.util.DimensionServices" invoke="loadDateDimension" auth="true">
+        <description>Loads data in the DateDimension entity (olap entity) using the update strategy of 'type 1': overwrite the values of the attributes</description>
+        <attribute name="fromDate" type="Date" mode="IN" optional="false"/>
+        <attribute name="thruDate" type="Date" mode="IN" optional="false"/>
+    </service>
+    <service name="loadCurrencyDimension" auth="true" engine="simple"
+        location="org/ofbiz/bi/DimensionServices.xml" invoke="loadCurrencyDimension">
+        <description>Loads data in the CurrencyDimension entity (olap entity) using the update strategy of 'type 1': overwrite the values of the attributes</description>
+    </service>
+
+    <!-- ProductDimension -->
+    <service name="prepareProductDimensionData" auth="true" engine="simple"
+        location="org/ofbiz/bi/DimensionServices.xml" invoke="prepareProductDimensionData">
+        <description>Pulls information from the Product* entities (oltp entities) and prepares data for the ProductDimension entity (olap entity)</description>
+        <attribute name="productId" type="String" mode="IN" optional="false"/>
+        <attribute name="productDimension" type="GenericEntity" mode="OUT" optional="false"/>
+    </service>
+    <service name="loadProductInProductDimension" auth="true" engine="simple"
+        location="org/ofbiz/bi/DimensionServices.xml" invoke="loadProductInProductDimension">
+        <description>Pulls information from the Product* entities and stores them in the ProductDimension entity (olap entity)</description>
+        <attribute name="productId" type="String" mode="IN" optional="false"/>
+        <attribute name="updateMode" type="String" mode="IN" optional="false"/> <!-- TYPE1, TYPE2, TYPE3 -->
+    </service>
+    <service name="loadType1ProductInProductDimension" auth="true" engine="simple"
+        location="org/ofbiz/bi/DimensionServices.xml" invoke="loadProductInProductDimension">
+        <description>Same as loadProductInProductDimension; the update strategy is 'type 1': overwrite the values of the attributes</description>
+        <attribute name="productId" type="String" mode="IN" optional="false"/>
+        <attribute name="updateMode" type="String" mode="IN" optional="true" default-value="TYPE1"/>
+    </service>
+    <service name="loadType2ProductInProductDimension" auth="true" engine="simple"
+        location="org/ofbiz/bi/DimensionServices.xml" invoke="loadProductInProductDimension">
+        <description>Same as loadProductInProductDimension; the update strategy is 'type 2': add a dimension row</description>
+        <attribute name="productId" type="String" mode="IN" optional="false"/>
+        <attribute name="updateMode" type="String" mode="IN" optional="true" default-value="TYPE2"/>
+    </service>
+    <service name="loadAllProductsInProductDimension" auth="true" engine="simple"
+        location="org/ofbiz/bi/DimensionServices.xml" invoke="loadAllProductsInProductDimension">
+        <description>Calls the loadProductInProductDimension service for all the products.</description>
+        <attribute name="updateMode" type="String" mode="IN" optional="true" default-value="TYPE1"/> <!-- TYPE1, TYPE2, TYPE3 -->
+    </service>
+
+    <!-- Accounting Facts -->
+    <service name="loadSalesInvoiceItemFact" auth="true" engine="simple"
+        location="org/ofbiz/bi/FactServices.xml" invoke="loadSalesInvoiceItemFact">
+        <description>
+            Pulls information from the Invoice* entities and stores them in the SalesInvoiceItem entity (olap entity).
+            One of invoiceId/invoiceItemSeqId or invoice/invoiceItem must be passed or an error is returned.
+        </description>
+        <attribute name="invoiceId" type="String" mode="IN" optional="true"/>
+        <attribute name="invoiceItemSeqId" type="String" mode="IN" optional="true"/>
+        <attribute name="invoice" type="GenericValue" mode="IN" optional="true"/>
+        <attribute name="invoiceItem" type="GenericValue" mode="IN" optional="true"/>
+    </service>
+    <service name="loadSalesInvoiceFact" auth="true" engine="simple"
+        location="org/ofbiz/bi/FactServices.xml" invoke="loadSalesInvoiceFact">
+        <description>Calls the loadSalesInvoiceItemFact service for all the invoice items.</description>
+        <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
+    </service>
+
+    <service name="quickInitDataWarehouse" auth="true" engine="simple"
+        location="org/ofbiz/bi/DimensionServices.xml" invoke="quickInitDataWarehouse">
+        <description>Quickly initialize the dimensions (Currency, Date, Product) and facts (SalesInvoiceItem): useful to quickly initialize the datawarehouse.</description>
+        <attribute name="fromDate" type="Date" mode="IN" optional="false"/>
+        <attribute name="thruDate" type="Date" mode="IN" optional="false"/>
+    </service>
+
+</services>

Propchange: ofbiz/trunk/specialpurpose/bi/servicedef/services.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/servicedef/services.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/servicedef/services.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/util/DimensionServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/util/DimensionServices.java?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/util/DimensionServices.java (added)
+++ ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/util/DimensionServices.java Mon Oct 15 03:55:07 2007
@@ -0,0 +1,191 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package org.ofbiz.bi.util;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.util.EntityUtil;
+
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceUtil;
+
+public class DimensionServices {
+    
+    public static final String module = DimensionServices.class.getName();
+
+    public static Map getDimensionIdFromNaturalKey(DispatchContext ctx, Map context) {
+        Map resultMap = ServiceUtil.returnSuccess();
+        GenericDelegator delegator = ctx.getDelegator();
+        LocalDispatcher dispatcher = ctx.getDispatcher();
+
+        String dimensionEntityName = (String) context.get("dimensionEntityName");
+        Map naturalKeyFields = (Map) context.get("naturalKeyFields");
+        GenericValue lastDimensionValue = null;
+        try {
+            // TODO: improve performance
+            lastDimensionValue = EntityUtil.getFirst(delegator.findByAnd(dimensionEntityName, naturalKeyFields, UtilMisc.toList("-createdTxStamp")));
+        } catch(GenericEntityException gee) {
+            return ServiceUtil.returnError(gee.getMessage());
+        }
+        if (UtilValidate.isNotEmpty(lastDimensionValue)) {
+            resultMap.put("dimensionId", lastDimensionValue.getString("dimensionId"));
+        }
+        return resultMap;
+    }
+
+    public static Map storeGenericDimension(DispatchContext ctx, Map context) {
+        GenericDelegator delegator = ctx.getDelegator();
+        LocalDispatcher dispatcher = ctx.getDispatcher();
+
+        GenericValue dimensionValue = (GenericValue) context.get("dimensionValue");
+        List naturalKeyFields = (List) context.get("naturalKeyFields");
+        String updateMode = (String) context.get("updateMode");
+
+        try {
+            Map andCondition = FastMap.newInstance();
+            for (int i = 0; i < naturalKeyFields.size(); i++) {
+                String naturalKeyField = (String)naturalKeyFields.get(i);
+                andCondition.put(naturalKeyField, dimensionValue.get(naturalKeyField));
+            }
+            if (andCondition.isEmpty()) {
+                return ServiceUtil.returnError("The natural key: " + naturalKeyFields + " is empty in value: " + dimensionValue);
+            }
+            List existingDimensionValues = null;
+            try {
+                existingDimensionValues = delegator.findByAnd(dimensionValue.getEntityName(), andCondition);
+            } catch(GenericEntityException gee) {
+                return ServiceUtil.returnError(gee.getMessage());
+            }
+            if (UtilValidate.isEmpty(existingDimensionValues)) {
+                dimensionValue.set("dimensionId", delegator.getNextSeqId(dimensionValue.getEntityName()));
+                dimensionValue.create();
+            } else {
+                if ("TYPE1".equals(updateMode)) {
+                    // update all the rows with the new values
+                    for (int i = 0; i < existingDimensionValues.size(); i++) {
+                        GenericValue existingDimensionValue = (GenericValue)existingDimensionValues.get(i);
+                        GenericValue updatedValue = delegator.makeValue(dimensionValue.getEntityName(), dimensionValue);
+                        updatedValue.set("dimensionId", existingDimensionValue.getString("dimensionId"));
+                        updatedValue.store();
+                    }
+                } else if ("TYPE2".equals(updateMode)) {
+                    // TODO: create a new record and update somewhere the from/thru dates of the old row
+                    dimensionValue.set("dimensionId", delegator.getNextSeqId(dimensionValue.getEntityName()));
+                    dimensionValue.create();
+                } else {
+                    return ServiceUtil.returnError("The update mode: " + updateMode + " is still not supported.");
+                }
+            }
+        } catch(GenericEntityException gee) {
+            return ServiceUtil.returnError(gee.getMessage());
+        }
+        return ServiceUtil.returnSuccess();
+    }
+
+    /*
+     * Service used to initialize the Date dimension (DateDimension).
+     * The DateDimension entity is a nearly constant dimension ("Slowly Changing Dimension" or SCD):
+     * the default strategy to handle data change is "Type 1" (i.e. overwrite the values).
+     */
+    public static Map loadDateDimension(DispatchContext ctx, Map context) {
+        GenericDelegator delegator = ctx.getDelegator();
+        LocalDispatcher dispatcher = ctx.getDispatcher();
+
+        Date fromDate = (Date) context.get("fromDate");
+        Date thruDate = (Date) context.get("thruDate");
+
+        SimpleDateFormat monthNameFormat = new SimpleDateFormat("MMMM");
+        SimpleDateFormat dayNameFormat = new SimpleDateFormat("EEEE");
+        SimpleDateFormat dayDescriptionFormat = new SimpleDateFormat("MMMM d, yyyy");
+        SimpleDateFormat yearMonthDayFormat = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat yearMonthFormat = new SimpleDateFormat("yyyy-MM");
+
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(fromDate);
+        calendar.set(Calendar.HOUR, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        Date currentDate = calendar.getTime();
+        while (currentDate.compareTo(thruDate) <= 0) {
+            GenericValue dateValue = null;
+            try {
+                dateValue = EntityUtil.getFirst(delegator.findByAnd("DateDimension", UtilMisc.toMap("dateValue", currentDate)));
+            } catch(GenericEntityException gee) {
+                return ServiceUtil.returnError(gee.getMessage());
+            }
+            boolean newValue = (dateValue == null);
+            if (newValue) {
+                dateValue = delegator.makeValue("DateDimension", null);
+                dateValue.set("dimensionId", delegator.getNextSeqId("DateDimension"));
+                dateValue.set("dateValue", currentDate);
+            }
+            dateValue.set("description", dayDescriptionFormat.format(currentDate));
+            int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
+            dateValue.set("dayName", dayNameFormat.format(currentDate));
+            dateValue.set("dayOfMonth", new Integer(calendar.get(Calendar.DAY_OF_MONTH)));
+            dateValue.set("dayOfYear", new Integer(calendar.get(Calendar.DAY_OF_YEAR)));
+            dateValue.set("monthName", monthNameFormat.format(currentDate));
+            
+            dateValue.set("monthOfYear", new Integer(calendar.get(Calendar.MONTH) + 1));
+            dateValue.set("yearName", new Integer(calendar.get(Calendar.YEAR)));
+            dateValue.set("weekOfMonth", new Integer(calendar.get(Calendar.WEEK_OF_MONTH)));
+            dateValue.set("weekOfYear", new Integer(calendar.get(Calendar.WEEK_OF_YEAR)));
+            dateValue.set("weekdayType", (dayOfWeek == 1 || dayOfWeek == 7? "Weekend": "Weekday"));
+            dateValue.set("yearMonthDay", yearMonthDayFormat.format(currentDate));
+            dateValue.set("yearMonth", yearMonthFormat.format(currentDate));
+            
+            try {
+                if (newValue) {
+                    dateValue.create();
+                } else {
+                    dateValue.store();
+                }
+            } catch(GenericEntityException gee) {
+                return ServiceUtil.returnError(gee.getMessage());
+            }
+            calendar.add(Calendar.DATE, 1);
+            currentDate = calendar.getTime();
+        }
+        return ServiceUtil.returnSuccess();
+    }
+
+}

Propchange: ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/util/DimensionServices.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/util/DimensionServices.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/src/org/ofbiz/bi/util/DimensionServices.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh (added)
+++ ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh Mon Oct 15 03:55:07 2007
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.TreeSet;
+
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.model.ModelReader;
+import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.model.ModelField;
+import org.ofbiz.entity.model.ModelViewEntity;
+import org.ofbiz.entity.model.ModelViewEntity.ModelAlias;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+String starSchemaName = parameters.get("starSchemaName");
+
+List starSchemaFields = FastList.newInstance();
+if (UtilValidate.isNotEmpty(starSchemaName)) {
+    ModelReader reader = delegator.getModelReader();
+    ModelEntity starSchema = reader.getModelEntity(starSchemaName);
+    if (UtilValidate.isNotEmpty(starSchema)) {
+        Iterator fieldsIt = starSchema.getAliasesIterator();
+        while (fieldsIt != null && fieldsIt.hasNext()) {
+            ModelAlias field = (ModelAlias)fieldsIt.next();
+            Map fieldMap = FastMap.newInstance();
+            fieldMap.put("name", field.getName());
+            String description = field.getDescription();
+            if (UtilValidate.isEmpty(description)) {
+                ModelEntity aliasedEntity = starSchema.getAliasedEntity(field.getEntityAlias(), reader);
+                if (aliasedEntity != null) {
+                    ModelField aliasedField = starSchema.getAliasedField(aliasedEntity, field.getField(), reader);
+                    description = aliasedField.getDescription();
+                }
+            }
+            fieldMap.put("description", description);
+            starSchemaFields.add(fieldMap);
+        }
+    }
+}
+context.put("starSchemaName", starSchemaName);
+context.put("starSchemaFields", starSchemaFields);

Propchange: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh (added)
+++ ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh Mon Oct 15 03:55:07 2007
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.TreeSet;
+
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.model.ModelReader;
+import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.model.ModelViewEntity;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+ModelReader reader = delegator.getModelReader();
+Collection ec = reader.getEntityNames();
+TreeSet entities = new TreeSet(ec);
+Iterator entitiesIt = entities.iterator();
+
+List starSchemas = FastList.newInstance();
+
+while (entitiesIt != null && entitiesIt.hasNext()) {
+    ModelEntity entity = reader.getModelEntity((String)entitiesIt.next());
+    String packageName = entity.getPackageName();
+    if (!packageName.contains("starschema")) {
+        continue;
+    }
+
+    Map entityMap = FastMap.newInstance();
+    entityMap.put("name", entity.getEntityName());
+    entityMap.put("title", entity.getTitle());
+
+    starSchemas.add(entityMap);
+}
+context.put("starSchemas", starSchemas);

Propchange: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh (added)
+++ ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh Mon Oct 15 03:55:07 2007
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.*;
+
+import org.ofbiz.base.util.*;
+import org.ofbiz.entity.*;
+import org.ofbiz.entity.condition.*;
+import org.ofbiz.entity.util.*;
+import org.ofbiz.entity.model.ModelReader;
+import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.model.ModelField;
+import org.ofbiz.entity.model.ModelViewEntity;
+import org.ofbiz.entity.model.ModelViewEntity.ModelAlias;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+String starSchemaName = parameters.get("starSchemaName");
+String[] selectedFields = request.getParameterValues("selectedField");
+context.put("columnNames", selectedFields);
+
+List conditionList = null;
+EntityConditionList condition =  null;
+List selectFields = null;
+List orderByFields = null;
+EntityFindOptions findOptions = null;
+
+List selectFields = FastList.newInstance();
+List records = FastList.newInstance();
+
+//conditionList.add(...);
+//condition =  new EntityConditionList(conditionList, EntityOperator.AND);
+
+for (int i = 0; i < selectedFields.length; i++) {
+    selectFields.add(selectedFields[i]);
+}
+
+orderByFields = null;
+
+findOptions = new EntityFindOptions();
+findOptions.setDistinct(false);
+
+records = delegator.findByCondition(starSchemaName, condition, null, selectFields, orderByFields, findOptions);
+
+context.put("records", records);

Propchange: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/controller.xml?rev=584727&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/controller.xml (added)
+++ ofbiz/trunk/specialpurpose/bi/webapp/bi/WEB-INF/controller.xml Mon Oct 15 03:55:07 2007
@@ -0,0 +1,91 @@
+<?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
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd">
+
+    <include location="component://common/webcommon/WEB-INF/common-controller.xml"/>
+    <description>Business Intelligence Component Site Configuration File</description>
+
+    <!-- Security Mappings -->
+    <request-map uri="login">
+        <security https="true" auth="false"/>
+        <event type="java" path="org.ofbiz.webapp.control.LoginWorker" invoke="login"/>
+        <response name="success" type="view" value="main"/>
+        <response name="requirePasswordChange" type="view" value="requirePasswordChange"/>
+        <response name="error" type="view" value="login"/>
+    </request-map>
+    <!-- End of Security Mappings -->
+
+    <!-- Request Mappings -->
+    <request-map uri="view">
+        <security https="false" auth="false"/>
+        <response name="success" type="view" value="main"/>
+        <response name="error" type="view" value="error"/>
+    </request-map>
+    
+    <request-map uri="authview">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="main"/>
+        <response name="error" type="view" value="error"/>
+    </request-map>
+    
+    <request-map uri="changeDelegator">
+        <event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
+        <response name="success" type="view" value="main"/>
+        <response name="error" type="view" value="error"/>
+    </request-map>
+
+    <request-map uri="main">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="main"/>
+    </request-map>
+    <request-map uri="quickInitDataWarehouse">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="quickInitDataWarehouse"/>
+        <response name="success" type="view" value="main"/>
+    </request-map>
+
+    <request-map uri="ReportBuilderSelectStarSchema">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="ReportBuilderSelectStarSchema"/>
+    </request-map>
+    <request-map uri="ReportBuilderSelectStarSchemaFields">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="ReportBuilderSelectStarSchemaFields"/>
+    </request-map>
+    <request-map uri="ReportBuilderRenderStarSchemaReport">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="ReportBuilderRenderStarSchemaReport"/>
+    </request-map>
+
+    <!-- end of request mappings -->
+
+    <!-- View Mappings -->
+    <view-map name="main" type="screen" page="component://bi/widget/BiScreens.xml#main"/>
+    <view-map name="login" type="screen" page="component://bi/widget/BiScreens.xml#login"/>
+    <view-map name="requirePasswordChange" type="screen" page="component://bi/widget/BiScreens.xml#requirePasswordChange"/>
+
+    <view-map name="ReportBuilderSelectStarSchema" type="screen" page="component://bi/widget/BiScreens.xml#ReportBuilderSelectStarSchema"/>
+    <view-map name="ReportBuilderSelectStarSchemaFields" type="screen" page="component://bi/widget/BiScreens.xml#ReportBuilderSelectStarSchemaFields"/>
+    <view-map name="ReportBuilderRenderStarSchemaReport" type="screen" page="component://bi/widget/BiScreens.xml#ReportBuilderRenderStarSchemaReport"/>
+
+    <!-- end of view mappings -->
+</site-conf>