Author: shijh
Date: Mon Nov 21 08:07:57 2016 New Revision: 1770621 URL: http://svn.apache.org/viewvc?rev=1770621&view=rev Log: OFBIZ-9123 Add a PriCat component under specialpurpose Added: ofbiz/trunk/specialpurpose/pricat/ ofbiz/trunk/specialpurpose/pricat/build.gradle ofbiz/trunk/specialpurpose/pricat/config/ ofbiz/trunk/specialpurpose/pricat/config/PricatUiLabels.xml ofbiz/trunk/specialpurpose/pricat/config/pricat.properties ofbiz/trunk/specialpurpose/pricat/data/ ofbiz/trunk/specialpurpose/pricat/data/PricatData.xml ofbiz/trunk/specialpurpose/pricat/entitydef/ ofbiz/trunk/specialpurpose/pricat/entitydef/entitymodel.xml ofbiz/trunk/specialpurpose/pricat/groovyScripts/ ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/ ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImport.groovy ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImportLog.groovy ofbiz/trunk/specialpurpose/pricat/ofbiz-component.xml ofbiz/trunk/specialpurpose/pricat/src/ ofbiz/trunk/specialpurpose/pricat/src/main/ ofbiz/trunk/specialpurpose/pricat/src/main/java/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReport.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReportThread.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlReport.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlThread.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportEncoder.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/InterfacePricatParser.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlReport.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlThread.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/sample/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatEvents.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/poi/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/poi/xssf/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/poi/xssf/usermodel/ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/poi/xssf/usermodel/OFBizPricatUtil.java ofbiz/trunk/specialpurpose/pricat/webapp/ ofbiz/trunk/specialpurpose/pricat/webapp/pricat/ ofbiz/trunk/specialpurpose/pricat/webapp/pricat/WEB-INF/ ofbiz/trunk/specialpurpose/pricat/webapp/pricat/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/pricat/webapp/pricat/WEB-INF/web.xml ofbiz/trunk/specialpurpose/pricat/webapp/pricat/error/ ofbiz/trunk/specialpurpose/pricat/webapp/pricat/error/error.jsp ofbiz/trunk/specialpurpose/pricat/webapp/pricat/ftl/ ofbiz/trunk/specialpurpose/pricat/webapp/pricat/ftl/ExcelImportHistoryReport.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricat/ftl/pricatreport.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricat/ftl/report.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricat/ftl/viewExcelImportHistory.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricat/ftl/viewExcelImportLog.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricat/includes/ ofbiz/trunk/specialpurpose/pricat/webapp/pricat/includes/pricat.css ofbiz/trunk/specialpurpose/pricat/webapp/pricat/index.jsp ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/ ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/WEB-INF/ ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/WEB-INF/web.xml ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/downloads/ ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/downloads/SamplePricatTemplate_V1.1.xlsx (with props) ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/error/ ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/error/error.jsp ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/ftl/ ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/ftl/SamplePricat.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/ftl/countdownreport.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/ftl/countupreport.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/ftl/main.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/ftl/parsePricatExcel.ftl ofbiz/trunk/specialpurpose/pricat/webapp/pricatdemo/index.jsp ofbiz/trunk/specialpurpose/pricat/widget/ ofbiz/trunk/specialpurpose/pricat/widget/CommonScreens.xml ofbiz/trunk/specialpurpose/pricat/widget/PriCatDemoMenus.xml ofbiz/trunk/specialpurpose/pricat/widget/PriCatMenus.xml ofbiz/trunk/specialpurpose/pricat/widget/SampleScreens.xml Added: ofbiz/trunk/specialpurpose/pricat/build.gradle URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/build.gradle?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/build.gradle (added) +++ ofbiz/trunk/specialpurpose/pricat/build.gradle Mon Nov 21 08:07:57 2016 @@ -0,0 +1,25 @@ +/* + * 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. + */ +dependencies { + pluginLibsCompile 'org.safehaus.jug:jug:2.0.0:asl' + pluginLibsCompile 'org.apache.poi:poi-ooxml:3.14' + pluginLibsCompile 'org.apache.poi:poi-ooxml-schemas:3.14' + pluginLibsCompile 'org.apache.poi:poi-excelant:3.14' + pluginLibsCompile 'org.apache.poi:poi-scratchpad:3.14' +} \ No newline at end of file Added: ofbiz/trunk/specialpurpose/pricat/config/PricatUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/config/PricatUiLabels.xml?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/config/PricatUiLabels.xml (added) +++ ofbiz/trunk/specialpurpose/pricat/config/PricatUiLabels.xml Mon Nov 21 08:07:57 2016 @@ -0,0 +1,532 @@ +<?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. +--> +<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <property key="PriCatCompanyName"> + <value xml:lang="en">OFBiz: PriCat Demo</value> + <value xml:lang="zh">OFBizï¼ä»·ç®è¡¨</value> + </property> + <property key="PriCatApplication"> + <value xml:lang="en">PriCat</value> + <value xml:lang="zh">ä»·ç®è¡¨</value> + </property> + <property key="PriCatDemoCompanyName"> + <value xml:lang="en">OFBiz: PriCat Demo</value> + <value xml:lang="zh">OFBizï¼ä»·ç®è¡¨æ¼ç¤º</value> + </property> + <property key="PriCatDemoApplication"> + <value xml:lang="en">PriCat Demo</value> + <value xml:lang="zh">ä»·ç®è¡¨æ¼ç¤º</value> + </property> + <property key="PriCatDemoCountDown"> + <value xml:lang="en">HTML Report Demo - Count Down</value> + <value xml:lang="zh">页é¢è¾åºæ¼ç¤º - å计æ°</value> + </property> + <property key="PriCatDemoCountUp"> + <value xml:lang="en">HTML Report Demo - Count Up</value> + <value xml:lang="zh">页é¢è¾åºæ¼ç¤º - æ£è®¡æ°</value> + </property> + <property key="PriCatDemoParseSamplePricat"> + <value xml:lang="en">PriCat Demo - Parse PriCat</value> + <value xml:lang="zh">ä»·ç®è¡¨æ¼ç¤º - 解æä»·ç®è¡¨</value> + </property> + <property key="PriCatDemoMainPage"> + <value xml:lang="en">PriCat Demo Main Page</value> + <value xml:lang="zh">ä»·ç®è¡¨æ¼ç¤ºé¦é¡µ</value> + </property> + <property key="PricatDemoMessage"> + <value xml:lang="en">PriCat Demo includes 2 HTML Report Demo and 1 Parse PriCat File Demo.</value> + <value xml:lang="zh">ä»·ç®è¡¨æ¼ç¤ºå å«äº2个页é¢è¾åºæ¼ç¤ºå1个解æä»·ç®è¡¨æ件çæ¼ç¤ºã</value> + </property> + <property key="ParseSamplePricatDemo"> + <value xml:lang="en">Parse Sample PriCat Demo</value> + <value xml:lang="zh">æ¼ç¤ºè§£ææ ·ä¾ä»·ç®è¡¨æ件</value> + </property> + <property key="SamplePricatTemplate"> + <value xml:lang="en">Sample PriCat Template</value> + <value xml:lang="zh">ä»·ç®è¡¨æ ·ä¾æ¨¡æ¿</value> + </property> + <property key="DownloadPricatTemplate"> + <value xml:lang="en">Download PriCat Template</value> + <value xml:lang="zh">ä¸è½½ä»·ç®è¡¨æ¨¡æ¿</value> + </property> + <property key="UploadPricat"> + <value xml:lang="en">Upload PriCat</value> + <value xml:lang="zh">ä¸ä¼ ä»·ç®è¡¨</value> + </property> + <property key="ParseSamplePricat"> + <value xml:lang="en">Parse Sample PriCat</value> + <value xml:lang="zh">解ææ ·ä¾ä»·ç®è¡¨</value> + </property> + <property key="ExcelTemplateType"> + <value xml:lang="en">Template Type</value> + <value xml:lang="zh">模æ¿ç±»å</value> + </property> + <property key="SamplePricatType"> + <value xml:lang="en">Sample PriCat</value> + <value xml:lang="zh">æ ·ä¾ä»·ç®è¡¨</value> + </property> + <property key="OFBizPricatType"> + <value xml:lang="en">OFBiz Type</value> + <value xml:lang="zh">OFBizç±»å</value> + </property> + <property key="StartStoreExcel"> + <value xml:lang="en">Storing your upload file to server ... </value> + <value xml:lang="zh">æ£å¨æä¸ä¼ æ件åå°æå¡å¨ä¸ ... </value> + </property> + <property key="NoFileUploaded"> + <value xml:lang="en">no file uploaded!</value> + <value xml:lang="zh">没æä¸ä¼ æ件ï¼</value> + </property> + <property key="StartParsePricat"> + <value xml:lang="en">Start parsing the uploaded file ...</value> + <value xml:lang="zh">å¼å§è§£æä¸ä¼ çæ件 ...</value> + </property> + <property key="PricatParseCompleted"> + <value xml:lang="en">... parsing completed</value> + <value xml:lang="zh">... å®æ解æ</value> + </property> + <property key="CurrentUserLoginNoFacility"> + <value xml:lang="en">Cannot find any facility for current user(userLoginId: [{0}]).</value> + <value xml:lang="zh">没ææ¾å°å½åç¨æ·ï¼userLoginId: [{0}]ï¼çä»»ä½ä¸ä¸ªä»åºã</value> + </property> + <property key="GetCurrentUserLoginFacility"> + <value xml:lang="en">Getting facilities of current user ... </value> + <value xml:lang="zh">æ£å¨è·å¾å½åç¨æ·çä»åº ... </value> + </property> + <property key="FacilityFoundForCurrentUserLogin"> + <value xml:lang="en">({0}) Facility found for current user: {1}[{2}].</value> + <value xml:lang="zh">({0}) æ¾å°å½åç¨æ·çä»åºï¼{1}[{2}]ã</value> + </property> + <property key="FacilityNotBelongToYou"> + <value xml:lang="en">Facility {0}[{1}] does not belong to you. Please use a facility of yours.</value> + <value xml:lang="zh">ä»åº{0}[{1}]ä¸å±äºä½ ï¼è¯·æ¹ä¸ºä½ èªå·±çä»åºã</value> + </property> + <property key="ExcelTemplateTypeSelected"> + <value xml:lang="en">The selected Excel template type: </value> + <value xml:lang="zh">éæ©çExcel模æ¿ç±»åï¼</value> + </property> + <property key="FacilityIdSelected"> + <value xml:lang="en">The selected facility Id: </value> + <value xml:lang="zh">éæ©çä»åºç¼å·ï¼</value> + </property> + <property key="ParsePricatFileStatement"> + <value xml:lang="en">Loading file {0} ... </value> + <value xml:lang="zh">æ£å¨è¯»å ¥æ件{0} ... </value> + </property> + <property key="PricatSuggestion"> + <value xml:lang="en">Please make sure your Excel file is in format of Microsoft Excel 2007 and later. And then try again.</value> + <value xml:lang="zh">è¯·ç¡®è®¤ä½ çExcelæä»¶æ ¼å¼æ¯å¾®è½¯Office 2007ææ´æ°çæ¬çï¼ç¶åéè¯ä¸ä¸ã</value> + </property> + <property key="CheckPricatHasSheet"> + <value xml:lang="en">Checking whether your file contains at least a sheet ... </value> + <value xml:lang="zh">æ£å¨æ£æ¥ä½ çæ件æ¯å¦å å«è³å°ä¸ä¸ªè¡¨å ... </value> + </property> + <property key="PricatVersionNotSupport"> + <value xml:lang="en">Pricat Version {0} is not supported.</value> + <value xml:lang="zh">è¿ä¸è½æ¯æè¿ä¸ªä»·æ ¼åç±»ççæ¬{0}ã</value> + </property> + <property key="PricatTableOnlyParse1stSheet"> + <value xml:lang="en">Only the 1st sheet will be parsed.</value> + <value xml:lang="zh">åªè§£æ第ä¸å¼ 表ã</value> + </property> + <property key="PricatTableNoSheet"> + <value xml:lang="en">There's no sheet in the PriCat file.</value> + <value xml:lang="zh">ä»·æ ¼åç±»æ件ä¸æ²¡æ表ã</value> + </property> + <property key="PricatTableRows"> + <value xml:lang="en">Sheet [{2}] has {0} rows of header and {1} rows of data.</value> + <value xml:lang="zh">表å[{2}]æ{0}è¡è¡¨å¤´å{1}è¡æ°æ®ã</value> + </property> + <property key="PricatTableRow"> + <value xml:lang="en">Sheet [{0}] has only 1 row of data.</value> + <value xml:lang="zh">表å[{0}]åªæä¸è¡æ°æ®ã</value> + </property> + <property key="ExcelTableNoRow"> + <value xml:lang="en">There's no row in sheet [{0}].</value> + <value xml:lang="zh">表å[{0}]ä¸æ²¡ææ°æ®ã</value> + </property> + <property key="ExcelTableColumnNumberNotMatch"> + <value xml:lang="en">The sheet has {0} columns, it's not the same as sample sheet's {1}.</value> + <value xml:lang="zh">表åæ{0}åï¼ä¸æ ·ä¾è¡¨åç{1}åä¸åã</value> + </property> + <property key="ExcelTableColumnNotMatch"> + <value xml:lang="en">The column {0} has a name {1}, it's not identical to {2}.</value> + <value xml:lang="zh">å{0}çååæ¯{1}ï¼åºæ¯{2}ã</value> + </property> + <property key="ExcelParsingRow"> + <value xml:lang="en">({0}) parsing {1} ...</value> + <value xml:lang="zh">({0}) æ£å¨è§£æ {1} ...</value> + </property> + <property key="StartCheckPricatVersion"> + <value xml:lang="en">Check PriCat file's version ... </value> + <value xml:lang="zh">æ£æ¥ä»·æ ¼åç±»æ件ççæ¬ ... </value> + </property> + <property key="StartCheckCurrencyId"> + <value xml:lang="en">Checking currencyId ... </value> + <value xml:lang="zh">æ£å¨æ£æ¥å¸ç§ ... </value> + </property> + <property key="CurrencyIdRequired"> + <value xml:lang="en">CurrencyId is required. Please set it at row 3 column 2.</value> + <value xml:lang="zh">å¿ é¡»è®¾ç½®è´§å¸ã请设置å¨ç¬¬ä¸è¡ã第äºåã</value> + </property> + <property key="CurrencyIdIs"> + <value xml:lang="en">CurrencyId is {0}</value> + <value xml:lang="zh">è´§å¸æ¯{0}</value> + </property> + <property key="CurrencyIdNotFound"> + <value xml:lang="en">CurrencyId {0} cannot be found in this system.</value> + <value xml:lang="zh">æ¬ç³»ç»ä¸æ¾ä¸å°è´§å¸{0}ã</value> + </property> + <property key="CurrencyIdNotCurrency"> + <value xml:lang="en">{0} is not a currency in this system.</value> + <value xml:lang="zh">{0}å¨è¿ä¸ªç³»ç»éä¸æ¯è´§å¸ã</value> + </property> + <property key="HeaderContainsError"> + <value xml:lang="en">There are errors in PriCat header. Please correct it and upload it again.</value> + <value xml:lang="zh">表头ä¸æé误ï¼è¯·ä¿®æ¹åéæ°ä¸ä¼ ã</value> + </property> + <property key="PricatNoDataRows"> + <value xml:lang="en">There are no data in your PriCat file, no further operation is required.</value> + <value xml:lang="zh">ä½ çä»·æ ¼åç±»æ件ä¸æ²¡ææ°æ®ï¼ä¸ååæ°æ®è§£æäºã</value> + </property> + <property key="DataContainsError"> + <value xml:lang="en">There are errors in data of your PriCat file. Please correct it and upload it again.</value> + <value xml:lang="zh">ä»·æ ¼åç±»æ件çæ°æ®ä¸æé误ï¼è¯·ä¿®æ¹åéæ°ä¸ä¼ ã</value> + </property> + <property key="CellTypeNotString"> + <value xml:lang="en">The type of cell[{0}, {1}] is not String. The cell value will be changed to String type.</value> + <value xml:lang="zh">åå æ ¼[{0}, {1}]ä¸æ¯å符类åãå°æè¿ä¸ªåå æ ¼çå¼è½¬ä¸ºå符类åã</value> + </property> + <property key="CellTypeNotNumeric"> + <value xml:lang="en">The type of cell[{0}, {1}] is not numeric. The cell value will be changed to numeric type.</value> + <value xml:lang="zh">åå æ ¼[{0}, {1}]ä¸æ¯æ°åç±»åãå°æè¿ä¸ªåå æ ¼çå¼è½¬ä¸ºæ°åç±»åã</value> + </property> + <property key="ErrorParseValueToNumeric"> + <value xml:lang="en">Unable to parse the value to a numeric.</value> + <value xml:lang="zh">æ æ³æè¿ä¸ªåå æ ¼çå¼è½¬ä¸ºæ°åã</value> + </property> + <property key="StartCheckHeaderColNum"> + <value xml:lang="en">Checking whether the number of header columns matches the template's of version {0} ... </value> + <value xml:lang="zh">æ£å¨æ£æ¥è¡¨å¤´çåæ°æ¯å¦ä¸çæ¬{0}ç模æ¿ä¸è´ ... </value> + </property> + <property key="HeaderColNumNotMatch"> + <value xml:lang="en">The number of columns of {0} template header columns, column number {1} and imported template columns are not consistent ... </value> + <value xml:lang="zh">模æ¿è¡¨å¤´çåæ°{0}å,ä¸å¯¼å ¥ç模æ¿çåæ°{1}åä¸ä¸è´ ... </value> + </property> + <property key="StartCheckHeaderColLabel"> + <value xml:lang="en">Checking whether the header labels match the template's of version {0} ... </value> + <value xml:lang="zh">æ£å¨æ£æ¥è¡¨å¤´çæåæ¯å¦ä¸çæ¬{0}ç模æ¿ä¸è´ ... </value> + </property> + <property key="HeaderColLabelNotMatch"> + <value xml:lang="en">The lable of row {0} colum {1} is [{2}], it does not match [{3}] as expected.</value> + <value xml:lang="zh">è¡{0}å{1}çæåæ¯[{2}]ï¼ä¸ææç[{3}]ä¸ä¸è´ã</value> + </property> + <property key="HeaderColNumShortThanRequired"> + <value xml:lang="en">Table header column number less than the required {0}</value> + <value xml:lang="zh">表头åæ°å°äºè¦æ±ç{0}å</value> + </property> + <property key="UseHeaderColNum"> + <value xml:lang="en">the first {0} column labels will be checked</value> + <value xml:lang="zh">å°æ£æ¥è¡¨å¤´çå{0}åçæ ç¾</value> + </property> + <property key="WriteCommentsBackToExcel"> + <value xml:lang="en">Writing errors as commonts to your Excel file ... </value> + <value xml:lang="zh">æ£å¨æé误信æ¯ä½ä¸ºæ¹æ³¨åå°ä½ çExcelæ件é ... </value> + </property> + <property key="CLEANUP_LOGANDEXCEL_BEGIN"> + <value xml:lang="en">Start to clean log and commented excel files</value> + <value xml:lang="zh">å¼å§æ¸ çæ¥å¿åæ¹æ³¨è¿çExcelæ件</value> + </property> + <property key="HistoryLessThan"> + <value xml:lang="en">history entries less than {0}</value> + <value xml:lang="zh">åå²è®°å½å°äº{0}æ¡</value> + </property> + <property key="HistoryEntryToRemove"> + <value xml:lang="en">{0} entries to remove</value> + <value xml:lang="zh">è¦å é¤{0}æ¡è®°å½</value> + </property> + <property key="FacilityNameNotMatchId"> + <value xml:lang="en">In the system, the name of facilityId[{0}] is [{1}], NOT [{2}]. Please correct it and import again.</value> + <value xml:lang="zh">ç³»ç»ä¸ï¼ä»åºæ è¯[{0}]çå称æ¯[{1}]ï¼ä¸æ¯[{2}]ã请修æ¹åéæ°å¯¼å ¥ã</value> + </property> + <property key="ExcelEmptyRow"> + <value xml:lang="en">empty row</value> + <value xml:lang="zh">空è¡</value> + </property> + + <property key="REPORT_EXCEPTION"> + <value xml:lang="en">Exception: </value> + <value xml:lang="zh">æå¤é误ï¼</value> + </property> + <property key="DIALOG_BUTTON_OK"> + <value xml:lang="en">OK</value> + <value xml:lang="zh">ç¡®å®</value> + </property> + <property key="DIALOG_BUTTON_CANCEL"> + <value xml:lang="en">Cancel</value> + <value xml:lang="zh">åæ¶</value> + </property> + <property key="DIALOG_BUTTON_EDIT"> + <value xml:lang="en">Edit</value> + <value xml:lang="zh">ç¼è¾</value> + </property> + <property key="DIALOG_BUTTON_DISCARD"> + <value xml:lang="en">Discard</value> + <value xml:lang="zh">æ¾å¼</value> + </property> + <property key="DIALOG_BUTTON_CLOSE"> + <value xml:lang="en">Close</value> + <value xml:lang="zh">å ³é</value> + </property> + <property key="DIALOG_BUTTON_ADVANCE"> + <value xml:lang="en">Advance</value> + <value xml:lang="zh">é«çº§</value> + </property> + <property key="DIALOG_BUTTON_SET"> + <value xml:lang="en">Set</value> + <value xml:lang="zh">设置</value> + </property> + <property key="DIALOG_BUTTON_BACK"> + <value xml:lang="en">Back</value> + <value xml:lang="zh">è¿å</value> + </property> + <property key="DIALOG_BUTTON_CONTINUE"> + <value xml:lang="en">Continue</value> + <value xml:lang="zh">继ç»</value> + </property> + <property key="DIALOG_BUTTON_DETAIL"> + <value xml:lang="en">Detail</value> + <value xml:lang="zh">详ç»</value> + </property> + <property key="DIALOG_BUTTON_DOWNLOAD"> + <value xml:lang="en">Download</value> + <value xml:lang="zh">ä¸è½½</value> + </property> + <property key="FORMAT_DEFAULT"> + <value xml:lang="en">({0}) This is default format.</value> + <value xml:lang="zh">({0}) è¿æ¯ç¼ºçæ ¼å¼ã</value> + </property> + <property key="FORMAT_WARNING"> + <value xml:lang="en">({0}) This is warning format.</value> + <value xml:lang="zh">({0}) è¿æ¯è¦åæ ¼å¼ã</value> + </property> + <property key="FORMAT_HEADLINE"> + <value xml:lang="en">({0}) This is headline format.</value> + <value xml:lang="zh">({0}) è¿æ¯æ é¢æ ¼å¼ã</value> + </property> + <property key="FORMAT_NOTE"> + <value xml:lang="en">({0}) This is note format.</value> + <value xml:lang="zh">({0}) è¿æ¯è®°å½æ ¼å¼ã</value> + </property> + <property key="FORMAT_OK"> + <value xml:lang="en">({0}) This is OK format.</value> + <value xml:lang="zh">({0}) è¿æ¯æ£ç¡®æ¶çæ ¼å¼ã</value> + </property> + <property key="FORMAT_ERROR"> + <value xml:lang="en">({0}) This is error format.</value> + <value xml:lang="zh">({0}) è¿æ¯é误æ¶çæ ¼å¼ã</value> + </property> + <property key="FORMAT_THROWABLE"> + <value xml:lang="en">({0}) This is throwable format.</value> + <value xml:lang="zh">({0}) è¿æ¯æåºé误çæ ¼å¼ã</value> + </property> + <property key="START_COUNT_DOWN"> + <value xml:lang="en">Start counting down ...</value> + <value xml:lang="zh">å¼å§åæ° ...</value> + </property> + <property key="COUNT_COMPLETED"> + <value xml:lang="en">... counting completed.</value> + <value xml:lang="zh">... å®æ计æ°ã</value> + </property> + <property key="START_COUNT_UP"> + <value xml:lang="en">String counting up ...</value> + <value xml:lang="zh">å¼å§æ£è®¡æ° ...</value> + </property> + <property key="RPT_ERROR"> + <value xml:lang="en">Error: </value> + <value xml:lang="zh">é误ï¼</value> + </property> + <property key="RPT_ERROR_DETAILS"> + <value xml:lang="en">Details: </value> + <value xml:lang="zh">详ç»ï¼</value> + </property> + <property key="ParseExcelDemo"> + <value xml:lang="en">Click here to see Import Excel demo</value> + <value xml:lang="zh">ç¹å»è¿éçå¯¼å ¥Excelæ¼ç¤º</value> + </property> + <property key="StartParseExcel"> + <value xml:lang="en">Start parsing a sample excel file ...</value> + <value xml:lang="zh">å¼å§è§£æä¸ä¸ªExcelæ ·ä¾æ件 ...</value> + </property> + <property key="ExcelParseCompleted"> + <value xml:lang="en">... parsing completed</value> + <value xml:lang="zh">... å®æ解æ</value> + </property> + <property key="ExcelTableOnlyParse1stSheet"> + <value xml:lang="en">Only the 1st sheet will be parsed.</value> + <value xml:lang="zh">åªè§£æ第ä¸å¼ 表ã</value> + </property> + <property key="ExcelTableNoSheet"> + <value xml:lang="en">There's no sheet in the excel.</value> + <value xml:lang="zh">Excelä¸æ²¡æ表ã</value> + </property> + <property key="ExcelTableRows"> + <value xml:lang="en">Sheet {1} has {0} rows.</value> + <value xml:lang="zh">表å{1}æ{0}è¡æ°æ®ã</value> + </property> + <property key="ExcelTableRow"> + <value xml:lang="en">Sheet {0} has only 1 row.</value> + <value xml:lang="zh">表å{0}åªæä¸è¡æ°æ®ã</value> + </property> + <property key="ExcelTableNoRow"> + <value xml:lang="en">There's no row in sheet {0}.</value> + <value xml:lang="zh">表å{0}ä¸æ²¡ææ°æ®ã</value> + </property> + <property key="ExcelTableColumnNumberNotMatch"> + <value xml:lang="en">The sheet has {0} columns, it's not the same as sample sheet's {1}.</value> + <value xml:lang="zh">表åæ{0}åï¼ä¸æ ·ä¾è¡¨åç{1}åä¸åã</value> + </property> + <property key="ExcelTableColumnNotMatch"> + <value xml:lang="en">The column {0} has a name {1}, it's not identical to {2}.</value> + <value xml:lang="zh">å{0}çååæ¯{1}ï¼åºæ¯{2}ã</value> + </property> + <property key="ExcelParsingRow"> + <value xml:lang="en">({0}) parsing {1} ...</value> + <value xml:lang="zh">({0}) æ£å¨è§£æ {1} ...</value> + </property> + <property key="ParseExcelEncoding"> + <value xml:lang="en"> Using {0} to parsing the excel file.</value> + <value xml:lang="zh"> æ£å¨ä½¿ç¨{0}解æExcelæ件ã</value> + </property> + <property key="ParseExcelToolStatement"> + <value xml:lang="en"> Using {0} to parsing the {1} format excel file...</value> + <value xml:lang="zh"> æ£å¨ä½¿ç¨{0}解æ{1}æ ¼å¼çExcelæ件...</value> + </property> + <property key="ok"> + <value xml:lang="en">ok</value> + <value xml:lang="zh">å®æ</value> + </property> + <property key="error"> + <value xml:lang="en">error</value> + <value xml:lang="zh">åºéäº</value> + </property> + <property key="skipped"> + <value xml:lang="en">skipped</value> + <value xml:lang="zh">è·³è¿</value> + </property> + + <property key="ExcelImportHistoryList"> + <value xml:lang="en">Excel Import History</value> + <value xml:lang="zh">Excelå¯¼å ¥æä½åå²è®°å½</value> + </property> + <property key="OnlyYourOwnImportHistoryDisplayed"> + <value xml:lang="en">(Only current login user's history can be displayed)</value> + <value xml:lang="zh">ï¼ä» è½æ¾ç¤ºå½åç¨æ·çå¯¼å ¥æä½åå²è®°å½ï¼</value> + </property> + <property key="SerialNumber"> + <value xml:lang="en">No.</value> + <value xml:lang="zh">åºå·</value> + </property> + <property key="Filename"> + <value xml:lang="en">Filename</value> + <value xml:lang="zh">æ件å</value> + </property> + <property key="FromDate"> + <value xml:lang="en">Start Time</value> + <value xml:lang="zh">å¼å§æ¶é´</value> + </property> + <property key="ThruDate"> + <value xml:lang="en">End Time</value> + <value xml:lang="zh">ç»ææ¶é´</value> + </property> + <property key="ThruReasonId"> + <value xml:lang="en">End Reason</value> + <value xml:lang="zh">ç»æåå </value> + </property> + <property key="ImportStatus"> + <value xml:lang="en">Import Status</value> + <value xml:lang="zh">å¯¼å ¥ç¶æ</value> + </property> + <property key="Actions"> + <value xml:lang="en">Actions</value> + <value xml:lang="zh">æä½</value> + </property> + <property key="ExcelImportTipNoData"> + <value xml:lang="en">No excel import history data.</value> + <value xml:lang="zh">没æExcelå¯¼å ¥åå²è®°å½</value> + </property> + <property key="EXCEL_IMPORTING"> + <value xml:lang="en">Importing</value> + <value xml:lang="zh">æ£å¨å¯¼å ¥</value> + </property> + <property key="EXCEL_IMPORTED"> + <value xml:lang="en">Imported</value> + <value xml:lang="zh">å·²å¯¼å ¥</value> + </property> + <property key="EXCEL_IMPORT_SUCCESS"> + <value xml:lang="en">Success</value> + <value xml:lang="zh">æå</value> + </property> + <property key="EXCEL_IMPORT_STOPPED"> + <value xml:lang="en">Stopped by user</value> + <value xml:lang="zh">ç¨æ·ç»æ¢äºå¯¼å ¥</value> + </property> + <property key="EXCEL_IMPORT_ERROR"> + <value xml:lang="en">Stopped by error</value> + <value xml:lang="zh">å åºéèåæ¢äºå¯¼å ¥</value> + </property> + <property key="EXCEL_IMPORT_QUEST"> + <value xml:lang="en">Data error found</value> + <value xml:lang="zh">æ°æ®ä¸æé误</value> + </property> + <property key="ViewExcelImportLogContent"> + <value xml:lang="en">View log content</value> + <value xml:lang="zh">æµè§æ¥å¿å 容</value> + </property> + <property key="DownloadCommentedExcel"> + <value xml:lang="en">Download excel</value> + <value xml:lang="zh">ä¸è½½Excel</value> + </property> + <property key="ViewExcelImportHistory"> + <value xml:lang="en">View Import History</value> + <value xml:lang="zh">å¯¼å ¥æä½åå²è®°å½</value> + </property> + <property key="ViewPricatLog"> + <value xml:lang="en">View</value> + <value xml:lang="zh">æµè§</value> + </property> + <property key="DownloadCommentedPricat"> + <value xml:lang="en">Download</value> + <value xml:lang="zh">ä¸è½½</value> + </property> + + <property key="ReasonOK"> + <value xml:lang="en">OK</value> + </property> + <property key="ReasonStopped"> + <value xml:lang="en">[S]</value> + </property> + <property key="ReasonError"> + <value xml:lang="en">[E]</value> + </property> + <property key="ReasonWarning"> + <value xml:lang="en">[W]</value> + </property> +</resource> Added: ofbiz/trunk/specialpurpose/pricat/config/pricat.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/config/pricat.properties?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/config/pricat.properties (added) +++ ofbiz/trunk/specialpurpose/pricat/config/pricat.properties Mon Nov 21 08:07:57 2016 @@ -0,0 +1,24 @@ +############################################################################### +# 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. +############################################################################### + +# the latest pricat version to parse and download +pricat.latest.version=V1.1 + +# the max number of pricat history files to keep +pricat.history.max.filenumber=20 Added: ofbiz/trunk/specialpurpose/pricat/data/PricatData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/data/PricatData.xml?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/data/PricatData.xml (added) +++ ofbiz/trunk/specialpurpose/pricat/data/PricatData.xml Mon Nov 21 08:07:57 2016 @@ -0,0 +1,34 @@ +<?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> + <!-- Enumeration for thruReasonId of ExcelImportHistory entity --> + <EnumerationType description="Excel import thru reasons" enumTypeId="EXCEL_IMPORT_THRU" hasTable="N" parentTypeId=""/> + + <Enumeration enumId="EXCEL_IMPORT_SUCCESS" enumCode="EXCEL_IMPORT_SUCCESS" description="Excel Imported Successfully" sequenceId="01" enumTypeId="EXCEL_IMPORT_THRU"/> + <Enumeration enumId="EXCEL_IMPORT_STOPPED" enumCode="EXCEL_IMPORT_STOPPED" description="Excel Imported Stopped by user" sequenceId="02" enumTypeId="EXCEL_IMPORT_THRU"/> + <Enumeration enumId="EXCEL_IMPORT_ERROR" enumCode="EXCEL_IMPORT_ERROR" description="Excel Imported Exits Errorly" sequenceId="03" enumTypeId="EXCEL_IMPORT_THRU"/> + <Enumeration enumId="EXCEL_IMPORT_QUEST" enumCode="EXCEL_IMPORT_QUEST" description="Excel Imported Has Error Messages" sequenceId="04" enumTypeId="EXCEL_IMPORT_THRU"/> + + <!-- Enumeration for statusId of ExcelImportHistory entity --> + <EnumerationType description="Excel import status" enumTypeId="EXCEL_IMPORT_STATUS" hasTable="N" parentTypeId=""/> + + <Enumeration enumId="EXCEL_IMPORTING" enumCode="EXCEL_IMPORTING" description="Excel is being imported in progress" sequenceId="01" enumTypeId="EXCEL_IMPORT_STATUS"/> + <Enumeration enumId="EXCEL_IMPORTED" enumCode="EXCEL_IMPORTED" description="Excel has been imported" sequenceId="02" enumTypeId="EXCEL_IMPORT_STATUS"/> +</entity-engine-xml> Added: ofbiz/trunk/specialpurpose/pricat/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/entitydef/entitymodel.xml?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/entitydef/entitymodel.xml (added) +++ ofbiz/trunk/specialpurpose/pricat/entitydef/entitymodel.xml Mon Nov 21 08:07:57 2016 @@ -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. +--> +<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd"> + + <entity entity-name="ExcelImportHistory" + package-name="org.ofbiz.product.catalog" + title="Excel Import History Entity"> + <field name="userLoginId" type="id-vlong-ne"></field> + <field name="sequenceNum" type="numeric"></field> + <field name="fileName" type="value"></field> + <field name="fromDate" type="date-time"></field> + <field name="thruDate" type="date-time"></field> + <field name="thruReasonId" type="id-ne"></field> + <field name="statusId" type="id-ne"></field> + <field name="threadName" type="name"></field> + <field name="logFileName" type="value"></field> + <prim-key field="userLoginId"/> + <prim-key field="sequenceNum"/> + <relation rel-entity-name="UserLogin" type="one" fk-name="EXCELIMPORT_USERLOGIN"> + <key-map field-name="userLoginId"/> + </relation> + <relation rel-entity-name="Enumeration" type="one" fk-name="EXCELIMPORT_STATUS"> + <key-map field-name="statusId" rel-field-name="enumId"/> + </relation> + <relation rel-entity-name="Enumeration" type="one" fk-name="EXCELIMPORT_REASON"> + <key-map field-name="thruReasonId" rel-field-name="enumId"/> + </relation> + </entity> + +</entitymodel> Added: ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImport.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImport.groovy?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImport.groovy (added) +++ ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImport.groovy Mon Nov 21 08:07:57 2016 @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import org.apache.ofbiz.base.util.*; + +module = "FindMyExcelImport.groovy"; + +data = delegator.findByAnd("ExcelImportHistory", [userLoginId : userLogin.userLoginId], ["sequenceNum DESC"], false); +context.data = data; Added: ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImportLog.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImportLog.groovy?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImportLog.groovy (added) +++ ofbiz/trunk/specialpurpose/pricat/groovyScripts/pricat/FindMyExcelImportLog.groovy Mon Nov 21 08:07:57 2016 @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import org.apache.ofbiz.base.util.*; +import java.io.FileInputStream; + +module = "FindMyExcelImport.groovy"; + +context.borderStyle = "2px inset /*begin-color ThreeDHighlight*/#ffffff/*end-color*/"; +context.borderSimpleStyle = "2px solid /*begin-color ThreeDFace*/#f0f0f0/*end-color*/"; + +sequenceNum = request.getParameter("sequenceNum"); + +if (sequenceNum == null) { + context.logFileContent = "No sequenceNum parameter found."; + return; +} + +historyEntry = delegator.findOne("ExcelImportHistory", [sequenceNum : Long.valueOf(sequenceNum), userLoginId : userLogin.userLoginId], false); +if (historyEntry == null) { + context.logFileContent = "No import history found."; + return; +} + +logFile = FileUtil.getFile("runtime/pricat/" + userLogin.userLoginId + "/" + sequenceNum + ".log"); +if (!logFile.exists()) { + context.logFileContent = "No log file found."; +} + +FileInputStream fis = new FileInputStream(logFile); +InputStreamReader isr = new InputStreamReader(fis); +BufferedReader br = new BufferedReader(isr); +logFileContent = ""; +while((s = br.readLine())!=null){ + logFileContent += s; +} +context.logFileContent = logFileContent; + Added: ofbiz/trunk/specialpurpose/pricat/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/ofbiz-component.xml?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/ofbiz-component.xml (added) +++ ofbiz/trunk/specialpurpose/pricat/ofbiz-component.xml Mon Nov 21 08:07:57 2016 @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<ofbiz-component name="pricat" enabled="true" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-component.xsd"> + <resource-loader name="main" type="component"/> + <classpath type="dir" location="config"/> + + <!-- entity resources: model(s), eca(s), group, and data definitions --> + <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> + <entity-resource type="data" reader-name="seed" loader="main" location="data/PricatData.xml"/> + + <webapp name="pricat" + title="PriCat" + server="default-server" + location="webapp/pricat" + app-bar-display="false" + base-permission="OFBTOOLS,CATALOG" + mount-point="/pricat" /> + + <webapp name="pricatdemo" + title="PriCat Demo" + server="default-server" + location="webapp/pricatdemo" + app-bar-display="false" + base-permission="OFBTOOLS,EXAMPLE" + mount-point="/pricatdemo" /> +</ofbiz-component> Added: ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java (added) +++ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java Mon Nov 21 08:07:57 2016 @@ -0,0 +1,144 @@ +/******************************************************************************* + * 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.apache.ofbiz.htmlreport; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspException; + +import org.apache.ofbiz.htmlreport.util.ReportStringUtil; + +/** + * HTML report output to be used for database create tables / drop tables operations. + * + */ +public abstract class AbstractHtmlReport extends HtmlReport { + + public static final String module = AbstractHtmlReport.class.getName(); + + public final static String THREAD_TYPE = "thread_type"; + + public final static String RUN_CREATETABLE_SCRIPT = "runcreatetablescript"; + + public final static String RUN_DROPTABLE_SCRIPT = "rundroptablescript"; + + public final static String FILE_REPORT_OUTPUT = "specialpurpose/pricat/webapp/pricat/ftl/report.ftl"; + + /** + * Constructs a new report using the provided locale for the output language. + * + * @param request HttpServletRequest + * @param response HttpServletResponse + */ + public AbstractHtmlReport(HttpServletRequest request, HttpServletResponse response) { + this(request, response, false, false); + } + + /** + * Constructs a new report using the provided locale for the output language. + * + * @param request HttpServletRequest + * @param response HttpServletResponse + * @param writeHtml if <code>true</code>, this report should generate HTML instead of JavaScript output + * @param isTransient If set to <code>true</code> nothing is kept in memory + */ + public AbstractHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) { + super(request, response, writeHtml, isTransient); + } + + /** + * Prepare display an html report.<p> + * + * @throws JspException if dialog actions fail + * @throws IOException + * @throws ServletException + * @throws TemplateException + * @throws IOException + */ + public void prepareDisplayReport(HttpServletRequest request, HttpServletResponse response, String name, String dialogUri) throws IOException { + + if (ReportStringUtil.isNotEmpty(dialogUri)) { + setDialogRealUri(request, dialogUri); + } + + String action = getParamAction(request); + if (action == null) action = ""; + if (action.equals("reportend") || action.equals("cancel")) { + setParamAction("reportend"); + } else if (action.equals("reportupdate")) { + setParamAction("reportupdate"); + } else { + InterfaceReportThread thread = initializeThread(request, response, name); + thread.start(); + setParamAction("reportbegin"); + setParamThread(thread.getUUID().toString()); + } + } + + /** + * Initializes the report thread to use for this report.<p> + * + * @return the reported thread to use for this report. + */ + public abstract InterfaceReportThread initializeThread(HttpServletRequest request, HttpServletResponse response, String name); + + /** + * Set the report dialog uri. + * + * @param dialogUri + */ + public void setDialogRealUri(HttpServletRequest request, String dialogUri) { + request.setAttribute(DIALOG_URI, dialogUri); + } + + public static String checkButton(HttpServletRequest request, HttpServletResponse response) { + String action = request.getParameter("action"); + if (ReportStringUtil.isNotEmpty(action)) { + if (action.equalsIgnoreCase("ok")) { + request.removeAttribute(SESSION_REPORT_CLASS); + request.removeAttribute(DIALOG_URI); + return "ok"; + } else if (action.equalsIgnoreCase("cancel")) { + request.removeAttribute(SESSION_REPORT_CLASS); + request.removeAttribute(DIALOG_URI); + return "cancel"; + } + } + action = request.getParameter("ok"); + if (ReportStringUtil.isNotEmpty(action)) { + if (action.equalsIgnoreCase("ok")) { + request.removeAttribute(SESSION_REPORT_CLASS); + request.removeAttribute(DIALOG_URI); + return "ok"; + } + } + action = request.getParameter("cancel"); + if (ReportStringUtil.isNotEmpty(action)) { + if (action.equalsIgnoreCase("cancel")) { + request.removeAttribute(SESSION_REPORT_CLASS); + request.removeAttribute(DIALOG_URI); + return "cancel"; + } + } + + return "success"; + } +} \ No newline at end of file Added: ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java (added) +++ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java Mon Nov 21 08:07:57 2016 @@ -0,0 +1,187 @@ +/******************************************************************************* + * 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.apache.ofbiz.htmlreport; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +/** + * Base report class. + * + */ +public abstract class AbstractReport implements InterfaceReport { + + /** Contains all error messages generated by the report. */ + private List<Object> errors; + + /** The locale this report is written in. */ + private Locale locale; + + /** Runtime of the report. */ + private long startTime; + + /** Contains all warning messages generated by the report. */ + private List<Object> warnings = new ArrayList<Object>(); + + /** Day constant. */ + private static final long DAYS = 1000 * 60 * 60 * 24; + + /** Hour constant. */ + private static final long HOURS = 1000 * 60 * 60; + + /** Minute constant. */ + private static final long MINUTES = 1000 * 60; + + /** Second constant. */ + private static final long SECONDS = 1000; + + public static final String SESSION_REPORT_CLASS = "OFBIZ_HTML_REPORT"; + + public void addError(Object obj) { + + errors.add(obj); + } + + public void addWarning(Object obj) { + + warnings.add(obj); + } + + public String formatRuntime() { + + long runtime = getRuntime(); + long seconds = (runtime / SECONDS) % 60; + long minutes = (runtime / MINUTES) % 60; + long hours = (runtime / HOURS) % 24; + long days = runtime / DAYS; + StringBuffer strBuf = new StringBuffer(); + + if (days > 0) { + if (days < 10) { + strBuf.append('0'); + } + strBuf.append(days); + strBuf.append(':'); + } + + if (hours < 10) { + strBuf.append('0'); + } + strBuf.append(hours); + strBuf.append(':'); + + if (minutes < 10) { + strBuf.append('0'); + } + strBuf.append(minutes); + strBuf.append(':'); + + if (seconds < 10) { + strBuf.append('0'); + } + strBuf.append(seconds); + + return strBuf.toString(); + } + + public List<Object> getErrors() { + return errors; + } + + public Locale getLocale() { + return locale; + } + + public long getRuntime() { + return System.currentTimeMillis() - startTime; + } + + public List<Object> getWarnings() { + return warnings; + } + + public boolean hasError() { + return (errors.size() > 0); + } + + public boolean hasWarning() { + return (warnings.size() > 0); + } + + public void resetRuntime() { + startTime = System.currentTimeMillis(); + } + + /** + * Initializes some member variables for this report.<p> + * + * @param locale the locale for this report + */ + protected void init(Locale locale) { + startTime = System.currentTimeMillis(); + this.locale = locale; + errors = new ArrayList<Object>(); + } + + /** + * Prints a String to the report.<p> + * + * @param value the String to add + */ + public void print(String value) { + print(value, FORMAT_DEFAULT); + } + + /** + * Prints a String to the report, using the indicated formatting.<p> + * + * Use the contants starting with <code>FORMAT</code> from this interface + * to indicate which formatting to use.<p> + * + * @param value the message container to add + * @param format the formatting to use for the output + */ + public abstract void print(String value, int format); + + /** + * Prints a String with line break to the report.<p> + * + * @param value the message container to add + */ + public void println(String value) { + + println(value, FORMAT_DEFAULT); + } + + /** + * Prints a String with line break to the report, using the indicated formatting.<p> + * + * Use the contants starting with <code>FORMAT</code> from this interface + * to indicate which formatting to use.<p> + * + * @param value the String to add + * @param format the formatting to use for the output + */ + public void println(String value, int format) { + print(value, format); + println(); + } + +} \ No newline at end of file Added: ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java?rev=1770621&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java (added) +++ ofbiz/trunk/specialpurpose/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java Mon Nov 21 08:07:57 2016 @@ -0,0 +1,217 @@ +/******************************************************************************* + * 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.apache.ofbiz.htmlreport; + +import java.util.List; +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.ofbiz.base.util.UtilHttp; +import org.safehaus.uuid.EthernetAddress; +import org.safehaus.uuid.UUID; +import org.safehaus.uuid.UUIDGenerator; + +/** + * Provides a common Thread class for the reports. + * + */ +public abstract class AbstractReportThread extends Thread implements InterfaceReportThread { + + /** Indicates if the thread was already checked by the grim reaper. */ + private boolean doomed; + + /** The report that belongs to the thread. */ + private InterfaceReport report; + + /** The time this report is running. */ + private long startTime; + + private UUID uuid; + + private Locale locale; + + /** + * Constructs a new report Thread with the given name.<p> + * + * @param name the name of the Thread + */ + protected AbstractReportThread(HttpServletRequest request, HttpServletResponse response, String name) { + + super(Thread.currentThread().getThreadGroup(), name); + // report Threads are never daemon Threads + setDaemon(false); + // the session must not be updated when it is used in a report + EthernetAddress ethernetAddress = UUIDGenerator.getInstance().getDummyAddress(); + uuid = UUIDGenerator.getInstance().generateTimeBasedUUID(ethernetAddress); + + setName(name + " [" + uuid.toString() + "]"); + // new Threads are not doomed + doomed = false; + // set start time + startTime = System.currentTimeMillis(); + locale = UtilHttp.getLocale(request); + } + + + public UUID getUUID() { + return uuid; + } + + /** + * Adds an error object to the list of errors that occured during the report.<p> + * + * @param obj the error object + */ + public void addError(Object obj) { + + if (getReport() != null) { + getReport().addError(obj); + } + } + + /** + * Returns the error exception in case there was an error during the execution of + * this Thread, null otherwise.<p> + * + * @return the error exception in case there was an error, null otherwise + */ + public Throwable getError() { + + return null; + } + + /** + * Returns a list of all errors that occured during the report.<p> + * + * @return an error list that occured during the report + */ + public List<?> getErrors() { + + if (getReport() != null) { + return getReport().getErrors(); + } else { + return null; + } + } + + /** + * Returns the part of the report that is ready for output.<p> + * + * @return the part of the report that is ready for output + */ + public abstract String getReportUpdate(); + + /** + * Returns the time this report has been running.<p> + * + * @return the time this report has been running + */ + public synchronized long getRuntime() { + + if (doomed) { + return startTime; + } else { + return System.currentTimeMillis() - startTime; + } + } + + /** + * Returns if the report generated an error output.<p> + * + * @return true if the report generated an error, otherwise false + */ + public boolean hasError() { + + if (getReport() != null) { + return (getReport().getErrors().size() > 0); + } else { + return false; + } + } + + /** + * Returns true if this thread is already "doomed" to be deleted.<p> + * + * A OFBiz deamon Thread (the "Grim Reaper") will collect all + * doomed Threads, i.e. threads that are not longer active for some + * time.<p> + * + * @return true if this thread is already "doomed" to be deleted + */ + public synchronized boolean isDoomed() { + + if (isAlive()) { + // as long as the Thread is still active it is never doomed + return false; + } + if (doomed) { + // not longer active, and already doomed, so rest in peace... + return true; + } + // condemn the Thread to be collected by the grim reaper next time + startTime = getRuntime(); + doomed = true; + return false; + } + + /** + * Returns the report where the output of this Thread is written to.<p> + * + * @return the report where the output of this Thread is written to + */ + protected InterfaceReport getReport() { + + return report; + } + + /** + * Initialize a HTML report for this Thread.<p> + * + * @param locale the locale for the report output messages + */ + protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response) { + + report = HtmlReport.getInstance(request, response); + ((HtmlReport) report).setParamThread(getUUID().toString()); + } + + /** + * Initialize a HTML report for this Thread.<p> + * + * @param locale the locale for the report output messages + */ + protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) { + + report = HtmlReport.getInstance(request, response, writeHtml, isTransient); + ((HtmlReport) report).setParamThread(getUUID().toString()); + } + + protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, String logFileName) { + + report = HtmlReport.getInstance(request, response, writeHtml, isTransient, logFileName); + ((HtmlReport) report).setParamThread(getUUID().toString()); + } + + protected Locale getLocale() { + return locale; + } + +} |
Free forum by Nabble | Edit this page |