Author: ashish
Date: Thu Jun 5 07:28:42 2008 New Revision: 663627 URL: http://svn.apache.org/viewvc?rev=663627&view=rev Log: Moved the files to product component suggested by David. Also improved the naming convention of file for easy maintenance and search purpose for the developer/user point of view. Added: ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductHelper.java - copied, changed from r663581, ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportHelper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java - copied, changed from r663581, ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportService.java Removed: ofbiz/trunk/specialpurpose/assetmaint/data/ScheduleUploadJob.xml ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportHelper.java ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportService.java Modified: ofbiz/trunk/applications/product/data/ProductScheduledServices.xml ofbiz/trunk/applications/product/servicedef/services.xml ofbiz/trunk/specialpurpose/assetmaint/build.xml ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml Modified: ofbiz/trunk/applications/product/data/ProductScheduledServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductScheduledServices.xml?rev=663627&r1=663626&r2=663627&view=diff ============================================================================== --- ofbiz/trunk/applications/product/data/ProductScheduledServices.xml (original) +++ ofbiz/trunk/applications/product/data/ProductScheduledServices.xml Thu Jun 5 07:28:42 2008 @@ -22,4 +22,9 @@ <RecurrenceRule recurrenceRuleId="420" untilDateTime="" frequency="DAILY" intervalNumber="1" countNumber="-1"/> <RecurrenceInfo recurrenceInfoId="420" startDateTime="2000-01-01 00:00:00.000" recurrenceRuleId="420" recurrenceCount="0"/> <JobSandbox jobId="8100" jobName="Purge Old Store Auto-Entered Promos" runTime="2000-01-01 00:00:00.000" serviceName="purgeOldStoreAutoPromos" poolId="pool" runAsUser="system" recurrenceInfoId="420"/> + + <!--Data for scheduling the service productImportFromSpreadsheet --> + <!--RecurrenceRule recurrenceRuleId="500" untilDateTime="" frequency="MINUTELY" intervalNumber="5" countNumber="-1"/> + <RecurrenceInfo recurrenceInfoId="500" startDateTime="2006-06-06 01:10:00.000" recurrenceRuleId="500" recurrenceCount="0"/> + <JobSandbox jobId="9000" jobName="Import Excel Sheet Minutely" runTime="2008-05-29 01:10:00.000" serviceName="productImportFromSpreadsheet" poolId="pool" runAsUser="admin" recurrenceInfoId="500"/--> </entity-engine-xml> Modified: ofbiz/trunk/applications/product/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=663627&r1=663626&r2=663627&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services.xml Thu Jun 5 07:28:42 2008 @@ -1208,4 +1208,10 @@ <description>ProdCatalogToParty Permission Checking Logic</description> <implements service="permissionInterface"/> </service> + + <service name="productImportFromSpreadsheet" engine="java" + location="org.ofbiz.poi.ImportProductServices" invoke="productImportFromSpreadsheet" auth="true"> + <description>Create product and inventory item</description> + <attribute name="dirName" type="java.lang.String" mode="IN" optional="true"/> + </service> </services> Copied: ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductHelper.java (from r663581, ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportHelper.java) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductHelper.java?p2=ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductHelper.java&p1=ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportHelper.java&r1=663581&r2=663627&rev=663627&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportHelper.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductHelper.java Thu Jun 5 07:28:42 2008 @@ -17,7 +17,7 @@ * under the License. *******************************************************************************/ -package org.ofbiz.poi; +package org.ofbiz.product.spreadsheetimport; import java.util.HashMap; import java.util.Map; @@ -28,9 +28,9 @@ import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -public class FileImportHelper { +public class ImportProductHelper { - static String module = FileImportHelper.class.getName(); + static String module = ImportProductHelper.class.getName(); // prepare the product map public static Map prepareProduct(String productId) { Copied: ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java (from r663581, ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportService.java) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java?p2=ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java&p1=ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportService.java&r1=663581&r2=663627&rev=663627&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/poi/FileImportService.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java Thu Jun 5 07:28:42 2008 @@ -17,7 +17,7 @@ * under the License. *******************************************************************************/ -package org.ofbiz.poi; +package org.ofbiz.product.spreadsheetimport; import java.io.File; import java.io.FileInputStream; @@ -39,14 +39,14 @@ import org.ofbiz.service.DispatchContext; import org.ofbiz.service.ServiceUtil; -public class FileImportService { +public class ImportProductServices { - public static String module = FileImportService.class.getName(); + public static String module = ImportProductServices.class.getName(); /** * This method is responsible to import spreadsheet data into "Product" and * "InventoryItem" entities into database. The method uses the - * FileImportHelper class to perform its opertaion. The method uses "Apache + * ImportProductHelper class to perform its opertaion. The method uses "Apache * POI" api for importing spreadsheet(xls files) data. * * Note : Create the spreadsheet directory in the ofbiz home folder and keep @@ -56,7 +56,7 @@ * @param context * @return */ - public static Map productImport(DispatchContext dctx, Map context) { + public static Map productImportFromSpreadsheet(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); Map responseMsgs = new HashMap(); // System.getProperty("user.dir") returns the path upto ofbiz home @@ -124,15 +124,15 @@ // check productId if null then skip creating inventory item // too. - boolean productExists = FileImportHelper.checkProductExists(productId, delegator); + boolean productExists = ImportProductHelper.checkProductExists(productId, delegator); if (productId != null && !productId.trim().equalsIgnoreCase("") && !productExists) { - products.add(FileImportHelper.prepareProduct(productId)); + products.add(ImportProductHelper.prepareProduct(productId)); if (quantityOnHand >= 0.0) - inventoryItems.add(FileImportHelper.prepareInventoryItem(productId, quantityOnHand, + inventoryItems.add(ImportProductHelper.prepareInventoryItem(productId, quantityOnHand, delegator.getNextSeqId("InventoryItem"))); else - inventoryItems.add(FileImportHelper.prepareInventoryItem(productId, 0.0, delegator + inventoryItems.add(ImportProductHelper.prepareInventoryItem(productId, 0.0, delegator .getNextSeqId("InventoryItem"))); } int rowNum = row.getRowNum() + 1; @@ -147,7 +147,7 @@ for (int j = 0; j < products.size(); j++) { GenericValue productGV = delegator.makeValue("Product", (Map) products.get(j)); GenericValue inventoryItemGV = delegator.makeValue("InventoryItem", (Map) inventoryItems.get(j)); - if (!FileImportHelper.checkProductExists(productGV.getString("productId"), delegator)) { + if (!ImportProductHelper.checkProductExists(productGV.getString("productId"), delegator)) { try { delegator.create(productGV); delegator.create(inventoryItemGV); Modified: ofbiz/trunk/specialpurpose/assetmaint/build.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/build.xml?rev=663627&r1=663626&r2=663627&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/assetmaint/build.xml (original) +++ ofbiz/trunk/specialpurpose/assetmaint/build.xml Thu Jun 5 07:28:42 2008 @@ -50,7 +50,6 @@ <fileset dir="../../framework/webapp/build/lib" includes="*.jar"/> <fileset dir="../../framework/common/build/lib" includes="*.jar"/> <fileset dir="../../framework/workflow/build/lib" includes="*.jar"/> - <fileset dir="../../applications/content/lib" includes="*.jar"/> <fileset dir="../../applications/product/build/lib" includes="*.jar"/> </path> </target> Modified: ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml?rev=663627&r1=663626&r2=663627&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml (original) +++ ofbiz/trunk/specialpurpose/assetmaint/servicedef/services.xml Thu Jun 5 07:28:42 2008 @@ -36,10 +36,4 @@ <description>Asset Maintentance Permission Checking Logic</description> <implements service="permissionInterface"/> </service> - - <service name="productImport" engine="java" - location="org.ofbiz.poi.FileImportService" invoke="productImport" auth="true"> - <description>Create product and inventory item</description> - <attribute name="dirName" type="java.lang.String" mode="IN" optional="true"/> - </service> </services> |
Free forum by Nabble | Edit this page |