You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2010/03/15 14:44:54 UTC
svn commit: r923223 [2/3] - in /ofbiz/trunk/specialpurpose:
ebay/webapp/ebay/find/ ebay/widget/ ebaystore/config/ ebaystore/entitydef/
ebaystore/servicedef/ ebaystore/src/org/ofbiz/ebaystore/
ebaystore/webapp/ebaystore/WEB-INF/ ebaystore/webapp/ebaysto...
Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java?rev=923223&r1=923222&r2=923223&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java Mon Mar 15 13:44:53 2010
@@ -21,27 +21,36 @@ package org.ofbiz.ebaystore;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import javolution.util.FastList;
import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.ebay.ProductsExportToEbay;
import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.GenericValue;
import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ServiceUtil;
import org.ofbiz.webapp.event.EventHandlerException;
+import com.ebay.sdk.ApiContext;
import com.ebay.sdk.ApiException;
import com.ebay.sdk.SdkException;
import com.ebay.sdk.SdkSoapException;
import com.ebay.sdk.call.GetStoreOptionsCall;
+import com.ebay.soap.eBLBaseComponents.CategoryType;
import com.ebay.soap.eBLBaseComponents.GetStoreOptionsRequestType;
import com.ebay.soap.eBLBaseComponents.GetStoreOptionsResponseType;
import com.ebay.soap.eBLBaseComponents.StoreColorSchemeType;
@@ -56,7 +65,9 @@ import net.sf.json.JSONObject;
public class EbayStoreOptions {
- public static String retrieveThemeColorSchemeByThemeId(HttpServletRequest request, HttpServletResponse response) {
+ private static final String module = EbayStoreOptions.class.getName();
+
+ public static String retrieveThemeColorSchemeByThemeId(HttpServletRequest request, HttpServletResponse response) {
Locale locale = UtilHttp.getLocale(request);
Delegator delegator = (Delegator) request.getAttribute("delegator");
GetStoreOptionsRequestType req = null;
@@ -157,4 +168,142 @@ public class EbayStoreOptions {
throw new EventHandlerException("Unable to get response writer", e);
}
}
+
+ public static String retrieveItemTemplateByTemplateGroupId(HttpServletRequest request,HttpServletResponse response) {
+ Map paramMap = UtilHttp.getCombinedMap(request);
+ try {
+ if (paramMap.get("productStoreId") != null) {
+ String temGroupId = (String)paramMap.get("templateGroupId");
+ Map<String,Object> addItemObj = EbayEvents.getAddItemListingObject(request, EbayEvents.getApiContext(request));
+ if (UtilValidate.isNotEmpty(addItemObj)) {
+ String refName = "itemCateFacade_".concat((String) paramMap.get("pkCategoryId"));
+ if (UtilValidate.isNotEmpty(addItemObj.get(refName))) {
+ EbayStoreCategoryFacade cf = (EbayStoreCategoryFacade) addItemObj.get(refName);
+ List<Map<String,Object>> theme = cf.getAdItemTemplates(temGroupId);
+ if (theme.size() > 0) {
+ toJsonObjectList(theme,response);
+ }
+ }
+ }
+ }
+ } catch (EventHandlerException e) {
+ Debug.logError(e.getMessage(), module);
+ }
+ return "success";
+ }
+
+ public static String retrieveEbayCategoryByParent(HttpServletRequest request, HttpServletResponse response) {
+ List<CategoryType> results = FastList.newInstance();
+ try {
+ Map paramMap = UtilHttp.getCombinedMap(request);
+ if (paramMap.get("productStoreId") != null) {
+ String ebayCategoryId = (String)paramMap.get("ebayCategoryId");
+ // when change category should be remove old category from session
+ if (ebayCategoryId.indexOf("CH_") != -1) {
+ ebayCategoryId = ebayCategoryId.replace("CH_", "");
+ if (UtilValidate.isNotEmpty(ebayCategoryId)) {
+ ApiContext apiContext = EbayEvents.getApiContext(request);
+ Map<String,Object> addItemObject = EbayEvents.getAddItemListingObject(request, apiContext);
+ String refName = "itemCateFacade_".concat(ebayCategoryId);
+ if (UtilValidate.isNotEmpty(addItemObject.get(refName))) {
+ addItemObject.remove(refName);
+ }
+ }
+ ebayCategoryId = "";
+ }
+ request.setAttribute("productStoreId", paramMap.get("productStoreId"));
+ request.setAttribute("categoryId", ebayCategoryId);
+ results = EbayEvents.getChildCategories(request);
+ if (UtilValidate.isNotEmpty(results)) {
+ List<Map<String,Object>> categories = FastList.newInstance();
+ for (CategoryType category : results) {
+ Map<String,Object> context = FastMap.newInstance();
+ context.put("CategoryCode", category.getCategoryID());
+ context.put("CategoryName", category.getCategoryName());
+ String isLeaf = String.valueOf(category.isLeafCategory()!= null ? category.isLeafCategory() : "false");
+ context.put("IsLeafCategory", isLeaf);
+ categories.add(context);
+ }
+ if (categories.size() > 0) {
+ toJsonObjectList(categories,response);
+ }
+ }
+ }
+ } catch (GenericServiceException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (EventHandlerException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (ApiException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (SdkException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (Exception e) {
+ Debug.logError(e.getMessage(), module);
+ }
+ return "success";
+ }
+
+ public static String retrieveEbayStoreCategoryByParent(HttpServletRequest request, HttpServletResponse response) {
+ LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
+ HttpSession session = request.getSession();
+ GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
+ Map<String,Object> result = FastMap.newInstance();
+ Map<String,Object> context = FastMap.newInstance();
+ try {
+ Map paramMap = UtilHttp.getCombinedMap(request);
+ if (paramMap.get("productStoreId") != null) {
+ String ebayCategoryId = (String)paramMap.get("ebayCategoryId");
+ context.put("productStoreId", paramMap.get("productStoreId"));
+ context.put("ebayStoreCategoryId", ebayCategoryId);
+ context.put("userLogin", userLogin);
+ result = dispatcher.runSync("getEbayStoreCategories", context);
+ if (result != null) {
+ List<Map<String,Object>> categories = (List<Map<String,Object>>) result.get("storeCategories");
+ if (categories.size()>0) {
+ toJsonObjectList(categories,response);
+ }
+ }
+ }
+ } catch (GenericServiceException e) {
+ Debug.logError(e.getMessage(), module);
+ } catch (EventHandlerException e) {
+ Debug.logError(e.getMessage(), module);
+ }
+ return "success";
+ }
+
+ public static void toJsonObjectList(List<Map<String,Object>> list, HttpServletResponse response) throws EventHandlerException {
+ JSONObject json = null;
+ List<JSONObject> jsonList = new ArrayList<JSONObject>();
+ if (list != null) {
+ for (Map<String,Object> val : list) {
+ json = new JSONObject();
+ for (String rowKey: val.keySet()) {
+ json.put(rowKey, val.get(rowKey));
+ }
+ jsonList.add(json);
+ }
+ String jsonStr = jsonList.toString();
+ if (jsonStr == null) {
+ throw new EventHandlerException("JSON Object was empty; fatal error!");
+ }
+ // set the X-JSON content type
+ response.setContentType("application/json");
+ // jsonStr.length is not reliable for unicode characters
+ try {
+ response.setContentLength(jsonStr.getBytes("UTF8").length);
+ } catch (UnsupportedEncodingException e) {
+ throw new EventHandlerException("Problems with Json encoding", e);
+ }
+ // return the JSON String
+ Writer out;
+ try {
+ out = response.getWriter();
+ out.write(jsonStr);
+ out.flush();
+ } catch (IOException e) {
+ throw new EventHandlerException("Unable to get response writer", e);
+ }
+ }
+ }
}
Added: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java?rev=923223&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java (added)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java Mon Mar 15 13:44:53 2010
@@ -0,0 +1,220 @@
+/*
+ * 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.ebaystore;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.webapp.taglib.ServiceTag;
+import org.w3c.dom.Document;
+
+import com.ebay.sdk.ApiContext;
+import com.ebay.sdk.ApiException;
+import com.ebay.sdk.SdkException;
+import com.ebay.sdk.SdkSoapException;
+import com.ebay.sdk.attributes.AttributesMaster;
+import com.ebay.sdk.attributes.AttributesXmlDownloader;
+import com.ebay.sdk.attributes.AttributesXslDownloader;
+import com.ebay.sdk.attributes.CategoryCSDownloader;
+import com.ebay.sdk.attributes.model.IAttributesMaster;
+import com.ebay.sdk.attributes.model.IAttributesXmlProvider;
+import com.ebay.sdk.attributes.model.IAttributesXslProvider;
+import com.ebay.sdk.attributes.model.ICategoryCSProvider;
+import com.ebay.sdk.call.GetAttributesCSCall;
+import com.ebay.sdk.call.GetCategory2CSCall;
+import com.ebay.sdk.call.GetDescriptionTemplatesCall;
+import com.ebay.sdk.helper.cache.CategoriesDownloader;
+import com.ebay.sdk.helper.cache.DetailsDownloader;
+import com.ebay.sdk.helper.cache.FeaturesDownloader;
+import com.ebay.sdk.util.eBayUtil;
+import com.ebay.soap.eBLBaseComponents.CategoryFeatureType;
+import com.ebay.soap.eBLBaseComponents.CategoryType;
+import com.ebay.soap.eBLBaseComponents.DescriptionTemplateType;
+import com.ebay.soap.eBLBaseComponents.FeatureDefinitionsType;
+import com.ebay.soap.eBLBaseComponents.GetCategoryFeaturesResponseType;
+import com.ebay.soap.eBLBaseComponents.GetDescriptionTemplatesRequestType;
+import com.ebay.soap.eBLBaseComponents.GetDescriptionTemplatesResponseType;
+import com.ebay.soap.eBLBaseComponents.GeteBayDetailsResponseType;
+import com.ebay.soap.eBLBaseComponents.ItemSpecificsEnabledCodeType;
+import com.ebay.soap.eBLBaseComponents.ItemSpecificsEnabledDefinitionType;
+import com.ebay.soap.eBLBaseComponents.SiteCodeType;
+import com.ebay.soap.eBLBaseComponents.SiteDefaultsType;
+import com.ebay.soap.eBLBaseComponents.ThemeGroupType;
+
+public class EbayStoreSiteFacade {
+ public static final String module = EbayStoreSiteFacade.class.getName();
+ private ApiContext apiContext = null;
+ private IAttributesMaster attrMaster = null;
+ private static final int MAP_SIZE = 30000;
+ private Map<SiteCodeType, Map<String, CategoryType>> siteCategoriesMap = new HashMap<SiteCodeType, Map<String, CategoryType>>();
+ private Map<SiteCodeType, List<CategoryType>> siteCategoriesCSMap = new HashMap<SiteCodeType,List<CategoryType>>();
+ private Map<SiteCodeType, Map<String, CategoryFeatureType>> siteCategoriesFeaturesMap = new HashMap<SiteCodeType, Map<String, CategoryFeatureType>>();
+ private Map<SiteCodeType, SiteDefaultsType> siteFeatureDefaultMap = new HashMap<SiteCodeType, SiteDefaultsType>();
+ private Map<SiteCodeType, FeatureDefinitionsType> siteFeatureDefinitionsMap = new HashMap<SiteCodeType, FeatureDefinitionsType>();
+ private Map<SiteCodeType, GeteBayDetailsResponseType> eBayDetailsMap = new HashMap<SiteCodeType, GeteBayDetailsResponseType>();
+
+ public EbayStoreSiteFacade(ApiContext ctx) throws ApiException, SdkException, Exception {
+ this.apiContext = ctx;
+ initAttributeMaster();
+ syncAllCategoriesFeatures();
+ syncEBayDetails();
+ getAllMergedCategories();
+ }
+
+ public static IAttributesXslProvider getDefaultStyleXsl() throws java.io.IOException {
+ IAttributesXslProvider iAttr = IAttributesXslProvider.class.cast(AttributesXslDownloader.class.getResourceAsStream("Attributes_Style.xsl"));
+ return iAttr;
+ }
+
+ private void initAttributeMaster() throws ApiException, SdkException, Exception, java.io.IOException {
+ //java.io.InputStream strm = IAttributesXmlProvider.class.getResourceAsStream("Attributes_Style.xsl");
+ IAttributesMaster amst = new AttributesMaster();
+ IAttributesXmlProvider axd = new AttributesXmlDownloader(this.apiContext);
+ amst.setXmlProvider(axd);
+ IAttributesXslProvider asd = new AttributesXslDownloader(this.apiContext);
+ //IAttributesXslProvider asd = getDefaultStyleXsl();
+ //asd.downloadXsl();
+ amst.setXslProvider(asd);
+ this.attrMaster = amst;
+ }
+
+ private void syncEBayDetails() throws Exception {
+ if (!eBayDetailsMap.containsKey(this.apiContext.getSite())) {
+ DetailsDownloader downloader = new DetailsDownloader(this.apiContext);
+ GeteBayDetailsResponseType resp = downloader.geteBayDetails();
+ eBayDetailsMap.put(this.apiContext.getSite(), resp);
+ }
+ }
+
+ //sync and cache all categories features in memory
+ private void syncAllCategoriesFeatures() throws Exception {
+ if (!siteCategoriesFeaturesMap.containsKey(this.apiContext.getSite())) {
+ FeaturesDownloader fd = new FeaturesDownloader(this.apiContext);
+ GetCategoryFeaturesResponseType cfrt = fd.getAllCategoryFeatures();
+ CategoryFeatureType[] categoryFeatures = cfrt.getCategory();
+ Map<String, CategoryFeatureType> cfsMap = new HashMap<String, CategoryFeatureType>(MAP_SIZE);
+ for (CategoryFeatureType cf: categoryFeatures) {
+ cfsMap.put(cf.getCategoryID(), cf);
+ }
+ siteCategoriesFeaturesMap.put(this.apiContext.getSite(), cfsMap);
+ siteFeatureDefaultMap.put(this.apiContext.getSite(), cfrt.getSiteDefaults());
+ siteFeatureDefinitionsMap.put(this.apiContext.getSite(), cfrt.getFeatureDefinitions());
+ }
+ }
+
+ /**
+ * Get categories using GetCategory2CS and GetCategories calls,
+ * and merge the categories
+ *
+ */
+ public List<CategoryType> getAllMergedCategories() throws ApiException, SdkException, Exception {
+ //Get all categories that are mapped to characteristics sets
+ IAttributesMaster amst = this.attrMaster;
+ if (!siteCategoriesCSMap.containsKey(this.apiContext.getSite())) {
+ ICategoryCSProvider catCSProvider = new CategoryCSDownloader(this.apiContext);
+ amst.setCategoryCSProvider(catCSProvider);
+ CategoryType[] csCats = catCSProvider.getCategoriesCS();
+ Map<String, CategoryType> csCatsMap = new HashMap<String, CategoryType>(MAP_SIZE);
+ for (CategoryType cat : csCats) {
+ csCatsMap.put(cat.getCategoryID(), cat);
+ }
+
+ //Get all categories
+ Map<String, CategoryType> allCatsMap = this.getAllCategories();
+ for (CategoryType cat : allCatsMap.values()) {
+ CategoryType csCat = csCatsMap.get(cat.getCategoryID());
+ if (csCat != null) {
+ //copy category name and leaf category fields, since these
+ //fields are not set when using GetCategoryCS call.
+ csCat.setCategoryName(cat.getCategoryName());
+ csCat.setLeafCategory(cat.isLeafCategory());
+ } else {
+ //some category has no characteristic sets,
+ //but it may has custom item specifics
+ csCatsMap.put(cat.getCategoryID(), cat);
+ }
+ }
+
+ //convert the map to list
+ List<CategoryType> catsList = FastList.newInstance();
+ for (CategoryType cat : csCatsMap.values()) {
+ catsList.add(cat);
+ }
+ siteCategoriesCSMap.put(this.apiContext.getSite(), catsList);
+ return catsList;
+ } else {
+ return siteCategoriesCSMap.get(this.apiContext.getSite());
+ }
+ }
+
+ //get all categories map
+ private Map<String, CategoryType> getAllCategories() throws Exception {
+ if (!siteCategoriesMap.containsKey(this.apiContext.getSite())) {
+ Map<String, CategoryType> catsMap = new HashMap<String, CategoryType>(30000);
+ CategoriesDownloader cd = new CategoriesDownloader(this.apiContext);
+ CategoryType[] cats = cd.getAllCategories();
+
+ for (CategoryType cat : cats) {
+ catsMap.put(cat.getCategoryID(), cat);
+ }
+ siteCategoriesMap.put(this.apiContext.getSite(), catsMap);
+ return catsMap;
+ } else {
+ return siteCategoriesMap.get(this.apiContext.getSite());
+ }
+ }
+
+ public IAttributesMaster getAttrMaster() {
+ return attrMaster;
+ }
+
+ public Map<SiteCodeType, Map<String, CategoryFeatureType>> getSiteCategoriesFeaturesMap() {
+ return siteCategoriesFeaturesMap;
+ }
+
+ public Map<SiteCodeType, SiteDefaultsType> getSiteFeatureDefaultMap() {
+ return siteFeatureDefaultMap;
+ }
+
+ public Map<SiteCodeType, FeatureDefinitionsType> getSiteFeatureDefinitionsMap() {
+ return siteFeatureDefinitionsMap;
+ }
+
+ public Map<SiteCodeType, Map<String, CategoryType>> getSiteCategoriesMap() {
+ return siteCategoriesMap;
+ }
+
+ public Map<SiteCodeType, List<CategoryType>> getSiteCategoriesCSMap() {
+ return siteCategoriesCSMap;
+ }
+
+ public Map<SiteCodeType, GeteBayDetailsResponseType> getEBayDetailsMap() {
+ return eBayDetailsMap;
+ }
+}
\ No newline at end of file
Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/PrepareProductListing.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/PrepareProductListing.groovy?rev=923223&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/PrepareProductListing.groovy (added)
+++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/PrepareProductListing.groovy Mon Mar 15 13:44:53 2010
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ import java.lang.*;
+ import java.util.*;
+ import org.ofbiz.base.util.*;
+ import org.ofbiz.entity.*;
+ import org.ofbiz.service.*;
+ import org.ofbiz.product.catalog.*;
+ import org.ofbiz.product.category.*;
+ import org.ofbiz.product.product.ProductWorker;
+ import org.ofbiz.product.product.ProductContentWrapper;
+ import org.ofbiz.product.catalog.*;
+ import com.ebay.sdk.ApiContext;
+ import com.ebay.sdk.call.AddItemCall;
+ import com.ebay.soap.eBLBaseComponents.ItemType;
+ import com.ebay.soap.eBLBaseComponents.CategoryType;
+ import com.ebay.soap.eBLBaseComponents.ListingTypeCodeType;
+ import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType;
+ import com.ebay.soap.eBLBaseComponents.ItemSpecificsEnabledCodeType;
+ import com.ebay.soap.eBLBaseComponents.GeteBayDetailsResponseType;
+ import com.ebay.soap.eBLBaseComponents.ReturnPolicyType;
+ import com.ebay.soap.eBLBaseComponents.SiteCodeType;
+ import com.ebay.soap.eBLBaseComponents.ShippingServiceDetailsType;
+ import com.ebay.soap.eBLBaseComponents.ShippingLocationDetailsType;
+ import org.ofbiz.ebaystore.EbayEvents;
+ import com.ebay.sdk.ApiException;
+ import com.ebay.sdk.SdkException;
+
+//set the content path prefix
+ contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
+ productStoreId = parameters.productStoreId;
+ search_CategoryId = parameters.search_CategoryId;
+
+//Get the addItemList and Prepare details
+ apiContext = EbayEvents.getApiContext(request);
+ addItemObj = EbayEvents.getAddItemListingObject(request, apiContext);
+ contents = [];
+ if (addItemObj) {
+ site = (SiteCodeType)apiContext.getSite();
+ context.site = site;
+ context.siteCode = apiContext.getSite().value();
+ context.siteCode_Ebay_Motors = SiteCodeType.E_BAY_MOTORS.value();
+ addItems = addItemObj.itemListing;
+ addItems.each{ addItemMap ->
+ addItem = addItemMap.addItemCall;
+ content = [:];
+ item = addItem.getItem();
+ productId = item.getSKU();
+ product = delegator.findByPrimaryKeyCache("Product", [productId : productId]);
+ contentWrapper = new ProductContentWrapper(product, request);
+ content.productContentWrapper = contentWrapper;
+ content.product = product;
+ contents.add(content);
+ }
+
+ request.setAttribute("productStoreId", productStoreId);
+ categories = EbayEvents.getChildCategories(request);
+ context.categories = categories;
+ // point product tab id
+ productId = null;
+ if (request.getAttribute("isProductId") || parameters.isProductId) {
+ if (request.getAttribute("isProductId")) {
+ productId = request.getAttribute("isProductId");
+ } else {
+ productId = parameters.isProductId;
+ }
+ context.isProductId = productId;
+ // get product default price form product price
+ productPrices = delegator.findByAnd("ProductPrice",["productId":productId,"productPricePurposeId":"EBAY"]);
+ if (productPrices) {
+ context.productPrices = productPrices;
+ }
+ // get category detail
+ pkCateId = null;
+ addItems.each{ addItemMap ->
+ addItem = addItemMap.addItemCall;
+ item = addItem.getItem();
+ if (productId == item.getSKU()) {
+ primaryCate = item.getPrimaryCategory();
+ if (primaryCate) pkCateId = primaryCate.getCategoryID();
+ }
+ }
+ if (pkCateId) {
+ refName = "itemCateFacade_"pkCateId;
+ if (addItemObj.get(refName)) {
+ cf = addItemObj.get(refName);
+ if (cf) {
+ listingTypes = [];
+ listingDurationReferenceMap = cf.getListingDurationReferenceMap();
+ listingDurationMap = cf.getListingDurationMap();
+ if (listingDurationReferenceMap && listingDurationMap) {
+ Iterator keys = listingDurationReferenceMap.keySet().iterator();
+ while (keys.hasNext()) {
+ listingTypeMap = [:];
+ String key = keys.next();
+ listingTypeMap.type = key;
+ listingTypeMap.durations = listingDurationMap.get(new Integer(listingDurationReferenceMap.get(key)));
+ listingTypes.add(listingTypeMap);
+ }
+ }
+ context.listingTypes = listingTypes;
+ buyerPaymentMethods = cf.getPaymentMethods();
+ if (buyerPaymentMethods) {
+ context.paymentMethods = buyerPaymentMethods;
+ context.buyerPayMethCode_PAY_PAL = BuyerPaymentMethodCodeType.PAY_PAL;
+ }
+ // load item specifices and custom if both item attributes and item specifics are supported, we only use item specifics
+ if (cf.getItemSpecificEnabled()) {
+ if (ItemSpecificsEnabledCodeType.ENABLED.equals(cf.getItemSpecificEnabled())) {
+ } else if (cf.AttributesEnabled()) { //show attributes input page
+ String attributesHtml = attrMaster.renderHtml(cf.getJoinedAttrSets(), null);
+ context.AttributesHtml = attributesHtml;
+ } else {//show return policy input page
+ sf = EbayEvents.getSiteFacade(apiContext,request);
+ details = sf.getEBayDetailsMap().get(apiContext.getSite());
+ returnPolicyEnabled = cf.getRetPolicyEnabled();
+
+ context.EBayDetails = details;
+ context.ReturnPolicyEnabled = returnPolicyEnabled;
+ }
+ }
+ // load shipping services detail
+ eBayDetailsMap = sf.getEBayDetailsMap();
+ if (eBayDetailsMap) {
+ eBayDetails = eBayDetailsMap.get(site);
+ shippingServiceDetails = eBayDetails.getShippingServiceDetails();
+ shippingServiceDetails = EbayEvents.filterShippingService(shippingServiceDetails);
+ context.shippingServiceDetails = shippingServiceDetails;
+ shippingLocationDetails = eBayDetails.getShippingLocationDetails();
+ context.shippingLocationDetails = shippingLocationDetails;
+ }
+ // load AdItemTemplates
+ if (cf.getAdItemTemplates()) {
+ context.adItemTemplates = cf.getAdItemTemplates();
+ }
+ }
+ }
+ }
+ }
+ }
+ context.addItemObj = addItemObj;
+ context.contentList = contents;
Modified: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml?rev=923223&r1=923222&r2=923223&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml Mon Mar 15 13:44:53 2010
@@ -68,6 +68,10 @@
<response name="success" type="view" value="EbayAccount"/>
</request-map>
<!-- Store output -->
+ <request-map uri="loadEbayStores">
+ <security https="true" auth="true"/>
+ <response name="success" type="request" value="exportProductListing"/>
+ </request-map>
<request-map uri="ebayStores">
<security https="true" auth="true"/>
<response name="success" type="view" value="ebayStores"/>
@@ -237,22 +241,92 @@
<event type="service" invoke="updateEbayProductQtyReserved"/>
<response name="success" type="view" value="ebayLoadStoreInventory"/>
</request-map>
+ <!-- export productListing in ebay store -->
<request-map uri="exportProductListing">
<security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="prepareEbaySiteFacadeObject"/>
<response name="success" type="view" value="exportProductListing"/>
+ <response name="prepare" type="view" value="prepareProductListing"/>
<response name="error" type="view" value="exportProductListing"/>
</request-map>
<request-map uri="productsearch">
<security https="true" auth="true"/>
- <response name="success" type="view" value="productsearch"/>
- <response name="error" type="view" value="productsearch"/>
+ <response name="success" type="view" value="productSearchResults"/>
</request-map>
- <request-map uri="exportProductsFromEbayStore">
+ <request-map uri="testSetEbayCategory">
<security https="true" auth="true"/>
- <event type="service-multi" invoke="exportProductsFromEbayStore"/>
+ <response name="success" type="view" value="loadEbayAdItemTemplate"/>
+ </request-map>
+ <request-map uri="prepareProductListing">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="addProductListing"/>
+ <response name="success" type="view" value="prepareProductListing"/>
+ <response name="error" type="view" value="exportProductListing"/>
+ </request-map>
+ <request-map uri="setSelectedCategory">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="setSelectedEbayCategory"/>
+ <response name="success" type="view" value="prepareProductListing"/>
+ <response name="error" type="view" value="prepareProductListing"/>
+ </request-map>
+ <request-map uri="retrieveEbayCategoryByParent">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayStoreOptions" invoke="retrieveEbayCategoryByParent"/>
+ <response name="success" type="view" value="main"/>
+ </request-map>
+ <request-map uri="clearExpListing">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="clearProductListing"/>
<response name="success" type="view" value="exportProductListing"/>
+ </request-map>
+ <!-- Ad item template -->
+ <request-map uri="ebayAdItemTemplate">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayStoreOptions" invoke="retrieveItemTemplateByTemplateGroupId"/>
+ <response name="success" type="view" value="main"/>
+ </request-map>
+ <request-map uri="updateProductExportDetail">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="updateProductExportDetail"/>
+ <response name="success" type="view" value="prepareProductListing"/>
<response name="error" type="view" value="exportProductListing"/>
</request-map>
+ <request-map uri="removeProductFromListing">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="removeProductFromListing"/>
+ <response name="success" type="view" value="prepareProductListing"/>
+ <response name="error" type="view" value="exportProductListing"/>
+ </request-map>
+ <request-map uri="verifyItem">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="verifyItemBeforeAdd"/>
+ <response name="success" type="view" value="prepareProductListing"/>
+ <response name="error" type="view" value="exportProductListing"/>
+ </request-map>
+ <request-map uri="exportListingToEbay">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="exportListingToEbay"/>
+ <response name="success" type="request" value="clearExpListing"/>
+ <response name="error" type="view" value="exportProductListing"/>
+ </request-map>
+
+ <!--request-map uri="prepareProductListingDetails">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayEvents" invoke="prepareProductListingDetails"/>
+ <response name="success" type="view" value="prepareProductListing"/>
+ </request-map-->
+ <!--request-map uri="retrieveEbayStoreCategoryByParent">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.ebaystore.EbayStoreOptions" invoke="retrieveEbayStoreCategoryByParent"/>
+ <response name="success" type="view" value="main"/>
+ </request-map-->
+ <!--request-map uri="exportProductsFromEbayStore">
+ <security https="true" auth="true"/>
+ <event type="service-multi" invoke="exportProductsFromEbayStore"/>
+ <response name="success" type="view" value="exportProductListing"/>
+ <response name="error" type="view" value="exportProductListing"/>
+ </request-map-->
+
<!-- Selling Manager -->
<request-map uri="sellingManager">
<security https="true" auth="true"/>
@@ -332,8 +406,13 @@
<view-map name="ebayLoadStoreInventory" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#ebayLoadStoreInventory"/>
<view-map name="reserveEbayProductInventory" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#reserveEbayProductInventory"/>
<view-map name="updateQuantityReserved" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#updateQuantityReserved"/>
+ <!-- export productListing in ebay store -->
<view-map name="exportProductListing" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#exportProductListing"/>
- <view-map name="productsearch" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#productsearchexport"/>
+ <view-map name="productSearchResults" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#productSearchResults"/>
+ <view-map name="selectEbayCategory" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#selectEbayCategory"/>
+ <view-map name="prepareProductListing" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#prepareProductListing"/>
+ <!-- Ad item template -->
+ <view-map name="loadEbayAdItemTemplate" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#loadEbayAdItemTemplate"/>
<!-- Active -->
<view-map name="ActiveListing" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#ActiveListing"/>
<view-map name="AssignAutomaticRule" type="screen" page="component://ebaystore/widget/EbaySellingManagerScreens.xml#AssignAutomaticRule"/>