Author: jacopoc
Date: Thu Jul 17 07:12:38 2008 New Revision: 677587 URL: http://svn.apache.org/viewvc?rev=677587&view=rev Log: Moved the bi component from specialpurpose to the framework folder; moved artifacts from the bi component to the proper components. Everything should be in place now, except for a convenience service (in the bi component) that quickly initializes the datawarehouse for demo purposes: this service calls two services from the applications (wrong dependency); I will fix this soon by moving it in some other places... however it is not a big deal for now because the service is really only useful to quickly test the prototype. Added: ofbiz/trunk/applications/accounting/entitydef/entitygroup_olap.xml (with props) ofbiz/trunk/applications/accounting/entitydef/entitymodel_olap.xml (with props) ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/olap/ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/olap/FactServices.xml - copied unchanged from r677533, ofbiz/trunk/specialpurpose/bi/script/org/ofbiz/bi/FactServices.xml ofbiz/trunk/applications/accounting/servicedef/secas_olap.xml (with props) ofbiz/trunk/applications/accounting/servicedef/services_olap.xml (with props) ofbiz/trunk/applications/product/data/DimensionTypeData.xml (with props) ofbiz/trunk/applications/product/entitydef/entitygroup_olap.xml (with props) ofbiz/trunk/applications/product/entitydef/entitymodel_olap.xml (with props) ofbiz/trunk/applications/product/script/org/ofbiz/product/olap/ ofbiz/trunk/applications/product/script/org/ofbiz/product/olap/ProductDimensionServices.xml (with props) ofbiz/trunk/applications/product/servicedef/secas_olap.xml (with props) ofbiz/trunk/applications/product/servicedef/services_olap.xml (with props) ofbiz/trunk/framework/bi/ - copied from r677579, ofbiz/trunk/specialpurpose/bi/ ofbiz/trunk/framework/common/data/DimensionTypeData.xml (with props) ofbiz/trunk/framework/common/entitydef/entitygroup_olap.xml (with props) ofbiz/trunk/framework/common/entitydef/entitymodel_olap.xml (with props) ofbiz/trunk/framework/common/script/org/ofbiz/common/olap/ ofbiz/trunk/framework/common/script/org/ofbiz/common/olap/CommonDimensionServices.xml (with props) ofbiz/trunk/framework/common/servicedef/services_olap.xml (with props) ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/ ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java (with props) Removed: ofbiz/trunk/framework/bi/data/ ofbiz/trunk/framework/bi/entitydef/ ofbiz/trunk/framework/bi/script/org/ofbiz/bi/FactServices.xml ofbiz/trunk/framework/bi/servicedef/secas_accounting_olap.xml ofbiz/trunk/framework/bi/servicedef/secas_product_olap.xml ofbiz/trunk/framework/bi/servicedef/services_accounting_olap.xml ofbiz/trunk/framework/bi/servicedef/services_common_olap.xml ofbiz/trunk/framework/bi/servicedef/services_product_olap.xml ofbiz/trunk/specialpurpose/bi/ Modified: ofbiz/trunk/.classpath ofbiz/trunk/applications/accounting/build.xml ofbiz/trunk/applications/accounting/ofbiz-component.xml ofbiz/trunk/applications/product/ofbiz-component.xml ofbiz/trunk/framework/bi/build.xml ofbiz/trunk/framework/bi/ofbiz-component.xml ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml ofbiz/trunk/framework/bi/src/org/ofbiz/bi/util/DimensionServices.java ofbiz/trunk/framework/build.xml ofbiz/trunk/framework/common/ofbiz-component.xml ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java ofbiz/trunk/framework/component-load.xml ofbiz/trunk/specialpurpose/build.xml ofbiz/trunk/specialpurpose/component-load.xml Modified: ofbiz/trunk/.classpath URL: http://svn.apache.org/viewvc/ofbiz/trunk/.classpath?rev=677587&r1=677586&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/.classpath (original) +++ ofbiz/trunk/.classpath Thu Jul 17 07:12:38 2008 @@ -25,7 +25,6 @@ <classpathentry kind="src" path="specialpurpose/assetmaint/src"/> <classpathentry kind="src" path="specialpurpose/pos/src"/> <classpathentry kind="src" path="specialpurpose/projectmgr/src"/> - <classpathentry kind="src" path="specialpurpose/bi/src"/> <classpathentry kind="src" path="specialpurpose/ebay/src"/> <classpathentry kind="src" path="specialpurpose/googlebase/src"/> <classpathentry kind="src" path="framework/base/src/base"/> @@ -41,6 +40,7 @@ <classpathentry excluding="ShipmentScaleApplet.java" kind="src" path="applications/product/src"/> <classpathentry excluding="org/ofbiz/securityext/thirdparty/truition/TruitionCoReg.java" kind="src" path="applications/securityext/src"/> <classpathentry kind="src" path="applications/workeffort/src"/> + <classpathentry kind="src" path="framework/bi/src"/> <classpathentry kind="src" path="framework/appserver/src"/> <classpathentry kind="src" path="framework/catalina/src"/> <classpathentry kind="src" path="framework/common/src"/> Modified: ofbiz/trunk/applications/accounting/build.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/build.xml?rev=677587&r1=677586&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/build.xml (original) +++ ofbiz/trunk/applications/accounting/build.xml Thu Jul 17 07:12:38 2008 @@ -50,6 +50,7 @@ <!-- <fileset dir="lib/worldpay" includes="*.jar"/> --> <!-- <fileset dir="lib/cybersource" includes="*.jar"/> --> <fileset dir="lib" includes="*.jar"/> + <fileset dir="../../hot-deploy/twpinc/lib" includes="*.jar"/> </path> <!-- ================================================================== --> @@ -59,7 +60,7 @@ <target name="classes" depends="prepare"> <javac15 classpathref="local.class.path"> <!-- exclude the payment processor packages; comment this out to not exclude if you have libs --> - <exclude name="org/ofbiz/accounting/thirdparty/verisign/**"/> + <!-- <exclude name="org/ofbiz/accounting/thirdparty/verisign/**"/> --> <exclude name="org/ofbiz/accounting/thirdparty/cybersource/**"/> <exclude name="org/ofbiz/accounting/thirdparty/worldpay/**"/> </javac15> Added: ofbiz/trunk/applications/accounting/entitydef/entitygroup_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitygroup_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/entitygroup_olap.xml (added) +++ ofbiz/trunk/applications/accounting/entitydef/entitygroup_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,35 @@ +<?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"> + + <!-- ========================================================= --> + <!-- Facts --> + <!-- ========================================================= --> + <entity-group group="org.ofbiz.olap" entity="SalesInvoiceItemFact" /> + + <!-- ========================================================= --> + <!-- Star Schemas --> + <!-- ========================================================= --> + <entity-group group="org.ofbiz.olap" entity="SalesInvoiceItemStarSchema" /> + +</entitygroup> + Propchange: ofbiz/trunk/applications/accounting/entitydef/entitygroup_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/entitydef/entitygroup_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/accounting/entitydef/entitygroup_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/applications/accounting/entitydef/entitymodel_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/entitymodel_olap.xml (added) +++ ofbiz/trunk/applications/accounting/entitydef/entitymodel_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,165 @@ +<?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>OLAP entities for the Accounting component</title> + <description>None</description> + <copyright>Copyright 2001-2007 The Apache Software Foundation</copyright> + + <!-- ========================================================= --> + <!-- Facts --> + <!-- ========================================================= --> + <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> + + <!-- ========================================================= --> + <!-- Star Schemas --> + <!-- ========================================================= --> + <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/applications/accounting/entitydef/entitymodel_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/entitydef/entitymodel_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/accounting/entitydef/entitymodel_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/applications/accounting/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/ofbiz-component.xml?rev=677587&r1=677586&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/ofbiz-component.xml (original) +++ ofbiz/trunk/applications/accounting/ofbiz-component.xml Thu Jul 17 07:12:38 2008 @@ -33,6 +33,8 @@ <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_reports.xml"/> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_old.xml"/> + <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_olap.xml"/> + <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup_olap.xml"/> <entity-resource type="eca" reader-name="main" loader="main" location="entitydef/eecas.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingTypeData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/UsTaxAccountGroups.xml"/> @@ -54,6 +56,7 @@ <service-resource type="model" loader="main" location="servicedef/services_paymentmethod.xml"/> <service-resource type="model" loader="main" location="servicedef/services_tax.xml"/> <service-resource type="model" loader="main" location="servicedef/services_cost.xml"/> + <service-resource type="model" loader="main" location="servicedef/services_olap.xml"/> <!-- Payment Processor/Gateway Service Definitions --> <service-resource type="model" loader="main" location="servicedef/services_clearcommerce.xml"/> @@ -68,6 +71,7 @@ <service-resource type="eca" loader="main" location="servicedef/secas.xml"/> <service-resource type="eca" loader="main" location="servicedef/secas_payment.xml"/> <service-resource type="eca" loader="main" location="servicedef/secas_ledger.xml"/> + <service-resource type="eca" loader="main" location="servicedef/secas_olap.xml"/> <test-suite loader="main" location="testdef/accountingtests.xml"/> Added: ofbiz/trunk/applications/accounting/servicedef/secas_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/secas_olap.xml (added) +++ ofbiz/trunk/applications/accounting/servicedef/secas_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,32 @@ +<?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"> + + <!-- 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/applications/accounting/servicedef/secas_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/servicedef/secas_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/accounting/servicedef/secas_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/applications/accounting/servicedef/services_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_olap.xml (added) +++ ofbiz/trunk/applications/accounting/servicedef/services_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,41 @@ +<?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"> + + <!-- Accounting Facts --> + <service name="loadSalesInvoiceItemFact" auth="true" engine="simple" + location="org/ofbiz/accounting/olap/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/accounting/olap/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> +</services> Propchange: ofbiz/trunk/applications/accounting/servicedef/services_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/servicedef/services_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/accounting/servicedef/services_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/applications/product/data/DimensionTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/DimensionTypeData.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/product/data/DimensionTypeData.xml (added) +++ ofbiz/trunk/applications/product/data/DimensionTypeData.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,25 @@ +<?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> + + <ProductDimension dimensionId="_NF_"/> + <ProductDimension dimensionId="_NA_"/> + +</entity-engine-xml> Propchange: ofbiz/trunk/applications/product/data/DimensionTypeData.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/data/DimensionTypeData.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/product/data/DimensionTypeData.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/applications/product/entitydef/entitygroup_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitygroup_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/product/entitydef/entitygroup_olap.xml (added) +++ ofbiz/trunk/applications/product/entitydef/entitygroup_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,28 @@ +<?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"> + + <!-- ========================================================= --> + <!-- Dimensions --> + <!-- ========================================================= --> + <entity-group group="org.ofbiz.olap" entity="ProductDimension" /> +</entitygroup> Propchange: ofbiz/trunk/applications/product/entitydef/entitygroup_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/entitydef/entitygroup_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/product/entitydef/entitygroup_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/applications/product/entitydef/entitymodel_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/product/entitydef/entitymodel_olap.xml (added) +++ ofbiz/trunk/applications/product/entitydef/entitymodel_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,49 @@ +<?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>OLAP entities for the Product component</title> + <description>None</description> + <copyright>Copyright 2001-2007 The Apache Software Foundation</copyright> + + <!-- ========================================================= --> + <!-- Dimensions --> + <!-- ========================================================= --> + + <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> +</entitymodel> Propchange: ofbiz/trunk/applications/product/entitydef/entitymodel_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/entitydef/entitymodel_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/product/entitydef/entitymodel_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/applications/product/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/ofbiz-component.xml?rev=677587&r1=677586&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/applications/product/ofbiz-component.xml (original) +++ ofbiz/trunk/applications/product/ofbiz-component.xml Thu Jul 17 07:12:38 2008 @@ -28,6 +28,8 @@ <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_shipment.xml"/> + <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_olap.xml"/> + <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup_olap.xml"/> <entity-resource type="eca" reader-name="main" loader="main" location="entitydef/eecas.xml"/> <entity-resource type="data" reader-name="seed-initial" loader="main" location="data/ProductScheduledServices.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/ProductTypeData.xml"/> @@ -35,7 +37,8 @@ <entity-resource type="data" reader-name="seed" loader="main" location="data/ProductSecurityData.xml"/> <entity-resource type="data" reader-name="demo" loader="main" location="data/ProductUserDemoData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/ApiSchemaDhl.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="model" loader="main" location="servicedef/services_facility.xml"/> <service-resource type="model" loader="main" location="servicedef/services_feature.xml"/> @@ -53,8 +56,10 @@ <service-resource type="model" loader="main" location="servicedef/services_view.xml"/> <service-resource type="model" loader="main" location="servicedef/services_cost.xml"/> <service-resource type="model" loader="main" location="servicedef/services_uom.xml"/> + <service-resource type="model" loader="main" location="servicedef/services_olap.xml"/> <service-resource type="eca" loader="main" location="servicedef/secas.xml"/> <service-resource type="eca" loader="main" location="servicedef/secas_shipment.xml"/> + <service-resource type="eca" loader="main" location="servicedef/secas_olap.xml"/> <!-- test suite --> <test-suite loader="main" location="testdef/FacilityTest.xml"/> Added: ofbiz/trunk/applications/product/script/org/ofbiz/product/olap/ProductDimensionServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/olap/ProductDimensionServices.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/product/olap/ProductDimensionServices.xml (added) +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/olap/ProductDimensionServices.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,59 @@ +<?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="prepareProductDimensionData" short-description=""> + <entity-one entity-name="Product" value-name="product"/> + <if-empty field="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-methods> Propchange: ofbiz/trunk/applications/product/script/org/ofbiz/product/olap/ProductDimensionServices.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/script/org/ofbiz/product/olap/ProductDimensionServices.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/product/script/org/ofbiz/product/olap/ProductDimensionServices.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/applications/product/servicedef/secas_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/secas_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/product/servicedef/secas_olap.xml (added) +++ ofbiz/trunk/applications/product/servicedef/secas_olap.xml Thu Jul 17 07:12:38 2008 @@ -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. +--> + +<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> +</service-eca> Propchange: ofbiz/trunk/applications/product/servicedef/secas_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/servicedef/secas_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/product/servicedef/secas_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/applications/product/servicedef/services_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services_olap.xml (added) +++ ofbiz/trunk/applications/product/servicedef/services_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,54 @@ +<?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"> + + <!-- ProductDimension --> + <service name="prepareProductDimensionData" auth="true" engine="simple" + location="org/ofbiz/product/olap/ProductDimensionServices.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/product/olap/ProductDimensionServices.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/product/olap/ProductDimensionServices.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/product/olap/ProductDimensionServices.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/product/olap/ProductDimensionServices.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"/> + </service> +</services> Propchange: ofbiz/trunk/applications/product/servicedef/services_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/servicedef/services_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/product/servicedef/services_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/framework/bi/build.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/bi/build.xml?rev=677587&r1=677579&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/framework/bi/build.xml (original) +++ ofbiz/trunk/framework/bi/build.xml Thu Jul 17 07:12:38 2008 @@ -39,12 +39,6 @@ <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> <!-- ================================================================== --> Modified: ofbiz/trunk/framework/bi/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/bi/ofbiz-component.xml?rev=677587&r1=677579&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/framework/bi/ofbiz-component.xml (original) +++ ofbiz/trunk/framework/bi/ofbiz-component.xml Thu Jul 17 07:12:38 2008 @@ -25,23 +25,8 @@ <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_common_olap.xml"/> - <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_product_olap.xml"/> - <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_accounting_olap.xml"/> - <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup_common_olap.xml"/> - <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup_product_olap.xml"/> - <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup_accounting_olap.xml"/> - - <entity-resource type="data" reader-name="seed" loader="main" location="data/DimensionTypeData_common.xml"/> - <entity-resource type="data" reader-name="seed" loader="main" location="data/DimensionTypeData_product.xml"/> - + <service-resource type="model" loader="main" location="servicedef/services.xml"/> - <service-resource type="model" loader="main" location="servicedef/services_common_olap.xml"/> - <service-resource type="model" loader="main" location="servicedef/services_product_olap.xml"/> - <service-resource type="model" loader="main" location="servicedef/services_accounting_olap.xml"/> - <service-resource type="eca" loader="main" location="servicedef/secas_product_olap.xml"/> - <service-resource type="eca" loader="main" location="servicedef/secas_accounting_olap.xml"/> <webapp name="bi" title="Business Intelligence" Modified: ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml?rev=677587&r1=677579&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml (original) +++ ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml Thu Jul 17 07:12:38 2008 @@ -21,65 +21,6 @@ <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="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="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"/> Modified: ofbiz/trunk/framework/bi/src/org/ofbiz/bi/util/DimensionServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/bi/src/org/ofbiz/bi/util/DimensionServices.java?rev=677587&r1=677579&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/framework/bi/src/org/ofbiz/bi/util/DimensionServices.java (original) +++ ofbiz/trunk/framework/bi/src/org/ofbiz/bi/util/DimensionServices.java Thu Jul 17 07:12:38 2008 @@ -120,72 +120,4 @@ 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"); - dateValue.set("dimensionId", delegator.getNextSeqId("DateDimension")); - dateValue.set("dateValue", new java.sql.Date(currentDate.getTime())); - } - dateValue.set("description", dayDescriptionFormat.format(currentDate)); - int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); - dateValue.set("dayName", dayNameFormat.format(currentDate)); - dateValue.set("dayOfMonth", new Long(calendar.get(Calendar.DAY_OF_MONTH))); - dateValue.set("dayOfYear", new Long(calendar.get(Calendar.DAY_OF_YEAR))); - dateValue.set("monthName", monthNameFormat.format(currentDate)); - - dateValue.set("monthOfYear", new Long(calendar.get(Calendar.MONTH) + 1)); - dateValue.set("yearName", new Long(calendar.get(Calendar.YEAR))); - dateValue.set("weekOfMonth", new Long(calendar.get(Calendar.WEEK_OF_MONTH))); - dateValue.set("weekOfYear", new Long(calendar.get(Calendar.WEEK_OF_YEAR))); - dateValue.set("weekdayType", (dayOfWeek == 1 || dayOfWeek == 7? "Weekend": "Weekday")); - dateValue.set("yearMonthDay", yearMonthDayFormat.format(currentDate)); - dateValue.set("yearAndMonth", 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(); - } - } Modified: ofbiz/trunk/framework/build.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/build.xml?rev=677587&r1=677586&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/framework/build.xml (original) +++ ofbiz/trunk/framework/build.xml Thu Jul 17 07:12:38 2008 @@ -26,7 +26,7 @@ entity/build.xml,geronimo/build.xml, catalina/build.xml,jetty/build.xml, security/build.xml,service/build.xml,entityext/build.xml, - datafile/build.xml,minilang/build.xml, + bi/build.xml,datafile/build.xml,minilang/build.xml, common/build.xml, webapp/build.xml,guiapp/build.xml,widget/build.xml, testtools/build.xml, Added: ofbiz/trunk/framework/common/data/DimensionTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/data/DimensionTypeData.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/framework/common/data/DimensionTypeData.xml (added) +++ ofbiz/trunk/framework/common/data/DimensionTypeData.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,28 @@ +<?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."/> + +</entity-engine-xml> Propchange: ofbiz/trunk/framework/common/data/DimensionTypeData.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/common/data/DimensionTypeData.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/common/data/DimensionTypeData.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/common/entitydef/entitygroup_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/entitydef/entitygroup_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/framework/common/entitydef/entitygroup_olap.xml (added) +++ ofbiz/trunk/framework/common/entitydef/entitygroup_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,29 @@ +<?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"> + + <!-- ========================================================= --> + <!-- Dimensions --> + <!-- ========================================================= --> + <entity-group group="org.ofbiz.olap" entity="CurrencyDimension" /> + <entity-group group="org.ofbiz.olap" entity="DateDimension" /> +</entitygroup> Propchange: ofbiz/trunk/framework/common/entitydef/entitygroup_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/common/entitydef/entitygroup_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/common/entitydef/entitygroup_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/common/entitydef/entitymodel_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/entitydef/entitymodel_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/framework/common/entitydef/entitymodel_olap.xml (added) +++ ofbiz/trunk/framework/common/entitydef/entitymodel_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,94 @@ +<?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>OLAP entities for the Common component</title> + <description>None</description> + <copyright>Copyright 2001-2007 The Apache Software Foundation</copyright> + + <!-- ========================================================= --> + <!-- Dimensions --> + <!-- ========================================================= --> + + <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="yearAndMonth" 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> +</entitymodel> Propchange: ofbiz/trunk/framework/common/entitydef/entitymodel_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/common/entitydef/entitymodel_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/common/entitydef/entitymodel_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/framework/common/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/ofbiz-component.xml?rev=677587&r1=677586&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/framework/common/ofbiz-component.xml (original) +++ ofbiz/trunk/framework/common/ofbiz-component.xml Thu Jul 17 07:12:38 2008 @@ -26,6 +26,8 @@ <classpath type="dir" location="config"/> <classpath type="dir" location="script"/> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> + <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_olap.xml"/> + <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup_olap.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonSecurityData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonTypeData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/CountryCodeData.xml"/> @@ -49,9 +51,11 @@ <entity-resource type="data" reader-name="seed" loader="main" location="data/LanguageData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/UnitData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/PeriodData.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="model" loader="main" location="servicedef/services_test.xml"/> <service-resource type="model" loader="main" location="servicedef/services_cdyne.xml"/> + <service-resource type="model" loader="main" location="servicedef/services_olap.xml"/> <service-resource type="group" loader="main" location="servicedef/groups_test.xml"/> <service-resource type="eca" loader="main" location="servicedef/secas_test.xml"/> <service-resource type="eca" loader="main" location="servicedef/secas_cdyne.xml"/> Added: ofbiz/trunk/framework/common/script/org/ofbiz/common/olap/CommonDimensionServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/olap/CommonDimensionServices.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/framework/common/script/org/ofbiz/common/olap/CommonDimensionServices.xml (added) +++ ofbiz/trunk/framework/common/script/org/ofbiz/common/olap/CommonDimensionServices.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,48 @@ +<?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"> + + <!-- OLAP Dimension --> + <simple-method method-name="loadCurrencyDimension" short-description="Initialize the CurrencyDimension using the update strategy of 'type 1'"> + <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="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-methods> Propchange: ofbiz/trunk/framework/common/script/org/ofbiz/common/olap/CommonDimensionServices.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/common/script/org/ofbiz/common/olap/CommonDimensionServices.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/common/script/org/ofbiz/common/olap/CommonDimensionServices.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/common/servicedef/services_olap.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services_olap.xml?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/framework/common/servicedef/services_olap.xml (added) +++ ofbiz/trunk/framework/common/servicedef/services_olap.xml Thu Jul 17 07:12:38 2008 @@ -0,0 +1,36 @@ +<?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"> + + <!-- Common Dimension --> + <service name="loadDateDimension" engine="java" transaction-timeout="300" + location="org.ofbiz.common.olap.CommonDimensionServices" 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/common/olap/CommonDimensionServices.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> + +</services> Propchange: ofbiz/trunk/framework/common/servicedef/services_olap.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/common/servicedef/services_olap.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/common/servicedef/services_olap.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java?rev=677587&r1=677586&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java Thu Jul 17 07:12:38 2008 @@ -21,6 +21,7 @@ import java.io.*; import java.nio.ByteBuffer; import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.util.*; import javax.mail.internet.MimeMessage; @@ -40,6 +41,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.transaction.TransactionUtil; +import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -497,6 +499,5 @@ return ServiceUtil.returnError("Invalid count returned from database"); } } -} - +} Added: ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java?rev=677587&view=auto ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java (added) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java Thu Jul 17 07:12:38 2008 @@ -0,0 +1,129 @@ +/******************************************************************************* + * 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.common.olap; + +import java.io.*; +import java.nio.ByteBuffer; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.*; + +import javax.mail.internet.MimeMessage; +import javax.transaction.xa.XAException; + +import javolution.util.FastMap; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilDateTime; +import static org.ofbiz.base.util.UtilGenerics.checkList; +import static org.ofbiz.base.util.UtilGenerics.checkMap; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.entity.GenericDelegator; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.model.ModelEntity; +import org.ofbiz.entity.transaction.TransactionUtil; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ModelService; +import org.ofbiz.service.ServiceUtil; +import org.ofbiz.service.ServiceXaWrapper; +import org.ofbiz.service.mail.MimeMessageWrapper; + +/** + * Common Services + */ +public class CommonDimensionServices { + + public final static String module = CommonDimensionServices.class.getName(); + + /* + * OLAP Dimension + * 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"); + dateValue.set("dimensionId", delegator.getNextSeqId("DateDimension")); + dateValue.set("dateValue", new java.sql.Date(currentDate.getTime())); + } + dateValue.set("description", dayDescriptionFormat.format(currentDate)); + int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); + dateValue.set("dayName", dayNameFormat.format(currentDate)); + dateValue.set("dayOfMonth", new Long(calendar.get(Calendar.DAY_OF_MONTH))); + dateValue.set("dayOfYear", new Long(calendar.get(Calendar.DAY_OF_YEAR))); + dateValue.set("monthName", monthNameFormat.format(currentDate)); + + dateValue.set("monthOfYear", new Long(calendar.get(Calendar.MONTH) + 1)); + dateValue.set("yearName", new Long(calendar.get(Calendar.YEAR))); + dateValue.set("weekOfMonth", new Long(calendar.get(Calendar.WEEK_OF_MONTH))); + dateValue.set("weekOfYear", new Long(calendar.get(Calendar.WEEK_OF_YEAR))); + dateValue.set("weekdayType", (dayOfWeek == 1 || dayOfWeek == 7? "Weekend": "Weekday")); + dateValue.set("yearMonthDay", yearMonthDayFormat.format(currentDate)); + dateValue.set("yearAndMonth", 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/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/framework/component-load.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/component-load.xml?rev=677587&r1=677586&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/framework/component-load.xml (original) +++ ofbiz/trunk/framework/component-load.xml Thu Jul 17 07:12:38 2008 @@ -30,6 +30,7 @@ <load-component component-location="common"/> <load-component component-location="service"/> <load-component component-location="entityext"/> + <load-component component-location="bi"/> <load-component component-location="webapp"/> <load-component component-location="guiapp"/> <load-component component-location="widget"/> Modified: ofbiz/trunk/specialpurpose/build.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/build.xml?rev=677587&r1=677586&r2=677587&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/build.xml (original) +++ ofbiz/trunk/specialpurpose/build.xml Thu Jul 17 07:12:38 2008 @@ -26,7 +26,6 @@ hhfacility/build.xml, assetmaint/build.xml, oagis/build.xml, - bi/build.xml, googlebase/build.xml, ebay/build.xml, projectmgr/build.xml"/> |
Free forum by Nabble | Edit this page |