Package com.ebay.sdk.call

Examples of com.ebay.sdk.call.ReviseItemCall


        try {
            ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
            String sandboxEPSURL = "https://api.sandbox.ebay.com/ws/api.dll";
            apiContext.setEpsServerUrl(sandboxEPSURL);
            ReviseItemCall api = new ReviseItemCall(apiContext);

            // Set item type.
            ItemType itemToBeRevised = new ItemType();
            itemToBeRevised.setItemID(itemID);

            if (UtilValidate.isNotEmpty(title)) {
                itemToBeRevised.setTitle(title);
            }

            if (UtilValidate.isNotEmpty(description)) {
                itemToBeRevised.setDescription(description);
            }

            // Set startPrice value.
            AmountType startPrice = new AmountType();
            if (UtilValidate.isNotEmpty(price)) {
                startPrice.setValue(Double.parseDouble(price));
                startPrice.setCurrencyID(CurrencyCodeType.valueOf(currencyId));
                itemToBeRevised.setStartPrice(startPrice);
            }

            // Check upload image file.
            if (UtilValidate.isNotEmpty(imageFileName)) {

                // Upload image to ofbiz path /runtime/tmp .
                ByteBuffer byteWrap = (ByteBuffer) context.get("imageData");
                File file = new File(System.getProperty("ofbiz.home"), "runtime" + File.separator + "tmp" + File.separator + imageFileName);
                FileChannel wChannel = new FileOutputStream(file, false).getChannel();
                wChannel.write(byteWrap);
                wChannel.close();

                // Set path file picture to api and set picture details.
                String [] pictureFiles = {System.getProperty("ofbiz.home") + File.separator + "runtime" + File.separator + "tmp" + File.separator + imageFileName};
                PictureDetailsType pictureDetails = new PictureDetailsType();
                pictureDetails.setGalleryType(GalleryTypeCodeType.GALLERY);
                pictureDetails.setPhotoDisplay(PhotoDisplayCodeType.NONE);
                pictureDetails.setPictureSource(PictureSourceCodeType.EPS);
                itemToBeRevised.setPictureDetails(pictureDetails);

                api.setItemToBeRevised(itemToBeRevised);
                api.uploadPictures(pictureFiles, pictureDetails);
            } else {
                api.setItemToBeRevised(itemToBeRevised);
            }
        } catch (Exception e) {
            return ServiceUtil.returnError(e.getMessage());
        }
        return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "EbayStoreUpdateItemSuccessfully", locale));
View Full Code Here


        try {
            ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
            String sandboxEPSURL = "https://api.sandbox.ebay.com/ws/api.dll";
            apiContext.setEpsServerUrl(sandboxEPSURL);
            ReviseItemCall api = new ReviseItemCall(apiContext);

            // Set item type.
            ItemType itemToBeRevised = new ItemType();
            itemToBeRevised.setItemID(itemID);

            if (UtilValidate.isNotEmpty(title)) {
                itemToBeRevised.setTitle(title);
            }

            if (UtilValidate.isNotEmpty(description)) {
                itemToBeRevised.setDescription(description);
            }

            // Set startPrice value.
            AmountType startPrice = new AmountType();
            if (UtilValidate.isNotEmpty(price)) {
                startPrice.setValue(Double.parseDouble(price));
                startPrice.setCurrencyID(CurrencyCodeType.valueOf(currencyId));
                itemToBeRevised.setStartPrice(startPrice);
            }

            // Check upload image file.
            if (UtilValidate.isNotEmpty(imageFileName)) {

                // Upload image to ofbiz path /runtime/tmp .
                ByteBuffer byteWrap = (ByteBuffer) context.get("imageData");
                File file = new File(System.getProperty("ofbiz.home"), "runtime" + File.separator + "tmp" + File.separator + imageFileName);
                FileChannel wChannel = new FileOutputStream(file, false).getChannel();
                wChannel.write(byteWrap);
                wChannel.close();

                // Set path file picture to api and set picture details.
                String [] pictureFiles = {System.getProperty("ofbiz.home") + File.separator + "runtime" + File.separator + "tmp" + File.separator + imageFileName};
                PictureDetailsType pictureDetails = new PictureDetailsType();
                pictureDetails.setGalleryType(GalleryTypeCodeType.GALLERY);
                pictureDetails.setPhotoDisplay(PhotoDisplayCodeType.NONE);
                pictureDetails.setPictureSource(PictureSourceCodeType.EPS);
                itemToBeRevised.setPictureDetails(pictureDetails);

                api.setItemToBeRevised(itemToBeRevised);
                api.uploadPictures(pictureFiles, pictureDetails);
            } else {
                api.setItemToBeRevised(itemToBeRevised);
            }
        } catch (Exception e) {
            return ServiceUtil.returnError(e.getMessage());
        }
        return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "EbayStoreUpdateItemSuccessfully", locale));
View Full Code Here

TOP

Related Classes of com.ebay.sdk.call.ReviseItemCall

Copyright © 2018 www.massapicom. 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.