Examples of StoreCustomCategoryType


Examples of com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType

                //start at level 0 of categories
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    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 = FastList.newInstance();
                listEdit = FastList.newInstance();
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    if (productCategory != null) {
                        String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator, productCategory.getString("productCategoryId"), context.get("partyId").toString());
                        if (ebayParentCategoryId != null) {
                            List<GenericValue> productCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId", productCategory.getString("productCategoryId")), UtilMisc.toList("sequenceNum ASC"));
                            for (GenericValue productCategoryRollup : productCategoryRollupList) {
                                productCategory = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryRollup.getString("productCategoryId")));
                                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 = FastList.newInstance();
                listEdit = FastList.newInstance();
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    if (productCategory != null) {
                        List<GenericValue> productParentCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productCategory.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"));
                        for (GenericValue productParentCategoryRollup : productParentCategoryRollupList) {
                            String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productParentCategoryRollup.getString("productCategoryId"),context.get("partyId").toString());
                            if (ebayParentCategoryId != null) {
                                List<GenericValue> productChildCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productParentCategoryRollup.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"));
                                for (GenericValue productChildCategoryRollup : productChildCategoryRollupList) {
                                    productCategory = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productChildCategoryRollup.getString("productCategoryId")));
                                    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();
View Full Code Here

Examples of com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType

                    }
                }
                //sort the cats list
                Collections.sort(categories, new Comparator<Object>() {
                    public int compare(Object a, Object b) {
                        StoreCustomCategoryType cat1 = (StoreCustomCategoryType) a;
                        StoreCustomCategoryType cat2 = (StoreCustomCategoryType) b;
                        int catId1 = Integer.parseInt(Long.toString(cat1.getCategoryID()));
                        int catId2 = Integer.parseInt(Long.toString(cat2.getCategoryID()));
                        return catId1 - catId2;
                    }
                });
            }
        }
View Full Code Here

Examples of com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType

                //start at level 0 of categories
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    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 = FastList.newInstance();
                listEdit = FastList.newInstance();
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    if (productCategory != null) {
                        String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator, productCategory.getString("productCategoryId"), context.get("partyId").toString());
                        if (ebayParentCategoryId != null) {
                            List<GenericValue> productCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId", productCategory.getString("productCategoryId")), UtilMisc.toList("sequenceNum ASC"));
                            for (GenericValue productCategoryRollup : productCategoryRollupList) {
                                productCategory = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryRollup.getString("productCategoryId")));
                                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 = FastList.newInstance();
                listEdit = FastList.newInstance();
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    if (productCategory != null) {
                        List<GenericValue> productParentCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productCategory.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"));
                        for (GenericValue productParentCategoryRollup : productParentCategoryRollupList) {
                            String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productParentCategoryRollup.getString("productCategoryId"),context.get("partyId").toString());
                            if (ebayParentCategoryId != null) {
                                List<GenericValue> productChildCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productParentCategoryRollup.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"));
                                for (GenericValue productChildCategoryRollup : productChildCategoryRollupList) {
                                    productCategory = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productChildCategoryRollup.getString("productCategoryId")));
                                    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();
View Full Code Here

Examples of com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType

                    }
                }
                //sort the cats list
                Collections.sort(categories, new Comparator<Object>() {
                    public int compare(Object a, Object b) {
                        StoreCustomCategoryType cat1 = (StoreCustomCategoryType) a;
                        StoreCustomCategoryType cat2 = (StoreCustomCategoryType) b;
                        int catId1 = Integer.parseInt(Long.toString(cat1.getCategoryID()));
                        int catId2 = Integer.parseInt(Long.toString(cat2.getCategoryID()));
                        return catId1 - catId2;
                    }
                });
            }
        }
View Full Code Here

Examples of com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType

                //start at level 0 of categories
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    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);
                }
                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);
                }

                //start at level 1 of categories
                listAdd = FastList.newInstance();
                listEdit = FastList.newInstance();
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    if (productCategory != null) {
                        String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator, productCategory.getString("productCategoryId"), context.get("partyId").toString());
                        if (ebayParentCategoryId != null) {
                            List<GenericValue> productCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId", productCategory.getString("productCategoryId")), UtilMisc.toList("sequenceNum ASC"));
                            for (GenericValue productCategoryRollup : productCategoryRollupList) {
                                productCategory = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryRollup.getString("productCategoryId")));
                                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);
                        }
                        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);
                        }
                    }
                }
                //start at level 2 of categories
                listAdd = FastList.newInstance();
                listEdit = FastList.newInstance();
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    if (productCategory != null) {
                        List<GenericValue> productParentCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productCategory.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"));
                        for (GenericValue productParentCategoryRollup : productParentCategoryRollupList) {
                            String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productParentCategoryRollup.getString("productCategoryId"),context.get("partyId").toString());
                            if (ebayParentCategoryId != null) {
                                List<GenericValue> productChildCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productParentCategoryRollup.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"));
                                for (GenericValue productChildCategoryRollup : productChildCategoryRollupList) {
                                    productCategory = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productChildCategoryRollup.getString("productCategoryId")));
                                    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();
View Full Code Here

Examples of com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType

                    }
                }
                //sort the cats list
                Collections.sort(categories, new Comparator() {
                    public int compare(Object a, Object b) {
                        StoreCustomCategoryType cat1 = (StoreCustomCategoryType) a;
                        StoreCustomCategoryType cat2 = (StoreCustomCategoryType) b;
                        int catId1 = Integer.parseInt(Long.toString(cat1.getCategoryID()));
                        int catId2 = Integer.parseInt(Long.toString(cat2.getCategoryID()));
                        return catId1 - catId2;
                    }
                });
            }
        }
View Full Code Here

Examples of com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType

                    }
                }
                //sort the cats list
                Collections.sort(categories, new Comparator() {
                    public int compare(Object a, Object b) {
                        StoreCustomCategoryType cat1 = (StoreCustomCategoryType) a;
                        StoreCustomCategoryType cat2 = (StoreCustomCategoryType) b;
                        int catId1 = Integer.parseInt(Long.toString(cat1.getCategoryID()));
                        int catId2 = Integer.parseInt(Long.toString(cat2.getCategoryID()));
                        return catId1 - catId2;
                    }
                });
            }
        }
View Full Code Here

Examples of com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType

                //start at level 0 of categories
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    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);
                }
                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);
                }

                //start at level 1 of categories
                listAdd = FastList.newInstance();
                listEdit = FastList.newInstance();
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    if (productCategory != null) {
                        String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator, productCategory.getString("productCategoryId"), context.get("partyId").toString());
                        if (ebayParentCategoryId != null) {
                            List<GenericValue> productCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId", productCategory.getString("productCategoryId")), UtilMisc.toList("sequenceNum ASC"));
                            for (GenericValue productCategoryRollup : productCategoryRollupList) {
                                productCategory = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryRollup.getString("productCategoryId")));
                                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);
                        }
                        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);
                        }
                    }
                }
                //start at level 2 of categories
                listAdd = FastList.newInstance();
                listEdit = FastList.newInstance();
                for (GenericValue catalogCategory : catalogCategories) {
                    GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory");
                    if (productCategory != null) {
                        List<GenericValue> productParentCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productCategory.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"));
                        for (GenericValue productParentCategoryRollup : productParentCategoryRollupList) {
                            String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productParentCategoryRollup.getString("productCategoryId"),context.get("partyId").toString());
                            if (ebayParentCategoryId != null) {
                                List<GenericValue> productChildCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productParentCategoryRollup.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"));
                                for (GenericValue productChildCategoryRollup : productChildCategoryRollupList) {
                                    productCategory = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productChildCategoryRollup.getString("productCategoryId")));
                                    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();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.