Modified: 
ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java?rev=1695126&r1=1695125&r2=1695126&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java 
(original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java 
Mon Aug 10 16:15:37 2015
@@ -1,2947 +1,2947 @@
-/*
- * 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.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.math.BigDecimal;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableModel;
-
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilGenerics;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.UtilXml;
-import org.ofbiz.ebay.EbayHelper;
-import org.ofbiz.ebay.ProductsExportToEbay;
-import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.util.EntityQuery;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.GenericServiceException;
-import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.service.ModelService;
-import org.ofbiz.service.ServiceUtil;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import com.ebay.sdk.ApiContext;
-import com.ebay.sdk.ApiException;
-import com.ebay.sdk.SdkException;
-import com.ebay.sdk.SdkSoapException;
-import com.ebay.sdk.TimeFilter;
-import com.ebay.sdk.call.AddDisputeCall;
-import com.ebay.sdk.call.AddSecondChanceItemCall;
-import com.ebay.sdk.call.GetAllBiddersCall;
-import com.ebay.sdk.call.GetItemCall;
-import com.ebay.sdk.call.GetMyeBaySellingCall;
-import com.ebay.sdk.call.GetOrdersCall;
-import com.ebay.sdk.call.GetSellerTransactionsCall;
-import com.ebay.sdk.call.GetSellingManagerSoldListingsCall;
-import com.ebay.sdk.call.GetStoreCall;
-import com.ebay.sdk.call.GetStoreOptionsCall;
-import com.ebay.sdk.call.ReviseItemCall;
-import com.ebay.sdk.call.SetStoreCall;
-import com.ebay.sdk.call.SetStoreCategoriesCall;
-import com.ebay.sdk.call.VerifyAddSecondChanceItemCall;
-import com.ebay.sdk.util.eBayUtil;
-import com.ebay.soap.eBLBaseComponents.AddressType;
-import com.ebay.soap.eBLBaseComponents.AmountType;
-import com.ebay.soap.eBLBaseComponents.CheckoutStatusType;
-import com.ebay.soap.eBLBaseComponents.CurrencyCodeType;
-import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType;
-import com.ebay.soap.eBLBaseComponents.DisputeExplanationCodeType;
-import com.ebay.soap.eBLBaseComponents.DisputeReasonCodeType;
-import com.ebay.soap.eBLBaseComponents.ExternalTransactionType;
-import com.ebay.soap.eBLBaseComponents.GalleryTypeCodeType;
-import com.ebay.soap.eBLBaseComponents.GetAllBiddersModeCodeType;
-import com.ebay.soap.eBLBaseComponents.GetStoreOptionsRequestType;
-import com.ebay.soap.eBLBaseComponents.GetStoreOptionsResponseType;
-import com.ebay.soap.eBLBaseComponents.GetStoreRequestType;
-import com.ebay.soap.eBLBaseComponents.GetStoreResponseType;
-import com.ebay.soap.eBLBaseComponents.ItemArrayType;
-import com.ebay.soap.eBLBaseComponents.ItemListCustomizationType;
-import com.ebay.soap.eBLBaseComponents.ItemSortTypeCodeType;
-import com.ebay.soap.eBLBaseComponents.ItemType;
-import com.ebay.soap.eBLBaseComponents.ListingTypeCodeType;
-import com.ebay.soap.eBLBaseComponents.MerchDisplayCodeType;
-import com.ebay.soap.eBLBaseComponents.OfferType;
-import com.ebay.soap.eBLBaseComponents.OrderStatusCodeType;
-import com.ebay.soap.eBLBaseComponents.OrderTransactionType;
-import com.ebay.soap.eBLBaseComponents.OrderType;
-import com.ebay.soap.eBLBaseComponents.PaginatedItemArrayType;
-import com.ebay.soap.eBLBaseComponents.PaginationType;
-import com.ebay.soap.eBLBaseComponents.PhotoDisplayCodeType;
-import com.ebay.soap.eBLBaseComponents.PictureDetailsType;
-import com.ebay.soap.eBLBaseComponents.PictureSourceCodeType;
-import com.ebay.soap.eBLBaseComponents.SalesTaxType;
-import com.ebay.soap.eBLBaseComponents.SecondChanceOfferDurationCodeType;
-import com.ebay.soap.eBLBaseComponents.SellingManagerSearchType;
-import com.ebay.soap.eBLBaseComponents.SellingManagerSearchTypeCodeType;
-import 
com.ebay.soap.eBLBaseComponents.SellingManagerSoldListingsPropertyTypeCodeType;
-import com.ebay.soap.eBLBaseComponents.SellingManagerSoldOrderType;
-import com.ebay.soap.eBLBaseComponents.SellingManagerSoldTransactionType;
-import com.ebay.soap.eBLBaseComponents.SellingStatusType;
-import com.ebay.soap.eBLBaseComponents.SetStoreCategoriesRequestType;
-import com.ebay.soap.eBLBaseComponents.SetStoreCategoriesResponseType;
-import com.ebay.soap.eBLBaseComponents.SetStoreRequestType;
-import com.ebay.soap.eBLBaseComponents.SetStoreResponseType;
-import com.ebay.soap.eBLBaseComponents.ShippingDetailsType;
-import com.ebay.soap.eBLBaseComponents.ShippingServiceOptionsType;
-import com.ebay.soap.eBLBaseComponents.StoreCategoryUpdateActionCodeType;
-import com.ebay.soap.eBLBaseComponents.StoreColorSchemeType;
-import com.ebay.soap.eBLBaseComponents.StoreColorType;
-import com.ebay.soap.eBLBaseComponents.StoreCustomCategoryArrayType;
-import com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType;
-import com.ebay.soap.eBLBaseComponents.StoreCustomHeaderLayoutCodeType;
-import com.ebay.soap.eBLBaseComponents.StoreCustomListingHeaderDisplayCodeType;
-import com.ebay.soap.eBLBaseComponents.StoreCustomListingHeaderType;
-import com.ebay.soap.eBLBaseComponents.StoreFontFaceCodeType;
-import com.ebay.soap.eBLBaseComponents.StoreFontSizeCodeType;
-import com.ebay.soap.eBLBaseComponents.StoreFontType;
-import com.ebay.soap.eBLBaseComponents.StoreHeaderStyleCodeType;
-import com.ebay.soap.eBLBaseComponents.StoreItemListLayoutCodeType;
-import com.ebay.soap.eBLBaseComponents.StoreItemListSortOrderCodeType;
-import com.ebay.soap.eBLBaseComponents.StoreLogoArrayType;
-import com.ebay.soap.eBLBaseComponents.StoreLogoType;
-import com.ebay.soap.eBLBaseComponents.StoreSubscriptionLevelCodeType;
-import com.ebay.soap.eBLBaseComponents.StoreThemeArrayType;
-import com.ebay.soap.eBLBaseComponents.StoreThemeType;
-import com.ebay.soap.eBLBaseComponents.StoreType;
-import com.ebay.soap.eBLBaseComponents.TradingRoleCodeType;
-import com.ebay.soap.eBLBaseComponents.TransactionType;
-import com.ebay.soap.eBLBaseComponents.UserType;
-import com.ibm.icu.text.SimpleDateFormat;
-
-public class EbayStore {
-    private static final String resource = "EbayStoreUiLabels";
-    private static final String module = ProductsExportToEbay.class.getName();
-    public static ProductsExportToEbay productExportEbay = new 
ProductsExportToEbay();
-
-    private static void appendRequesterCredentials(Element elem, Document doc, 
String token) {
-        Element requesterCredentialsElem = UtilXml.addChildElement(elem, 
"RequesterCredentials", doc);
-        UtilXml.addChildElementValue(requesterCredentialsElem, 
"eBayAuthToken", token, doc);
-    }
-
-    private static Map<String, Object> postItem(String postItemsUrl, 
StringBuffer dataItems, String devID, String appID, String certID,
-            String callName, String compatibilityLevel, String siteID) throws 
IOException {
-        if (Debug.verboseOn()) {
-            Debug.logVerbose("Request of " + callName + " To eBay:\n" + 
dataItems.toString(), module);
-        }
-        HttpURLConnection connection = (HttpURLConnection)(new 
URL(postItemsUrl)).openConnection();
-        connection.setDoInput(true);
-        connection.setDoOutput(true);
-        connection.setRequestMethod("POST");
-        connection.setRequestProperty("X-EBAY-API-COMPATIBILITY-LEVEL", 
compatibilityLevel);
-        connection.setRequestProperty("X-EBAY-API-DEV-NAME", devID);
-        connection.setRequestProperty("X-EBAY-API-APP-NAME", appID);
-        connection.setRequestProperty("X-EBAY-API-CERT-NAME", certID);
-        connection.setRequestProperty("X-EBAY-API-CALL-NAME", callName);
-        connection.setRequestProperty("X-EBAY-API-SITEID", siteID);
-        connection.setRequestProperty("Content-Type", "text/xml");
-
-        OutputStream outputStream = connection.getOutputStream();
-        outputStream.write(dataItems.toString().getBytes());
-        outputStream.close();
-        int responseCode = connection.getResponseCode();
-        InputStream inputStream;
-        Map<String, Object> result = new HashMap<String, Object>();
-        String response = null;
-
-        if (responseCode == HttpURLConnection.HTTP_CREATED ||
-                responseCode == HttpURLConnection.HTTP_OK) {
-            inputStream = connection.getInputStream();
-            response = toString(inputStream);
-            result = ServiceUtil.returnSuccess(response);
-        } else {
-            inputStream = connection.getErrorStream();
-            response = toString(inputStream);
-            result = ServiceUtil.returnFailure(response);
-        }
-
-        if (Debug.verboseOn()) {
-            Debug.logVerbose("Response of " + callName + " From eBay:\n" + 
response, module);
-        }
-
-        return result;
-    }
-
-    private static String toString(InputStream inputStream) throws IOException 
{
-        String string;
-        StringBuilder outputBuilder = new StringBuilder();
-        if (inputStream != null) {
-            BufferedReader reader = new BufferedReader(new 
InputStreamReader(inputStream));
-            while (null != (string = reader.readLine())) {
-                outputBuilder.append(string).append('\n');
-            }
-        }
-        return outputBuilder.toString();
-    }
-
-    /* add/update/delete  categories and child into your ebay store category */
-    public static Map<String,Object> 
exportCategoriesSelectedToEbayStore(DispatchContext dctx, Map<String,? extends 
Object>  context) {
-        Locale locale = (Locale) context.get("locale");
-        Delegator delegator = dctx.getDelegator();
-        Map<String, Object> result = new HashMap<String, Object>();
-        SetStoreCategoriesRequestType req = null;
-        StoreCustomCategoryArrayType categoryArrayType = null;
-
-        List<GenericValue> catalogCategories = null;
-
-        if (UtilValidate.isEmpty(context.get("prodCatalogId")) || 
UtilValidate.isEmpty(context.get("productStoreId")) || 
UtilValidate.isEmpty(context.get("partyId"))) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
"EbayStoreSetCatalogIdAndProductStoreId", locale));
-        }
-        if 
(!EbayStoreHelper.validatePartyAndRoleType(delegator,context.get("partyId").toString()))
 {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
"EbayStorePartyWithoutRoleEbayAccount", UtilMisc.toMap("partyId", 
context.get("partyId").toString()), locale));
-        }
-        try {
-            SetStoreCategoriesCall  call = new 
SetStoreCategoriesCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
 locale, delegator));
-
-            catalogCategories = 
EntityQuery.use(delegator).from("ProdCatalogCategory").where("prodCatalogId", 
context.get("prodCatalogId").toString(),"prodCatalogCategoryTypeId","PCCT_EBAY_ROOT").orderBy("sequenceNum
 ASC").queryList();
-            if (catalogCategories != null && catalogCategories.size() > 0) {
-                List<StoreCustomCategoryType> listAdd = new 
LinkedList<StoreCustomCategoryType>();
-                List<StoreCustomCategoryType> listEdit = new 
LinkedList<StoreCustomCategoryType>();
-                //start at level 0 of categories
-                for (GenericValue catalogCategory : catalogCategories) {
-                    GenericValue productCategory = 
catalogCategory.getRelatedOne("ProductCategory", false);
-                    if (productCategory != null) {
-                        String ebayCategoryId = 
EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productCategory.getString("productCategoryId"),context.get("partyId").toString());
-                        StoreCustomCategoryType categoryType = new 
StoreCustomCategoryType();
-                        if (ebayCategoryId == null) {
-                            
categoryType.setName(productCategory.getString("categoryName"));
-                            listAdd.add(categoryType);
-                        } else {
-                            categoryType.setCategoryID(new 
Long(ebayCategoryId));
-                            
categoryType.setName(productCategory.getString("categoryName"));
-                            listEdit.add(categoryType);
-                        }
-                    }
-                }
-                if (listAdd.size() > 0) {
-                    req = new SetStoreCategoriesRequestType();
-                    categoryArrayType = new StoreCustomCategoryArrayType();
-                    
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listAdd));
-                    req.setStoreCategories(categoryArrayType);
-                    result = excuteExportCategoryToEbayStore(call, req, 
StoreCategoryUpdateActionCodeType.ADD, 
delegator,context.get("partyId").toString(), catalogCategories, locale);
-                }
-                if (listEdit.size() > 0) {
-                    req = new SetStoreCategoriesRequestType();
-                    categoryArrayType = new StoreCustomCategoryArrayType();
-                    
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listEdit));
-                    req.setStoreCategories(categoryArrayType);
-                    result = excuteExportCategoryToEbayStore(call, req, 
StoreCategoryUpdateActionCodeType.RENAME, 
delegator,context.get("partyId").toString(), catalogCategories, locale);
-                }
-
-                //start at level 1 of categories
-                listAdd = new LinkedList<StoreCustomCategoryType>();
-                listEdit = new LinkedList<StoreCustomCategoryType>();
-                for (GenericValue catalogCategory : catalogCategories) {
-                    GenericValue productCategory = 
catalogCategory.getRelatedOne("ProductCategory", false);
-                    if (productCategory != null) {
-                        String ebayParentCategoryId = 
EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator, 
productCategory.getString("productCategoryId"), 
context.get("partyId").toString());
-                        if (ebayParentCategoryId != null) {
-                            List<GenericValue> productCategoryRollupList = 
EntityQuery.use(delegator).from("ProductCategoryRollup").where("parentProductCategoryId",
 productCategory.getString("productCategoryId")).orderBy("sequenceNum 
ASC").queryList();
-                            for (GenericValue productCategoryRollup : 
productCategoryRollupList) {
-                                productCategory = 
EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", 
productCategoryRollup.getString("productCategoryId")).queryOne();
-                                StoreCustomCategoryType childCategoryType = 
new StoreCustomCategoryType();
-                                String ebayChildCategoryId = 
EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator, 
productCategory.getString("productCategoryId"), 
context.get("partyId").toString());
-                                if (ebayChildCategoryId == null) {
-                                    
childCategoryType.setName(productCategory.getString("categoryName"));
-                                    listAdd.add(childCategoryType);
-                                } else {
-                                    childCategoryType.setCategoryID(new 
Long(ebayChildCategoryId));
-                                    
childCategoryType.setName(productCategory.getString("categoryName"));
-                                    listEdit.add(childCategoryType);
-                                }
-                            }
-                        }
-                        if (listAdd.size() > 0) {
-                            req = new SetStoreCategoriesRequestType();
-                            categoryArrayType = new 
StoreCustomCategoryArrayType();
-                            
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listAdd));
-                            req.setStoreCategories(categoryArrayType);
-                            req.setDestinationParentCategoryID(new 
Long(ebayParentCategoryId));
-                            result = excuteExportCategoryToEbayStore(call, 
req, StoreCategoryUpdateActionCodeType.ADD, 
delegator,context.get("partyId").toString(), catalogCategories, locale);
-                        }
-                        if (listEdit.size() > 0) {
-                            req = new SetStoreCategoriesRequestType();
-                            categoryArrayType = new 
StoreCustomCategoryArrayType();
-                            
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listEdit));
-                            req.setStoreCategories(categoryArrayType);
-                            req.setDestinationParentCategoryID(new 
Long(ebayParentCategoryId));
-                            result = excuteExportCategoryToEbayStore(call, 
req, StoreCategoryUpdateActionCodeType.RENAME, 
delegator,context.get("partyId").toString(), catalogCategories, locale);
-                        }
-                    }
-                }
-                //start at level 2 of categories
-                listAdd = new LinkedList<StoreCustomCategoryType>();
-                listEdit = new LinkedList<StoreCustomCategoryType>();
-                for (GenericValue catalogCategory : catalogCategories) {
-                    GenericValue productCategory = 
catalogCategory.getRelatedOne("ProductCategory", false);
-                    if (productCategory != null) {
-                        List<GenericValue> productParentCategoryRollupList = 
EntityQuery.use(delegator).from("ProductCategoryRollup").where("parentProductCategoryId",productCategory.getString("productCategoryId")).orderBy("sequenceNum
 ASC").queryList();
-                        for (GenericValue productParentCategoryRollup : 
productParentCategoryRollupList) {
-                            String ebayParentCategoryId = 
EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productParentCategoryRollup.getString("productCategoryId"),context.get("partyId").toString());
-                            if (ebayParentCategoryId != null) {
-                                List<GenericValue> 
productChildCategoryRollupList = 
EntityQuery.use(delegator).from("ProductCategoryRollup").where("parentProductCategoryId",productParentCategoryRollup.getString("productCategoryId")).orderBy("sequenceNum
 ASC").queryList();
-                                for (GenericValue productChildCategoryRollup : 
productChildCategoryRollupList) {
-                                    productCategory = 
EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", 
productChildCategoryRollup.getString("productCategoryId")).queryOne();
-                                    StoreCustomCategoryType childCategoryType 
= new StoreCustomCategoryType();
-                                    String ebayChildCategoryId = 
EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productCategory.getString("productCategoryId"),context.get("partyId").toString());
-                                    if (ebayChildCategoryId == null) {
-                                        
childCategoryType.setName(productCategory.getString("categoryName"));
-                                        listAdd.add(childCategoryType);
-                                    } else {
-                                        childCategoryType.setCategoryID(new 
Long(ebayChildCategoryId));
-                                        
childCategoryType.setName(productCategory.getString("categoryName"));
-                                        listEdit.add(childCategoryType);
-                                    }
-                                }
-                                if (listAdd.size() > 0) {
-                                    req = new SetStoreCategoriesRequestType();
-                                    categoryArrayType = new 
StoreCustomCategoryArrayType();
-                                    
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listAdd));
-                                    req.setStoreCategories(categoryArrayType);
-                                    req.setDestinationParentCategoryID(new 
Long(ebayParentCategoryId));
-                                    result = 
excuteExportCategoryToEbayStore(call, req, 
StoreCategoryUpdateActionCodeType.ADD, delegator, 
context.get("partyId").toString(), catalogCategories, locale);
-                                }
-                                if (listEdit.size() > 0) {
-                                    req = new SetStoreCategoriesRequestType();
-                                    categoryArrayType = new 
StoreCustomCategoryArrayType();
-                                    
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listEdit));
-                                    req.setStoreCategories(categoryArrayType);
-                                    req.setDestinationParentCategoryID(new 
Long(ebayParentCategoryId));
-                                    result = 
excuteExportCategoryToEbayStore(call, req, 
StoreCategoryUpdateActionCodeType.RENAME, delegator, 
context.get("partyId").toString(), catalogCategories, locale);
-                                }
-                            }
-                        }
-                    }
-                }
-            } else {
-                return 
ServiceUtil.returnError(UtilProperties.getMessage(resource, 
"EbayStoreRootCategoryNotFound", UtilMisc.toMap("prodCatalogId", 
context.get("prodCatalogId")), locale));
-            }
-        } catch (GenericEntityException e) {
-            result = ServiceUtil.returnFailure(e.getMessage());
-        }
-        if (result.get("responseMessage") != null && 
result.get("responseMessage").equals("fail")) {
-            result = 
ServiceUtil.returnError(result.get("errorMessage").toString());
-        }
-        return result;
-    }
-
-    public static StoreCustomCategoryType[] 
toStoreCustomCategoryTypeArray(List<StoreCustomCategoryType> list) {
-        StoreCustomCategoryType[] storeCustomCategoryTypeArry = null;
-        try {
-            if (list != null && list.size() > 0) {
-                storeCustomCategoryTypeArry = new 
StoreCustomCategoryType[list.size()];
-                int i=0;
-                for (StoreCustomCategoryType val : list) {
-                    storeCustomCategoryTypeArry[i] = val;
-                }
-            }
-        } catch (Exception e) {
-            Debug.logError(e.getMessage(), module);
-        }
-        return storeCustomCategoryTypeArry;
-    }
-
-    public static Map<String, Object> 
excuteExportCategoryToEbayStore(SetStoreCategoriesCall  call, 
SetStoreCategoriesRequestType req, StoreCategoryUpdateActionCodeType 
actionCode,Delegator delegator, String partyId,List<GenericValue> 
catalogCategories, Locale locale) {
-        Map<String, Object> result = new HashMap<String, Object>();
-        SetStoreCategoriesResponseType resp = null;
-        try {
-            if (req != null && actionCode != null) {
-                req.setAction(actionCode);
-                resp = (SetStoreCategoriesResponseType) call.execute(req);
-                if (resp != null && 
"SUCCESS".equals(resp.getAck().toString())) {
-                    StoreCustomCategoryArrayType returnedCustomCategory = 
resp.getCustomCategory();
-                    if 
(actionCode.equals(StoreCategoryUpdateActionCodeType.ADD) && 
returnedCustomCategory != null) {
-                        StoreCustomCategoryType[] returnCategoryTypeList = 
returnedCustomCategory.getCustomCategory();
-                        for (StoreCustomCategoryType returnCategoryType : 
returnCategoryTypeList) {
-                            List<GenericValue> productCategoryList = 
EntityQuery.use(delegator).from("ProductCategory").where("categoryName",returnCategoryType.getName(),"productCategoryTypeId","EBAY_CATEGORY").queryList();
-                            for (GenericValue productCategory : 
productCategoryList) {
-                                if 
(EbayStoreHelper.veriflyCategoryInCatalog(delegator,catalogCategories,productCategory.getString("productCategoryId")))
 {
-                                    if 
(EbayStoreHelper.createEbayCategoryIdByPartyId(delegator, 
productCategory.getString("productCategoryId"), partyId, 
String.valueOf(returnCategoryType.getCategoryID()))) {
-                                        Debug.logInfo("Create new 
ProductCategoryRollup with partyId "+partyId+" categoryId 
"+productCategory.getString("productCategoryId")+ " and ebayCategoryId 
"+String.valueOf(returnCategoryType.getCategoryID()), module);
-                                    }
-                                    break;
-                                }
-                            }
-                        }
-                    }
-                    result = 
ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, 
"EbayExportToEbayStoreSuccess", locale));
-                } else {
-                    return 
ServiceUtil.returnError(UtilProperties.getMessage(resource, 
"EbayExportToEbayStoreFailed", UtilMisc.toMap("errorString", 
resp.getMessage()), locale));
-                }
-            }
-        } catch (ApiException e) {
-            result = ServiceUtil.returnFailure(e.getMessage());
-        } catch (SdkSoapException e) {
-            result = ServiceUtil.returnFailure(e.getMessage());
-        } catch (SdkException e) {
-            result = ServiceUtil.returnFailure(e.getMessage());
-        } catch (GenericEntityException e) {
-            result = ServiceUtil.returnFailure(e.getMessage());
-        }
-        return result;
-    }
-
-    public static Map<String, Object> buildSetStoreXml(DispatchContext dctx, 
Map<String, ? extends Object> context, StringBuffer dataStoreXml, String token, 
String siteID) {
-        Locale locale = (Locale)context.get("locale");
-        try {
-            Delegator delegator = dctx.getDelegator();
-            
-            // Get the list of products to be exported to eBay
-            try {
-                Document storeDocument = 
UtilXml.makeEmptyXmlDocument("SetStoreRequest");
-                Element storeRequestElem = storeDocument.getDocumentElement();
-                storeRequestElem.setAttribute("xmlns", 
"urn:ebay:apis:eBLBaseComponents");
-
-                appendRequesterCredentials(storeRequestElem, storeDocument, 
token);
-
-                /*UtilXml.addChildElementValue(storeRequestElem, "SiteId", 
siteID, storeDocument);
-                UtilXml.addChildElementValue(storeRequestElem, "DetailLevel", 
"ReturnAll", storeDocument);
-                UtilXml.addChildElementValue(storeRequestElem, "LevelLimit", 
"1", storeDocument);*/
-                // Prepare data for set to XML
-                GenericValue productStore = null;
-                if 
(UtilValidate.isNotEmpty(context.get("productStoreId").toString())) {
-                    productStore = 
EntityQuery.use(delegator).from("ProductStore").where("productStoreId", 
context.get("productStoreId").toString()).queryOne();
-                }
-                Element itemElem = UtilXml.addChildElement(storeRequestElem, 
"Store", storeDocument);
-                UtilXml.addChildElementValue(itemElem, "Name", 
productStore.getString("storeName"), storeDocument);
-                UtilXml.addChildElementValue(itemElem, "SubscriptionLevel", 
"Basic", storeDocument);
-                UtilXml.addChildElementValue(itemElem, "Description", 
productStore.getString("title"), storeDocument);
-                dataStoreXml.append(UtilXml.writeXmlDocument(storeDocument));
-
-            } catch (Exception e) {
-                Debug.logError("Exception during building data items to eBay: 
" + e.getMessage(), module);
-                return 
ServiceUtil.returnFailure(UtilProperties.getMessage(resource, 
"productsExportToEbay.exceptionDuringBuildingDataItemsToEbay", locale));
-            }
-        } catch (Exception e) {
-            Debug.logError("Exception during building data items to eBay: " + 
e.getMessage(), module);
-            return 
ServiceUtil.returnFailure(UtilProperties.getMessage(resource, 
"productsExportToEbay.exceptionDuringBuildingDataItemsToEbay", locale));
-        }
-        return ServiceUtil.returnSuccess();
-    }
-
-    public static String readEbayResponse(String msg, String productStoreId) {
-        String result = "success";
-        try {
-            Document docResponse = UtilXml.readXmlDocument(msg, true);
-            Element elemResponse = docResponse.getDocumentElement();
-            String ack = UtilXml.childElementValue(elemResponse, "Ack", 
"Failure");
-            if (ack != null && "Failure".equals(ack)) {
-                String errorMessage = "";
-                List<Element> errorList = 
UtilGenerics.checkList(UtilXml.childElementList(elemResponse, "Errors"));
-                Iterator<Element> errorElemIter = errorList.iterator();
-                while (errorElemIter.hasNext()) {
-                    Element errorElement = errorElemIter.next();
-                    errorMessage = UtilXml.childElementValue(errorElement, 
"LongMessage");
-                }
-                result = errorMessage;
-            } else {
-                result = "Successfully exported with ID (" + productStoreId + 
").";
-            }
-        } catch (Exception e) {
-            Debug.logError("Error in processing xml string" + e.getMessage(), 
module);
-            result =  "Failure";
-        }
-        return result;
-    }
-
-    public static Map<String, Object> buildGetStoreXml(Map<String, ? extends 
Object> context, StringBuffer dataStoreXml, String token, String siteID) {
-        Locale locale = (Locale)context.get("locale");
-        // Get the list of products to be exported to eBay
-        try {
-            Document storeDocument = 
UtilXml.makeEmptyXmlDocument("GetStoreRequest");
-            Element storeRequestElem = storeDocument.getDocumentElement();
-            storeRequestElem.setAttribute("xmlns", 
"urn:ebay:apis:eBLBaseComponents");
-            appendRequesterCredentials(storeRequestElem, storeDocument, token);
-            //UtilXml.addChildElementValue(storeRequestElem, "CategorySiteID", 
siteID, storeDocument);
-            UtilXml.addChildElementValue(storeRequestElem, "DetailLevel", 
"ReturnAll", storeDocument);
-            UtilXml.addChildElementValue(storeRequestElem, "LevelLimit", "1", 
storeDocument);
-            dataStoreXml.append(UtilXml.writeXmlDocument(storeDocument));
-        } catch (Exception e) {
-            Debug.logError("Exception during building data to eBay: " + 
e.getMessage(), module);
-            return 
ServiceUtil.returnFailure(UtilProperties.getMessage(resource, 
"productsExportToEbay.exceptionDuringBuildingDataItemsToEbay", locale));
-        }
-        return ServiceUtil.returnSuccess();
-    }
-
-    public static Map<String, Object> 
buildSetStoreCategoriesXml(DispatchContext dctx, Map<String, ? extends Object> 
context, StringBuffer dataStoreXml, String token, String siteID, String 
productCategoryId) {
-        Delegator delegator = dctx.getDelegator();
-        Locale locale = (Locale)context.get("locale");
-        // Get the list of products to be exported to eBay
-        try {
-            Document storeDocument = 
UtilXml.makeEmptyXmlDocument("SetStoreCategoriesRequest");
-            Element storeRequestElem = storeDocument.getDocumentElement();
-            storeRequestElem.setAttribute("xmlns", 
"urn:ebay:apis:eBLBaseComponents");
-            appendRequesterCredentials(storeRequestElem, storeDocument, token);
-            UtilXml.addChildElementValue(storeRequestElem, "DetailLevel", 
"ReturnAll", storeDocument);
-            UtilXml.addChildElementValue(storeRequestElem, "Version", "643", 
storeDocument);
-            UtilXml.addChildElementValue(storeRequestElem, "Action", "Add", 
storeDocument);
-
-            Element StoreCategoriesElem = 
UtilXml.addChildElement(storeRequestElem, "StoreCategories", storeDocument);
-            //UtilXml.addChildElementValue(StoreCategoriesElem, "Country", 
(String)context.get("country"), storeDocument);
-            GenericValue category = null;
-            if (UtilValidate.isNotEmpty(context.get("prodCatalogId"))) {
-                category = 
EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", 
productCategoryId).cache().queryOne();
-            }
-            String categoryName = 
category.getString("productCategoryId").toString();
-            if (category.getString("categoryName").toString() != null) {
-                categoryName = category.getString("categoryName").toString();
-            }
-            Element customCategoryElem = 
UtilXml.addChildElement(StoreCategoriesElem, "CustomCategory", storeDocument);
-            //UtilXml.addChildElementValue(customCategoryElem, "CategoryID", 
"", storeDocument);
-            UtilXml.addChildElementValue(customCategoryElem, "Name", 
categoryName, storeDocument);
-
-            dataStoreXml.append(UtilXml.writeXmlDocument(storeDocument));
-
-        } catch (Exception e) {
-            Debug.logError("Exception during building data to eBay: " + 
e.getMessage(), module);
-            return 
ServiceUtil.returnFailure(UtilProperties.getMessage(resource, 
"productsExportToEbay.exceptionDuringBuildingDataItemsToEbay", locale));
-        }
-        return ServiceUtil.returnSuccess();
-    }
-
-    public static Map<String, Object> 
readEbayGetStoreCategoriesResponse(String msg, Locale locale) {
-        Map<String, Object> results = null;
-        List<Map<Object, Object>> categories = new LinkedList<Map<Object, 
Object>>();
-        try {
-            Document docResponse = UtilXml.readXmlDocument(msg, true);
-            Element elemResponse = docResponse.getDocumentElement();
-            String ack = UtilXml.childElementValue(elemResponse, "Ack", 
"Failure");
-            if (ack != null && "Failure".equals(ack)) {
-                String errorMessage = "";
-                List<Element> errorList = 
UtilGenerics.checkList(UtilXml.childElementList(elemResponse, "Errors"));
-                Iterator<Element> errorElemIter = errorList.iterator();
-                while (errorElemIter.hasNext()) {
-                    Element errorElement = errorElemIter.next();
-                    errorMessage = UtilXml.childElementValue(errorElement, 
"ShortMessage", "");
-                }
-                return ServiceUtil.returnFailure(errorMessage);
-            } else {
-                // retrieve Store
-                List<Element> Store = 
UtilGenerics.checkList(UtilXml.childElementList(elemResponse, "Store"));
-                Iterator<Element> StoreElemIter = Store.iterator();
-                while (StoreElemIter.hasNext()) {
-                    Element StoreElemIterElemIterElement = 
StoreElemIter.next();
-                    // retrieve Custom Category Array
-
-                    List<Element> customCategories = 
UtilGenerics.checkList(UtilXml.childElementList(StoreElemIterElemIterElement, 
"CustomCategories"));
-                    Iterator<Element> customCategoriesElemIter = 
customCategories.iterator();
-                    while (customCategoriesElemIter.hasNext()) {
-                        Element customCategoriesElemIterElement = 
customCategoriesElemIter.next();
-
-                        // retrieve CustomCategory
-                        List<Element> customCategory = 
UtilGenerics.checkList(UtilXml.childElementList(customCategoriesElemIterElement,
 "CustomCategory"));
-                        Iterator<Element> customCategoryElemIter = 
customCategory.iterator();
-                        while (customCategoryElemIter.hasNext()) {
-                            Map<Object, Object> categ = new HashMap<Object, 
Object>();
-                            Element categoryElement = 
customCategoryElemIter.next();
-                            categ.put("CategoryID", 
UtilXml.childElementValue(categoryElement, "CategoryID"));
-                            categ.put("CategoryName", 
UtilXml.childElementValue(categoryElement, "Name"));
-                            categ.put("CategorySeq", 
UtilXml.childElementValue(categoryElement, "Order"));
-                            categories.add(categ);
-                        }
-                    }
-                }
-                categories = UtilMisc.sortMaps(categories, 
UtilMisc.toList("CategoryName"));
-                results = UtilMisc.<String, Object>toMap("categories", 
categories);
-            }
-        } catch (Exception e) {
-            return ServiceUtil.returnFailure();
-        }
-        return results;
-    }
-
-    public static Map<String, Object> getEbayStoreUser(DispatchContext dctx, 
Map<String, ? extends Object> context) {
-        Map<String, Object> result = new HashMap<String, Object>();
-        Delegator delegator = dctx.getDelegator();
-        String productStoreId = (String) context.get("productStoreId");
-        try {
-            List<GenericValue> productStores = 
EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId", 
productStoreId, "roleTypeId", "EBAY_ACCOUNT").queryList();
-            if (productStores.size() != 0) {
-                String partyId = (productStores.get(0)).getString("partyId");
-                List<GenericValue> userLoginStore = 
EntityQuery.use(delegator).from("UserLogin").where("partyId", 
partyId).queryList();
-                if (userLoginStore.size() != 0) {
-                String    userLoginId = 
(userLoginStore.get(0)).getString("userLoginId");
-                result.put("userLoginId", userLoginId);
-                }
-            }
-        } catch (Exception e) {
-
-        }
-        return result;
-    }
-
-    /*Editing the Store Settings */
-    /* Get store output */
-    public static Map<String,Object> getEbayStoreOutput(DispatchContext dctx, 
Map<String,Object> context) {
-        Locale locale = (Locale) context.get("locale");
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Delegator delegator = dctx.getDelegator();
-        Map<String,Object> result = new HashMap<String, Object>();
-        StoreType returnedStoreType = null;
-        GetStoreRequestType req = new GetStoreRequestType();
-        GetStoreResponseType resp =  null;
-
-        String userLoginId = null;
-        if (context.get("productStoreId") != null) {
-            String partyId = null;
-            try {
-                List<GenericValue> productStoreRoles = 
EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId", 
context.get("productStoreId").toString(),"roleTypeId","EBAY_ACCOUNT").queryList();
-                if (productStoreRoles.size() != 0) {
-                    partyId=  (String)productStoreRoles.get(0).get("partyId");
-                    List<GenericValue> userLogins = 
EntityQuery.use(delegator).from("UserLogin").where("partyId", 
partyId).queryList();
-                    if (userLogins.size() != 0) {
-                        userLoginId = 
(String)userLogins.get(0).get("userLoginId");
-                    }
-
-                }
-            } catch (GenericEntityException e1) {
-                e1.printStackTrace();
-            }
-            Debug.logInfo("userLoginId is "+userLoginId+" and productStoreId 
is "+ context.get("productStoreId"), module);
-            GetStoreCall call = new 
GetStoreCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
 locale, delegator));
-            
//call.setSite(EbayHelper.getSiteCodeType((String)context.get("productStoreId"),
 locale, delegator));
-            call.setCategoryStructureOnly(false);
-            call.setUserID(userLoginId);
-
-            try {
-                resp = (GetStoreResponseType)call.execute(req);
-                if (resp != null && 
"SUCCESS".equals(resp.getAck().toString())) {
-                    returnedStoreType  = resp.getStore();
-                    result.put(ModelService.RESPONSE_MESSAGE, 
ModelService.RESPOND_SUCCESS);
-                    //result.put(ModelService.SUCCESS_MESSAGE, 
UtilProperties.getMessage(resource, "EbayStoreLoadSuccess", locale));
-                    // update product store in ofbiz
-                    updateProductStore(dctx, context, 
returnedStoreType,(String) context.get("productStoreId"));
-                    Map<String,Object> ebayResp = new HashMap<String, 
Object>();
-                    ebayResp.put("storeName", returnedStoreType.getName());
-                    ebayResp.put("storeUrl", returnedStoreType.getURL());
-                    ebayResp.put("storeUrlPath", 
returnedStoreType.getURLPath());
-                    String desc = returnedStoreType.getDescription();
-                    if (desc != null) desc  =  desc.trim();
-                    ebayResp.put("storeDesc", desc);
-
-                    StoreLogoType logoType = returnedStoreType.getLogo();
-                    ebayResp.put("storeLogoId", logoType.getLogoID());
-                    ebayResp.put("storeLogoName", logoType.getName());
-                    ebayResp.put("storeLogoURL", logoType.getURL());
-
-                    StoreThemeType themeType = returnedStoreType.getTheme();
-                    ebayResp.put("storeThemeId", themeType.getThemeID());
-                    ebayResp.put("storeThemeName", themeType.getName());
-
-                    StoreColorSchemeType colorSchemeType = 
themeType.getColorScheme();
-                    ebayResp.put("storeColorSchemeId", 
colorSchemeType.getColorSchemeID());
-
-                    StoreColorType colorType = colorSchemeType.getColor();
-                    ebayResp.put("storeColorPrimary", colorType.getPrimary());
-                    ebayResp.put("storeColorAccent", colorType.getAccent());
-                    ebayResp.put("storeColorSecondary", 
colorType.getSecondary());
-
-                    StoreFontType fontType = colorSchemeType.getFont();
-                    ebayResp.put("storeDescColor", fontType.getDescColor());
-                    ebayResp.put("storeNameColor", fontType.getNameColor());
-                    ebayResp.put("storeTitleColor", fontType.getTitleColor());
-
-                    if (fontType != null) {// basic & advance theme
-                        String themeId = 
themeType.getThemeID().toString().concat("-").concat(colorSchemeType.getColorSchemeID().toString());
-                        context.put("themeId", themeId);
-                        Map<String,Object> results = 
retrieveThemeColorSchemeByThemeId(dctx, context);
-                        if (results != null) {
-                            Map<String,Object> storeFontScheme = 
UtilGenerics.checkMap(results.get("storeFontScheme"));
-                            if (storeFontScheme != null) {
-                                ebayResp.put("storeDescFontFace", 
storeFontScheme.get("storeFontTypeFontDescValue"));
-                                ebayResp.put("storeDescSizeCode", 
storeFontScheme.get("storeDescSizeValue"));
-
-                                ebayResp.put("storeNameFontFace", 
storeFontScheme.get("storeFontTypeFontFaceValue"));
-                                ebayResp.put("storeNameFontFaceSize", 
storeFontScheme.get("storeFontTypeSizeFaceValue"));
-
-                                ebayResp.put("storeTitleFontFace", 
storeFontScheme.get("storeFontTypeFontTitleValue"));
-                                ebayResp.put("storeTitleFontFaceSize", 
storeFontScheme.get("storeFontSizeTitleValue"));
-                            }
-                        }
-                    }
-
-                    StoreHeaderStyleCodeType storeHeaderStyleCodeType = 
returnedStoreType.getHeaderStyle();
-                    ebayResp.put("storeHeaderStyle", 
storeHeaderStyleCodeType.value());
-                    StoreHeaderStyleCodeType[] storeHeaderStyleCodeList =  
StoreHeaderStyleCodeType.values();
-                    if (storeHeaderStyleCodeList != null) {
-                        List<Map<String,Object>> storeHeaderStyleList = new 
LinkedList<Map<String, Object>>();
-                        int i=0;
-                        while (i<storeHeaderStyleCodeList.length) {
-                            Map<String,Object> storeHeaderStyleMap = new 
HashMap<String, Object>();
-                            StoreHeaderStyleCodeType storeHeaderStyleCode = 
storeHeaderStyleCodeList[i];
-                            storeHeaderStyleMap.put("storeHeaderStyleName", 
storeHeaderStyleCode.name());
-                            storeHeaderStyleMap.put("storeHeaderStyleValue", 
storeHeaderStyleCode.value());
-                            storeHeaderStyleList.add(storeHeaderStyleMap);
-                            i++;
-                        }
-                        ebayResp.put("storeHeaderStyleList", 
storeHeaderStyleList);
-                    }
-
-                    ebayResp.put("storeHomePage", 
returnedStoreType.getHomePage().toString());
-
-                    StoreItemListLayoutCodeType storeItemListLayoutCodeType = 
returnedStoreType.getItemListLayout();
-                    ebayResp.put("storeItemLayoutSelected", 
storeItemListLayoutCodeType.value());
-                    StoreItemListLayoutCodeType[] 
storeItemListLayoutCodeTypeList = StoreItemListLayoutCodeType.values();
-                    if (storeItemListLayoutCodeTypeList != null) {
-                        List<Map<String,Object>> storeItemListLayoutCodeList  
= new LinkedList<Map<String, Object>>();
-                        int i = 0;
-                        while (i < storeItemListLayoutCodeTypeList.length) {
-                            Map<String,Object> storeItemListLayoutCodeMap = 
new HashMap<String, Object>();
-                            StoreItemListLayoutCodeType 
storeItemListLayoutCode = storeItemListLayoutCodeTypeList[i];
-                            
storeItemListLayoutCodeMap.put("storeItemLayoutName", 
storeItemListLayoutCode.name());
-                            
storeItemListLayoutCodeMap.put("storeItemLayoutValue", 
storeItemListLayoutCode.value());
-                            
storeItemListLayoutCodeList.add(storeItemListLayoutCodeMap);
-                            i++;
-                        }
-                        ebayResp.put("storeItemLayoutList", 
storeItemListLayoutCodeList);
-                    }
-                    StoreItemListSortOrderCodeType 
storeItemListSortOrderCodeType = returnedStoreType.getItemListSortOrder();
-                    ebayResp.put("storeItemSortOrderSelected", 
storeItemListSortOrderCodeType.value());
-                    StoreItemListSortOrderCodeType[] 
storeItemListSortOrderCodeTypeList = StoreItemListSortOrderCodeType.values();
-                    if (storeItemListSortOrderCodeTypeList != null) {
-                        List<Map<String,Object>> storeItemSortOrderCodeList  = 
new LinkedList<Map<String, Object>>();
-                        int i = 0;
-                        while (i < storeItemListSortOrderCodeTypeList.length) {
-                            Map<String,Object> storeItemSortOrderCodeMap = new 
HashMap<String, Object>();
-                            StoreItemListSortOrderCodeType 
storeItemListLayoutCode = storeItemListSortOrderCodeTypeList[i];
-                            
storeItemSortOrderCodeMap.put("storeItemSortLayoutName", 
storeItemListLayoutCode.name());
-                            
storeItemSortOrderCodeMap.put("storeItemSortLayoutValue", 
storeItemListLayoutCode.value());
-                            
storeItemSortOrderCodeList.add(storeItemSortOrderCodeMap);
-                            i++;
-                        }
-                        ebayResp.put("storeItemSortOrderList", 
storeItemSortOrderCodeList);
-                    }
-
-                    ebayResp.put("storeCustomHeader", 
returnedStoreType.getCustomHeader());
-                    StoreCustomHeaderLayoutCodeType 
storeCustomHeaderLayoutCodeType = returnedStoreType.getCustomHeaderLayout();
-                    ebayResp.put("storeCustomHeaderLayout", 
storeCustomHeaderLayoutCodeType.value());
-                    StoreCustomHeaderLayoutCodeType[] 
storeCustomHeaderLayoutCodeTypeList = StoreCustomHeaderLayoutCodeType.values();
-                    if (storeCustomHeaderLayoutCodeTypeList != null) {
-                        List<Map<String,Object>> storeCustomHeaderLayoutList  
= new LinkedList<Map<String, Object>>();
-                        int i = 0;
-                        while (i < storeCustomHeaderLayoutCodeTypeList.length) 
{
-                            Map<String,Object> storeCustomHeaderLayoutMap = 
new HashMap<String, Object>();
-                            StoreCustomHeaderLayoutCodeType 
StoreCustomHeaderLayoutCode = storeCustomHeaderLayoutCodeTypeList[i];
-                            
storeCustomHeaderLayoutMap.put("storeCustomHeaderLayoutName", 
StoreCustomHeaderLayoutCode.name());
-                            
storeCustomHeaderLayoutMap.put("storeCustomHeaderLayoutValue", 
StoreCustomHeaderLayoutCode.value());
-                            
storeCustomHeaderLayoutList.add(storeCustomHeaderLayoutMap);
-                            i++;
-                        }
-                        ebayResp.put("storeCustomHeaderLayoutList", 
storeCustomHeaderLayoutList);
-                    }
-
-                    StoreCustomListingHeaderType storeCustomListingHeaderType 
= returnedStoreType.getCustomListingHeader();
-                    if (storeCustomListingHeaderType != null) {
-                        StoreCustomListingHeaderDisplayCodeType 
storeCustomListingHeaderDisplayCodeType = 
storeCustomListingHeaderType.getDisplayType();
-                        ebayResp.put("isLogo", 
storeCustomListingHeaderType.isLogo());
-                        ebayResp.put("isSearchBox", 
storeCustomListingHeaderType.isSearchBox());
-                        ebayResp.put("isAddToFavoriteStores", 
storeCustomListingHeaderType.isAddToFavoriteStores());
-                        ebayResp.put("isSignUpForStoreNewsletter", 
storeCustomListingHeaderType.isSignUpForStoreNewsletter());
-
-                        ebayResp.put("storeCustomListingHeaderDisplayName", 
storeCustomListingHeaderDisplayCodeType.name());
-                        ebayResp.put("storeCustomListingHeaderDisplayValue", 
storeCustomListingHeaderDisplayCodeType.value());
-                        StoreCustomListingHeaderDisplayCodeType[] 
storeCustomListingHeaderDisplayCodeTypeList = 
StoreCustomListingHeaderDisplayCodeType.values();
-                        if (storeCustomListingHeaderDisplayCodeTypeList != 
null) {
-                            List<Map<String,Object>> 
storeCustomListingHeaderDisplayCodeList  = new LinkedList<Map<String, 
Object>>();
-                            int i = 0;
-                            while (i < 
storeCustomListingHeaderDisplayCodeTypeList.length) {
-                                Map<String,Object> 
storeCustomListingHeaderDisplayCodeMap = new HashMap<String, Object>();
-                                StoreCustomListingHeaderDisplayCodeType 
storeCustomListingHeaderDisplayCode = 
storeCustomListingHeaderDisplayCodeTypeList[i];
-                                
storeCustomListingHeaderDisplayCodeMap.put("storeCustomHeaderLayoutName", 
storeCustomListingHeaderDisplayCode.name());
-                                
storeCustomListingHeaderDisplayCodeMap.put("storeCustomHeaderLayoutValue", 
storeCustomListingHeaderDisplayCode.value());
-                                
storeCustomListingHeaderDisplayCodeList.add(storeCustomListingHeaderDisplayCodeMap);
-                                i++;
-                            }
-                            
ebayResp.put("storeCustomListingHeaderDisplayList", 
storeCustomListingHeaderDisplayCodeList);
-                        }
-                    }
-
-                    //CustomListingHeader
-                    MerchDisplayCodeType merchDisplayCodeType = 
returnedStoreType.getMerchDisplay();
-                    
ebayResp.put("storeMerchDisplay",merchDisplayCodeType.value());
-                    MerchDisplayCodeType[] merchDisplayCodeTypeList = 
MerchDisplayCodeType.values();
-                    if (merchDisplayCodeTypeList != null) {
-                        List<Map<String,Object>> merchDisplayCodeList = new 
LinkedList<Map<String, Object>>();
-                        int i = 0;
-                        while (i < merchDisplayCodeTypeList.length) {
-                            Map<String,Object> merchDisplayCodeMap = new 
HashMap<String, Object>();
-                            MerchDisplayCodeType merchDisplayCode = 
merchDisplayCodeTypeList[i];
-                            merchDisplayCodeMap.put("merchDisplayCodeName", 
merchDisplayCode.name());
-                            merchDisplayCodeMap.put("merchDisplayCodeValue", 
merchDisplayCode.value());
-                            merchDisplayCodeList.add(merchDisplayCodeMap);
-                            i++;
-                        }
-                        
ebayResp.put("storeMerchDisplayList",merchDisplayCodeList);
-                    }
-
-                    Calendar calendar = returnedStoreType.getLastOpenedTime();
-                    ebayResp.put("storeLastOpenedTime", 
calendar.getTime().toString());
-                    ebayResp.put("storeSubscriptionLevel", 
returnedStoreType.getSubscriptionLevel().value());
-                    returnedStoreType.getSubscriptionLevel();
-                    StoreSubscriptionLevelCodeType[] 
storeSubscriptionlevelList = StoreSubscriptionLevelCodeType.values();
-                    if (storeSubscriptionlevelList != null) {
-                        List<Map<String,Object>> 
storeSubscriptionLevelCodeList = new LinkedList<Map<String, Object>>();
-                        int i = 0;
-                        while (i < storeSubscriptionlevelList.length) {
-                            Map<String,Object> storeSubscriptionLevelCodeMap = 
new HashMap<String, Object>();
-                            StoreSubscriptionLevelCodeType 
storeSubscriptionLevelCode= storeSubscriptionlevelList[i];
-                            
storeSubscriptionLevelCodeMap.put("storeSubscriptionLevelCodeName", 
storeSubscriptionLevelCode.name());
-                            
storeSubscriptionLevelCodeMap.put("storeSubscriptionLevelCodeValue", 
storeSubscriptionLevelCode.value());
-                            
storeSubscriptionLevelCodeList.add(storeSubscriptionLevelCodeMap);
-                            i++;
-                        }
-                        ebayResp.put("storeSubscriptionLevelList", 
storeSubscriptionLevelCodeList);
-                    }
-
-                    result.put("ebayStore", ebayResp);
-                } else {
-                    EbayStoreHelper.createErrorLogMessage(userLogin, 
dctx.getDispatcher(), context.get("productStoreId").toString(), 
resp.getAck().toString(), "Get store : getEbayStoreOutput", 
resp.getErrors(0).getLongMessage());
-                    result.put(ModelService.RESPONSE_MESSAGE, 
ModelService.RESPOND_ERROR);
-                    result.put(ModelService.ERROR_MESSAGE, 
resp.getAck().toString() +":"+ resp.getMessage());
-                }
-            } catch (ApiException e) {
-                result.put(ModelService.RESPONSE_MESSAGE, 
ModelService.RESPOND_ERROR);
-                result.put(ModelService.ERROR_MESSAGE, e.getMessage());
-            } catch (SdkSoapException e) {
-                result.put(ModelService.RESPONSE_MESSAGE, 
ModelService.RESPOND_ERROR);
-                result.put(ModelService.ERROR_MESSAGE, e.getMessage());
-            } catch (SdkException e) {
-                result.put(ModelService.RESPONSE_MESSAGE, 
ModelService.RESPOND_ERROR);
-                result.put(ModelService.ERROR_MESSAGE, e.getMessage());
-            }
-        }
-        return result;
-    }
-
-    public static void updateProductStore(DispatchContext dctx, 
Map<String,Object> context, StoreType returnStoreType, String productStoreId) {
-        LocalDispatcher dispatcher = dctx.getDispatcher();
-        try {
-            Map<String,Object> inMap = new HashMap<String, Object>();
-            if (returnStoreType != null) {
-                inMap.put("productStoreId", productStoreId);
-                inMap.put("storeName", returnStoreType.getName());
-                inMap.put("subtitle", returnStoreType.getDescription());
-                inMap.put("title", returnStoreType.getName());
-                inMap.put("userLogin", context.get("userLogin"));
-                dispatcher.runSync("updateProductStore", inMap);
-            }
-        } catch (Exception e) {
-            Debug.logError("error message"+e, module);
-        }
-    }
-
-    public static Map<String,Object> 
retrieveThemeColorSchemeByThemeId(DispatchContext dctx, Map<String,Object> 
context) {
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Locale locale = (Locale) context.get("locale");
-        Delegator delegator = dctx.getDelegator();
-        Map<String,Object> result = new HashMap<String, Object>();
-        GetStoreOptionsRequestType req = null;
-        GetStoreOptionsResponseType resp  = null;
-        StoreThemeArrayType returnedBasicThemeArray = null;
-
-        try {
-            if (context.get("productStoreId") != null) {
-                String themeId = (String)context.get("themeId");
-
-                GetStoreOptionsCall  call = new 
GetStoreOptionsCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
 locale, delegator));
-                req = new GetStoreOptionsRequestType();
-
-                resp = (GetStoreOptionsResponseType) call.execute(req);
-                if (resp != null && 
"SUCCESS".equals(resp.getAck().toString())) {
-
-                    returnedBasicThemeArray = resp.getBasicThemeArray();
-                    StoreThemeType[] storeBasicTheme = 
returnedBasicThemeArray.getTheme();
-
-                    int i = 0;
-                    String colorSchemeId = 
themeId.substring(themeId.indexOf("-") + 1);
-                    themeId = themeId.substring(0,themeId.indexOf("-"));
-
-                    Map<String,Object> storeColorSchemeMap = null;
-                    while (i < storeBasicTheme.length) {
-                        StoreThemeType storeThemeType = storeBasicTheme[i];
-                        if 
(themeId.equals(storeThemeType.getThemeID().toString())) {
-                            StoreColorSchemeType colorSchemeType = 
storeThemeType.getColorScheme();
-                            if (colorSchemeType != null) {
-                                if 
(colorSchemeId.equals(colorSchemeType.getColorSchemeID().toString())) {
-                                    // get font,size and color
-                                    storeColorSchemeMap = new HashMap<String, 
Object>();
-                                    StoreFontType storeFontType = 
colorSchemeType.getFont();
-                                    
storeColorSchemeMap.put("storeFontTypeFontFaceValue", 
storeFontType.getNameFace().value());
-                                    
storeColorSchemeMap.put("storeFontTypeSizeFaceValue", 
storeFontType.getNameSize().value());
-
-                                    
storeColorSchemeMap.put("storeFontTypeFontTitleValue", 
storeFontType.getTitleFace().value());
-                                    
storeColorSchemeMap.put("storeFontSizeTitleValue", 
storeFontType.getTitleSize().value());
-
-                                    
storeColorSchemeMap.put("storeFontTypeFontDescValue", 
storeFontType.getDescFace().value());
-                                    
storeColorSchemeMap.put("storeDescSizeValue", 
storeFontType.getDescSize().value());
-                                    break;
-                                }
-                            }
-                        }
-                        i++;
-                    }
-                    result.put("storeFontScheme", storeColorSchemeMap);
-                } else {
-                    EbayStoreHelper.createErrorLogMessage(userLogin, 
dctx.getDispatcher(), context.get("productStoreId").toString(), 
resp.getAck().toString(), "Get store option : 
retrieveThemeColorSchemeByThemeId", resp.getErrors(0).getLongMessage());
-                }
-            }
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (SdkSoapException e) {
-            e.printStackTrace();
-        } catch (SdkException e) {
-            e.printStackTrace();
-        }
-        return result;
-    }
-
-    public static Map<String,Object> 
retrievePredesignedLogoOption(DispatchContext dctx, Map<String,Object> context) 
{
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Map<String,Object> result = new HashMap<String, Object>();
-        Locale locale = (Locale) context.get("locale");
-        Delegator delegator = dctx.getDelegator();
-        GetStoreOptionsRequestType req = null;
-        StoreLogoArrayType returnedLogoArray = null;
-        GetStoreOptionsResponseType resp  = null;
-        try {
-            if (context.get("productStoreId") != null) {
-                GetStoreOptionsCall  call = new 
GetStoreOptionsCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
 locale, delegator));
-                req = new GetStoreOptionsRequestType();
-
-                resp = (GetStoreOptionsResponseType) call.execute(req);
-
-                if (resp != null && 
"SUCCESS".equals(resp.getAck().toString())) {
-                    returnedLogoArray = resp.getLogoArray();
-
-                    int i = 0;
-                    List<Map<String,Object>> logoList = new 
LinkedList<Map<String, Object>>();
-                    while (i < returnedLogoArray.getLogoLength()) {
-                        Map<String,Object> logo  = new HashMap<String, 
Object>();
-                        StoreLogoType storeLogoType = 
returnedLogoArray.getLogo(i);
-                        logo.put("storeLogoId", storeLogoType.getLogoID());
-                        logo.put("storeLogoName", storeLogoType.getName());
-                        logo.put("storeLogoURL", storeLogoType.getURL());
-                        logoList.add(logo);
-                        i++;
-                    }
-                    result = 
ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, 
"EbayStoreLoadLogoSuccess", locale));
-                    result.put("storeLogoOptList", logoList);
-                } else {
-                    EbayStoreHelper.createErrorLogMessage(userLogin, 
dctx.getDispatcher(), context.get("productStoreId").toString(), 
resp.getAck().toString(), "Get store option : retrievePredesignedLogoOption", 
resp.getErrors(0).getLongMessage());
-                }
-            }
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (SdkSoapException e) {
-            e.printStackTrace();
-        } catch (SdkException e) {
-            e.printStackTrace();
-        }
-        return result;
-    }
-
-    public static Map<String,Object> retrieveBasicThemeArray(DispatchContext 
dctx, Map<String,Object> context) {
-        Map<String,Object> result = new HashMap<String, Object>();
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Locale locale = (Locale) context.get("locale");
-        Delegator delegator = dctx.getDelegator();
-        GetStoreOptionsRequestType req = null;
-        StoreThemeArrayType returnedBasicThemeArray = null;
-        GetStoreOptionsResponseType resp  = null;
-        try {
-            if (context.get("productStoreId") != null) {
-                GetStoreOptionsCall  call = new 
GetStoreOptionsCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
 locale, delegator));
-                req = new GetStoreOptionsRequestType();
-
-                resp = (GetStoreOptionsResponseType) call.execute(req);
-
-                StoreColorSchemeType storeFontColorSchemeType = null;
-                if (resp != null && 
"SUCCESS".equals(resp.getAck().toString())) {
-                    returnedBasicThemeArray = resp.getBasicThemeArray();
-                    int i = 0;
-                    List<Map<String,Object>> themeList = new 
LinkedList<Map<String, Object>>();
-                    while (i < returnedBasicThemeArray.getThemeLength()) {
-                        Map<String,Object> basictheme  = new HashMap<String, 
Object>();
-                        StoreThemeType storeBasicThemeType = 
returnedBasicThemeArray.getTheme(i);
-                        basictheme.put("storeThemeId", 
storeBasicThemeType.getThemeID());
-                        basictheme.put("storeThemeName", 
storeBasicThemeType.getName());
-
-                        StoreColorSchemeType storeColorSchemeType = 
storeBasicThemeType.getColorScheme();
-                        
basictheme.put("storeColorSchemeId",storeColorSchemeType.getColorSchemeID());
-                        
basictheme.put("storeColorSchemeName",storeColorSchemeType.getName());
-
-                        if (storeFontColorSchemeType == null) {
-                            storeFontColorSchemeType = 
storeBasicThemeType.getColorScheme();
-                        }
-                        themeList.add(basictheme);
-                        i++;
-                    }
-                    result = 
ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, 
"EbayStoreLoadBasicThemeSuccess", locale));
-                    result.put("storeThemeList", themeList);
-                } else {
-                    EbayStoreHelper.createErrorLogMessage(userLogin, 
dctx.getDispatcher(), context.get("productStoreId").toString(), 
resp.getAck().toString(), "Get store option : retrieveBasicThemeArray", 
resp.getErrors(0).getLongMessage());
-                }
-            }
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (SdkSoapException e) {
-            e.printStackTrace();
-        } catch (SdkException e) {
-            e.printStackTrace();
-        }
-        return result;
-    }
-
-    public static Map<String,Object> 
retrieveAdvancedThemeArray(DispatchContext dctx, Map<String,Object> context) {
-        Map<String,Object> result = new HashMap<String, Object>();
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Locale locale = (Locale) context.get("locale");
-        Delegator delegator = dctx.getDelegator();
-        GetStoreOptionsRequestType req = null;
-        StoreThemeArrayType returnedAdvancedThemeArray = null;
-        GetStoreOptionsResponseType resp  = null;
-        try {
-            if (context.get("productStoreId") != null) {
-                GetStoreOptionsCall  call = new 
GetStoreOptionsCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
 locale, delegator));
-                req = new GetStoreOptionsRequestType();
-
-                resp = (GetStoreOptionsResponseType) call.execute(req);
-
-                if (resp != null && 
"SUCCESS".equals(resp.getAck().toString())) {
-                    result = 
ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, 
"EbayStoreLoadAdvancedThemeSuccess", locale));
-
-                    returnedAdvancedThemeArray = resp.getAdvancedThemeArray();
-
-                    int i = 0;
-                    List<Map<String,Object>> themeList = new 
LinkedList<Map<String, Object>>();
-                    while (i < returnedAdvancedThemeArray.getThemeLength()) {
-                        Map<String,Object> advanceTheme = new HashMap<String, 
Object>();
-                        StoreThemeType storeThemeType = 
returnedAdvancedThemeArray.getTheme(i);
-                        
advanceTheme.put("storeThemeId",storeThemeType.getThemeID());
-                        
advanceTheme.put("storeThemeName",storeThemeType.getName());
-                        themeList.add(advanceTheme);
-                        i++;
-                    }
-                    result.put("storeThemeList", themeList);
-                    int j = 0;
-                    StoreColorSchemeType[] storeColorSchemeTypes = 
returnedAdvancedThemeArray.getGenericColorSchemeArray().getColorScheme();
-                    List<Map<String,Object>> themeColorList = new 
LinkedList<Map<String, Object>>();
-                    while (j < storeColorSchemeTypes.length) {
-                        Map<String,Object> advanceColorTheme = new 
HashMap<String, Object>();
-                        StoreColorSchemeType storeColorSchemeType = 
storeColorSchemeTypes[j];
-                        advanceColorTheme.put("storeColorSchemeId", 
storeColorSchemeType.getColorSchemeID());
-                        advanceColorTheme.put("storeColorName", 
storeColorSchemeType.getName());
-                        themeColorList.add(advanceColorTheme);
-                        j++;
-                    }
-                    result.put("storeAdvancedThemeColorOptList", 
themeColorList);
-                } else {
-                    EbayStoreHelper.createErrorLogMessage(userLogin, 
dctx.getDispatcher(), context.get("productStoreId").toString(), 
resp.getAck().toString(), "Get store option : retrieveAdvancedThemeArray", 
resp.getErrors(0).getLongMessage());
-                }
-                //this.returnedSubscriptionArray = resp.getSubscriptionArray();
-            }
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (SdkSoapException e) {
-            e.printStackTrace();
-        } catch (SdkException e) {
-            e.printStackTrace();
-        }
-        return result;
-    }
-
-    public static Map<String,Object> retrieveStoreFontTheme(DispatchContext 
dctx, Map<String,Object> context) {
-        Map<String,Object> result = new HashMap<String, Object>();
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Locale locale = (Locale) context.get("locale");
-        Delegator delegator = dctx.getDelegator();
-        GetStoreOptionsRequestType req = null;
-        StoreThemeArrayType returnedThemeArray = null;
-        GetStoreOptionsResponseType resp  = null;
-        try {
-            if (context.get("productStoreId") != null) {
-                GetStoreOptionsCall  call = new 
GetStoreOptionsCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
 locale, delegator));
-                req = new GetStoreOptionsRequestType();
-
-                resp = (GetStoreOptionsResponseType) call.execute(req);
-
-                Map<String,Object> advanceFontTheme = new HashMap<String, 
Object>();
-                if (resp != null && 
"SUCCESS".equals(resp.getAck().toString())) {
-                    returnedThemeArray = resp.getAdvancedThemeArray();
-                    int i = 0;
-                    StoreColorSchemeType[] storeColorSchemeTypes = 
returnedThemeArray.getGenericColorSchemeArray().getColorScheme();
-                    while (i < storeColorSchemeTypes.length) {
-
-                        StoreColorSchemeType storeColorSchemeType = 
storeColorSchemeTypes[i];
-                        StoreFontType storeFontType =  
storeColorSchemeType.getFont();
-                        
advanceFontTheme.put("storeFontTypeNameFaceColor",storeFontType.getNameColor());
-                        int j = 0;
-                        storeFontType.getNameFace();
-                        StoreFontFaceCodeType[] storeFontNameFaceCodeTypes = 
StoreFontFaceCodeType.values();
-                        List<Map<String,Object>> nameFaces = new 
LinkedList<Map<String, Object>>();
-                        while (j < storeFontNameFaceCodeTypes.length) {
-                            Map<String,Object> storeFontNameFaceCodeTypeMap = 
new HashMap<String, Object>();
-                            StoreFontFaceCodeType storeFontNameFaceCodeType = 
storeFontNameFaceCodeTypes[j];
-                            storeFontNameFaceCodeTypeMap.put("storeFontValue", 
storeFontNameFaceCodeType.value());
-                            storeFontNameFaceCodeTypeMap.put("storeFontName", 
storeFontNameFaceCodeType.name());
-                            nameFaces.add(storeFontNameFaceCodeTypeMap);
-                            j++;
-                        }
-                        
advanceFontTheme.put("storeFontTypeFontFaceList",nameFaces);
-                        j = 0;
-                        storeFontType.getNameSize();
-                        StoreFontSizeCodeType[] storeFontSizeCodeTypes =  
StoreFontSizeCodeType.values();
-                        List<Map<String,Object>> sizeFaces = new 
LinkedList<Map<String, Object>>();
-                        while (j < storeFontSizeCodeTypes.length) {
-                            Map<String,Object> storeFontSizeCodeTypeMap = new 
HashMap<String, Object>();
-                            StoreFontSizeCodeType storeFontSizeCodeType = 
storeFontSizeCodeTypes[j];
-                            storeFontSizeCodeTypeMap.put("storeFontSizeValue", 
storeFontSizeCodeType.value());
-                            storeFontSizeCodeTypeMap.put("storeFontSizeName", 
storeFontSizeCodeType.name());
-                            sizeFaces.add(storeFontSizeCodeTypeMap);
-                            j++;
-                        }
-                        advanceFontTheme.put("storeFontTypeSizeFaceList", 
sizeFaces);
-
-                        advanceFontTheme.put("storeFontTypeTitleColor", 
storeFontType.getTitleColor());
-                        j = 0;
-                        storeFontType.getTitleFace();
-                        StoreFontFaceCodeType[] storeFontTypeTitleFaces = 
StoreFontFaceCodeType.values();
-                        List<Map<String,Object>> titleFaces = new 
LinkedList<Map<String, Object>>();
-                        while (j < storeFontTypeTitleFaces.length) {
-                            Map<String,Object> storeFontTypeTitleFaceMap = new 
HashMap<String, Object>();
-                            StoreFontFaceCodeType storeFontTypeTitleFace = 
storeFontTypeTitleFaces[j];
-                            storeFontTypeTitleFaceMap.put("storeFontValue", 
storeFontTypeTitleFace.value());
-                            storeFontTypeTitleFaceMap.put("storeFontName", 
storeFontTypeTitleFace.name());
-                            titleFaces.add(storeFontTypeTitleFaceMap);
-                            j++;
-                        }
-                        
advanceFontTheme.put("storeFontTypeFontTitleList",titleFaces);
-
-                        j = 0;
-                        storeFontType.getTitleSize();
-                        StoreFontSizeCodeType[] storeTitleSizeCodeTypes =  
StoreFontSizeCodeType.values();
-                        List<Map<String,Object>> titleSizes = new 
LinkedList<Map<String, Object>>();
-                        while (j < storeTitleSizeCodeTypes.length) {
-                            Map<String,Object> storeFontSizeCodeTypeMap = new 
HashMap<String, Object>();
-                            StoreFontSizeCodeType storeFontSizeCodeType = 
storeTitleSizeCodeTypes[j];
-                            storeFontSizeCodeTypeMap.put("storeFontSizeValue", 
storeFontSizeCodeType.value());
-                            storeFontSizeCodeTypeMap.put("storeFontSizeName", 
storeFontSizeCodeType.name());
-                            titleSizes.add(storeFontSizeCodeTypeMap);
-                            j++;
-                        }
-                        
advanceFontTheme.put("storeFontSizeTitleList",titleSizes);
-
-
-                        advanceFontTheme.put("storeFontTypeDescColor", 
storeFontType.getDescColor());
-                        j = 0;
-                        storeFontType.getDescFace();
-                        StoreFontFaceCodeType[] storeFontTypeDescFaces = 
StoreFontFaceCodeType.values();
-                        List<Map<String,Object>> descFaces = new 
LinkedList<Map<String, Object>>();
-                        while (j < storeFontTypeDescFaces.length) {
-                            Map<String,Object> storeFontTypeDescFaceMap = new 
HashMap<String, Object>();
-                            StoreFontFaceCodeType storeFontTypeDescFace = 
storeFontTypeDescFaces[j];
-                            storeFontTypeDescFaceMap.put("storeFontValue", 
storeFontTypeDescFace.value());
-                            storeFontTypeDescFaceMap.put("storeFontName", 
storeFontTypeDescFace.name());
-                            descFaces.add(storeFontTypeDescFaceMap);
-                            j++;
-                        }
-                        
advanceFontTheme.put("storeFontTypeFontDescList",descFaces);
-
-                        j = 0;
-                        storeFontType.getDescSize();
-                        StoreFontSizeCodeType[] storeDescSizeCodeTypes =   
StoreFontSizeCodeType.values();
-                        List<Map<String,Object>> descSizes = new 
LinkedList<Map<String, Object>>();
-                        while (j < storeDescSizeCodeTypes.length) {
-                            Map<String,Object> storeFontSizeCodeTypeMap = new 
HashMap<String, Object>();
-                            StoreFontSizeCodeType storeFontSizeCodeType = 
storeDescSizeCodeTypes[j];
-                            storeFontSizeCodeTypeMap.put("storeFontSizeValue", 
storeFontSizeCodeType.value());
-                            storeFontSizeCodeTypeMap.put("storeFontSizeName", 
storeFontSizeCodeType.name());
-                            descSizes.add(storeFontSizeCodeTypeMap);
-                            j++;
-                        }
-                        advanceFontTheme.put("storeDescSizeList",descSizes);
-                        i++;
-                    }
-                    result = 
ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, 
"EbayStoreLoadBasicThemeSuccess", locale));
-                    result.put("advanceFontTheme", advanceFontTheme);
-                } else {
-                    EbayStoreHelper.createErrorLogMessage(userLogin, 
dctx.getDispatcher(), context.get("productStoreId").toString(), 
resp.getAck().toString(), "Get store option : retrieveStoreFontTheme", 
resp.getErrors(0).getLongMessage());
-                }
-            }
-        } catch (ApiException e) {
-            e.printStackTrace();
-        } catch (SdkSoapException e) {
-            e.printStackTrace();
-        } catch (SdkException e) {
-            e.printStackTrace();
-        }
-        return result;
-    }
-
-    public static Map<String,Object>  setEbayStoreInput(DispatchContext dctx, 
Map<String,Object> context) {
-        Map<String,Object> result = new HashMap<String, Object>();
-        Locale locale = (Locale) context.get("locale");
-        Delegator delegator = dctx.getDelegator();
-        SetStoreRequestType req = null;
-        SetStoreResponseType resp  = null;
-        StoreType storeType = null;
-        try {
-            if (context.get("productStoreId") != null) {
-                SetStoreCall  call = new 
SetStoreCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"),
 locale, delegator));
-                req = new SetStoreRequestType();
-
-                storeType = new StoreType();
-                storeType.setName((String)context.get("storeName"));
-                storeType.setDescription((String)context.get("storeDesc"));
-                storeType.setURL((String)context.get("storeUrl"));
-                storeType.setURLPath("");
-                StoreLogoType storeLogo = new StoreLogoType();
-                if (context.get("storeLogoURL") == null) {
-                    if (context.get("storeLogoId") != null) 
storeLogo.setLogoID(Integer.parseInt((String)context.get("storeLogoId")));
-                    storeLogo.setName((String)context.get("storeLogoName"));
-                } else {
-                    storeLogo.setURL((String)context.get("storeLogoURL"));
-                }
-                storeType.setLogo(storeLogo);
-
-                StoreThemeType storeTheme = new StoreThemeType();
-                StoreColorSchemeType storeColorScheme = null;
-                StoreColorType storecolor = null;
-                StoreFontType storeFont = null;
-                if (context.get("themeType").equals("Advanced")) {
-                    storeColorScheme = new StoreColorSchemeType();
-                    if (context.get("storeAdvancedThemeColor") != null) 
storeColorScheme.setColorSchemeID(Integer.parseInt((String)context.get("storeAdvancedThemeColor")));
-
-                    storecolor = new StoreColorType();
-                    
storecolor.setPrimary((String)context.get("storePrimaryColor"));
-                    
storecolor.setSecondary((String)context.get("storeSecondaryColor"));
-                    
storecolor.setAccent((String)context.get("storeAccentColor"));
-                    storeColorScheme.setColor(storecolor);
-                    storeTheme.setColorScheme(storeColorScheme);
-                    storeTheme.setName(null);
-                    
storeTheme.setThemeID(Integer.parseInt((String)context.get("storeAdvancedTheme")));
-                } else if (context.get("themeType").equals("Basic")) {
-                    storeColorScheme = new StoreColorSchemeType();
-                    if (context.get("storeBasicTheme")!=null) {
-                        String storeBasicTheme = 
(String)context.get("storeBasicTheme");
-                        String storeThemeId = null;
-                        String storeColorSchemeId = null;
-                        if (storeBasicTheme.indexOf("-") != -1) {
-                            storeThemeId = storeBasicTheme.substring(0, 
storeBasicTheme.indexOf("-"));
-                            storeColorSchemeId = 
storeBasicTheme.substring(storeBasicTheme.indexOf("-")+1);
-                        }
-                        if (storeColorSchemeId != null) 
storeColorScheme.setColorSchemeID(Integer.parseInt(storeColorSchemeId));
-
-                        storecolor = new StoreColorType();
-                        
storecolor.setPrimary((String)context.get("storePrimaryColor"));
-                        
storecolor.setSecondary((String)context.get("storeSecondaryColor"));
-                        
storecolor.setAccent((String)context.get("storeAccentColor"));
-                        storeColorScheme.setColor(storecolor);
-
-                        storeFont = new StoreFontType();
-                        
storeFont.setNameColor((String)context.get("storeNameFontColor"));
-                        
storeFont.setNameFace(StoreFontFaceCodeType.valueOf((String)context.get("storeNameFont")));
-                        
storeFont.setNameSize(StoreFontSizeCodeType.valueOf((String)context.get("storeNameFontSize")));
-
-                        
storeFont.setTitleColor((String)context.get("storeTitleFontColor"));
-                        
storeFont.setTitleFace(StoreFontFaceCodeType.valueOf((String)context.get("storeTitleFont")));
-                        
storeFont.setTitleSize(StoreFontSizeCodeType.valueOf((String)context.get("storeTitleFontSize")));
-
-                        
storeFont.setDescColor((String)context.get("storeDescFontColor"));
-                        
storeFont.setDescFace(StoreFontFaceCodeType.valueOf((String)context.get("storeDescFont")));
-                        
storeFont.setDescSize(StoreFontSizeCodeType.valueOf((String)context.get("storeDescFontSize")));
-
-                        storeColorScheme.setFont(storeFont);
-
-                        storeTheme.setColorScheme(storeColorScheme);
-                        storeTheme.setName(null);
-                        storeTheme.setThemeID(Integer.parseInt(storeThemeId));
-                    }
-                }
-                storeType.setTheme(storeTheme);
-                
storeType.setHeaderStyle(StoreHeaderStyleCodeType.valueOf((String)context.get("storeHeaderStyle")));
-                
storeType.setItemListLayout(StoreItemListLayoutCodeType.valueOf((String)context.get("storeItemLayout")));
-                
storeType.setItemListSortOrder(StoreItemListSortOrderCodeType.valueOf((String)context.get("storeItemSortOrder")));
-                
storeType.setMerchDisplay(MerchDisplayCodeType.valueOf((String)context.get("storeMerchDisplay")));
-                
storeType.setSubscriptionLevel(StoreSubscriptionLevelCodeType.valueOf((String)context.get("storeSubscriptionDisplay")));
-
-                
storeType.setCustomHeader((String)context.get("storeCustomHeader"));
-                
storeType.setCustomHeaderLayout(StoreCustomHeaderLayoutCodeType.valueOf((String)context.get("storeCustomHeaderLayout")));
-
-                req.setStore(storeType);
-                resp = (SetStoreResponseType) call.execute(req);
-
-                if (resp != null && 
"SUCCESS".equals(resp.getAck().toString())) {
-                    result = 
ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, 
"EbayStoreSaveSuccess",locale));
-                } else {
-                    result = ServiceUtil.returnError(resp.getMessage());
-                }
-                LocalDispatcher dispatcher = dctx.getDispatcher();
-                Map<String,Object> results = 
dispatcher.runSync("getEbayStoreOutput",UtilMisc.toMap("productStoreId",(String)
 context.get("productStoreId"),"userLogin",context.get("userLogin")));
-                if (results != null) {
-                    result.put("ebayStore", results.get("ebayStore"));
-                }
-            }
-        } catch (ApiException e) {
-            result = ServiceUtil.returnError(e.getMessage());
-        } catch (SdkSoapException e) {
-            result = ServiceUtil.returnError(e.getMessage());
-        } catch (SdkException e) {
-            result = ServiceUtil.returnError(e.getMessage());
-        } catch (GenericServiceException e) {
-            result = ServiceUtil.returnError(e.getMessage());
-        }
-        return result;
-    }
-
-    public static Map<String, Object> getEbayActiveItems(DispatchContext dctx, 
Map<String, ? extends Object> context) {
-        Map<String, Object> result = new HashMap<String, Object>();
-        Delegator delegator = dctx.getDelegator();
-        Locale locale = (Locale) context.get("locale");
-        String productStoreId = (String) context.get("productStoreId");
-        List<Map<String, Object>> activeItems = new LinkedList<Map<String, 
Object>>();
-        try {
-            ApiContext apiContext = 
EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
-            GetMyeBaySellingCall getMyeBaySellingCall = new 
GetMyeBaySellingCall(apiContext);
-            ItemListCustomizationType activeList = new 
ItemListCustomizationType();
-            getMyeBaySellingCall.setActiveList(activeList );
-            DetailLevelCodeType[] level = {DetailLevelCodeType.RETURN_ALL};
-            getMyeBaySellingCall.setDetailLevel(level);
-            getMyeBaySellingCall.getMyeBaySelling();
-            PaginatedItemArrayType itemListCustomizationType = 
getMyeBaySellingCall.getReturnedActiveList();
-
-            if (itemListCustomizationType != null) {
-                ItemArrayType itemArrayType = 
itemListCustomizationType.getItemArray();
-                int itemArrayTypeSize = itemArrayType.getItemLength();
-                for (int i = 0; i < itemArrayTypeSize; i++) {
-                    Map<String, Object> entry = new HashMap<String, Object>();
-                    ItemType item = itemArrayType.getItem(i);
-                    entry.put("itemId", item.getItemID());
-                    entry.put("title", item.getTitle());
-                    if (item.getPictureDetails() != null) {
-                        String url[] = 
item.getPictureDetails().getPictureURL();
-                        if (url.length != 0) {
-                            entry.put("pictureURL", url[0]);
-                        } else {
-                            entry.put("pictureURL", null);
-                        }
-                    } else {
-                        entry.put("pictureURL", null);
-                    }
-                    entry.put("timeLeft",item.getTimeLeft());
-                    if (item.getBuyItNowPrice() != null) {
-                        entry.put("buyItNowPrice", 
item.getBuyItNowPrice().getValue());

[... 4519 lines stripped ...]

Reply via email to