📄 xmldsdump.jsp
字号:
<%-- * Copyright (c) 2001 The Open For Business Project - www.ofbiz.org * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * @author David E. Jones (jonesde@ofbiz.org) * @version 1.0--%><%@ page import="java.util.*, java.io.*, java.net.*, org.ofbiz.base.util.collections.OrderedSet" %><%@ page import="org.w3c.dom.*" %><%@ page import="org.ofbiz.security.*, org.ofbiz.entity.*, org.ofbiz.base.util.*, org.ofbiz.webapp.pseudotag.*" %><%@ page import="org.ofbiz.entity.model.*, org.ofbiz.entity.util.*, org.ofbiz.entity.transaction.*, org.ofbiz.entity.condition.*" %><%@ taglib uri="ofbizTags" prefix="ofbiz" %><jsp:useBean id="security" type="org.ofbiz.security.Security" scope="request" /><jsp:useBean id="delegator" type="org.ofbiz.entity.GenericDelegator" scope="request" /><jsp:useBean id="dispatcher" type="org.ofbiz.service.LocalDispatcher" scope="request" /><% String outpath = request.getParameter("outpath"); String filename = request.getParameter("filename"); String maxRecStr = request.getParameter("maxrecords"); String entitySyncId = request.getParameter("entitySyncId"); String[] entityName = request.getParameterValues("entityName"); String entityFrom = request.getParameter("entityFrom"); String entityThru = request.getParameter("entityThru"); // get the max records per file setting and convert to a int int maxRecordsPerFile = 0; if (UtilValidate.isNotEmpty(maxRecStr)) { try { maxRecordsPerFile = Integer.parseInt(maxRecStr); } catch (Exception e) { } } Set passedEntityNames = new TreeSet(); if (entityName != null && entityName.length > 0) { for(int inc=0; inc<entityName.length; inc++) { passedEntityNames.add(entityName[inc]); } } String preConfiguredSetName = request.getParameter("preConfiguredSetName"); if ("Product1".equals(preConfiguredSetName)) { passedEntityNames = new OrderedSet(); passedEntityNames.add("DataResource"); passedEntityNames.add("Facility"); passedEntityNames.add("ProdCatalog"); passedEntityNames.add("Product"); passedEntityNames.add("ProductCategory"); passedEntityNames.add("ProductFeatureCategory"); passedEntityNames.add("ProductFeatureType"); passedEntityNames.add("ProductPriceRule"); passedEntityNames.add("ProductPromo"); } else if ("Product2".equals(preConfiguredSetName)) { passedEntityNames = new OrderedSet(); passedEntityNames.add("Content"); passedEntityNames.add("ElectronicText"); passedEntityNames.add("FacilityLocation"); passedEntityNames.add("ProdCatalogCategory"); passedEntityNames.add("ProdCatalogRole"); passedEntityNames.add("ProductAssoc"); passedEntityNames.add("ProductAttribute"); passedEntityNames.add("ProductCategoryMember"); passedEntityNames.add("ProductCategoryRollup"); passedEntityNames.add("ProductFacility"); passedEntityNames.add("ProductFeature"); passedEntityNames.add("ProductFeatureCategoryAppl"); passedEntityNames.add("ProductKeyword"); passedEntityNames.add("ProductPrice"); passedEntityNames.add("ProductPriceAction"); passedEntityNames.add("ProductPriceCond"); passedEntityNames.add("ProductPromoCode"); passedEntityNames.add("ProductPromoCategory"); passedEntityNames.add("ProductPromoProduct"); passedEntityNames.add("ProductPromoRule"); } else if ("Product3".equals(preConfiguredSetName)) { passedEntityNames = new OrderedSet(); passedEntityNames.add("ProdCatalogInvFacility"); passedEntityNames.add("ProductContent"); passedEntityNames.add("ProductFacilityLocation"); passedEntityNames.add("ProductFeatureAppl"); passedEntityNames.add("ProductFeatureDataResource"); passedEntityNames.add("ProductFeatureGroup"); passedEntityNames.add("ProductPriceChange"); passedEntityNames.add("ProductPromoAction"); passedEntityNames.add("ProductPromoCodeEmail"); passedEntityNames.add("ProductPromoCodeParty"); passedEntityNames.add("ProductPromoCond"); } else if ("Product4".equals(preConfiguredSetName)) { passedEntityNames = new OrderedSet(); passedEntityNames.add("InventoryItem"); passedEntityNames.add("ProductFeatureCatGrpAppl"); passedEntityNames.add("ProductFeatureGroupAppl"); } else if ("CatalogExport".equals(preConfiguredSetName)) { passedEntityNames = new OrderedSet(); passedEntityNames.add("ProdCatalogCategoryType"); passedEntityNames.add("ProdCatalog"); passedEntityNames.add("ProductCategoryType"); passedEntityNames.add("ProductCategory"); passedEntityNames.add("ProductCategoryRollup"); passedEntityNames.add("ProdCatalogCategory"); passedEntityNames.add("ProductFeatureType"); passedEntityNames.add("ProductFeatureCategory"); passedEntityNames.add("DataResource"); passedEntityNames.add("Content"); passedEntityNames.add("ElectronicText"); passedEntityNames.add("ProductType"); passedEntityNames.add("Product"); passedEntityNames.add("ProductAttribute"); passedEntityNames.add("GoodIdentificationType"); passedEntityNames.add("GoodIdentification"); passedEntityNames.add("ProductPriceType"); passedEntityNames.add("ProductPrice"); passedEntityNames.add("ProductPriceRule"); passedEntityNames.add("ProductPriceCond"); passedEntityNames.add("ProductPriceAction"); //passedEntityNames.add("ProductPriceChange"); passedEntityNames.add("ProductPromo"); passedEntityNames.add("ProductPromoCode"); passedEntityNames.add("ProductPromoCategory"); passedEntityNames.add("ProductPromoProduct"); passedEntityNames.add("ProductPromoRule"); passedEntityNames.add("ProductPromoAction"); passedEntityNames.add("ProductPromoCodeEmail"); passedEntityNames.add("ProductPromoCodeParty"); passedEntityNames.add("ProductPromoCond"); passedEntityNames.add("ProductCategoryMember"); passedEntityNames.add("ProductAssoc"); passedEntityNames.add("ProductContent"); passedEntityNames.add("ProductFeature"); passedEntityNames.add("ProductFeatureCategoryAppl"); passedEntityNames.add("ProductFeatureAppl"); passedEntityNames.add("ProductFeatureDataResource"); passedEntityNames.add("ProductFeatureGroup"); passedEntityNames.add("ProductFeatureCatGrpAppl"); passedEntityNames.add("ProductFeatureGroupAppl"); //passedEntityNames.add("ProductKeyword"); } if (UtilValidate.isNotEmpty(entitySyncId)) { passedEntityNames = org.ofbiz.entityext.synchronization.EntitySyncContext.getEntitySyncModelNamesToUse(dispatcher, entitySyncId); } boolean checkAll = "true".equals(request.getParameter("checkAll")); boolean tobrowser = request.getParameter("tobrowser")!=null?true:false; EntityExpr entityFromCond = null; EntityExpr entityThruCond = null; EntityExpr entityDateCond = null; if (UtilValidate.isNotEmpty(entityFrom)) { entityFromCond = new EntityExpr("lastUpdatedTxStamp", EntityComparisonOperator.GREATER_THAN, entityFrom); } if (UtilValidate.isNotEmpty(entityThru)) { entityThruCond = new EntityExpr("lastUpdatedTxStamp", EntityComparisonOperator.LESS_THAN, entityThru); } if ((entityFromCond!=null) && (entityThruCond!=null)) { entityDateCond = new EntityExpr(entityFromCond, EntityJoinOperator.AND, entityThruCond); } else if(entityFromCond!=null) { entityDateCond = entityFromCond; } else if(entityThruCond!=null) { entityDateCond = entityThruCond; } %><%if (tobrowser) { session.setAttribute("xmlrawdump_entitylist", entityName); session.setAttribute("entityDateCond", entityDateCond);%> <div class="head1">XML Export from DataSource(s)</div> <div class="tabletext">This page can be used to export data from the database. The exported documents will have a root tag of "<entity-engine-xml>".</div> <hr> <%if(security.hasPermission("ENTITY_MAINT", session)) {%> <a href="<ofbiz:url>/xmldsrawdump</ofbiz:url>" class="buttontext" target="_blank">Click Here to Get Data (or save to file)</a> <%} else {%> <div class="tabletext">You do not have permission to use this page (ENTITY_MAINT needed)</div> <%}%><%} else {%><% EntityFindOptions efo = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); ModelReader reader = delegator.getModelReader(); Collection ec = reader.getEntityNames(); TreeSet entityNames = new TreeSet(ec); int numberOfEntities = passedEntityNames.size(); long numberWritten = 0; // single file if(filename != null && filename.length() > 0 && numberOfEntities > 0) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -