/** * Sample Program for ConversionTrackerService ADD. * * @param operation ConversionTrackerOperation * @return ConversionTrackerValues * @throws Exception */ public static List<ConversionTrackerValues> add(ConversionTrackerOperation operation) throws Exception { // ================================================================= // ConversionTrackerService // ================================================================= ConversionTrackerServiceInterface conversionTrackerService = SoapUtils.createServiceInterface( ConversionTrackerServiceInterface.class, ConversionTrackerService.class); System.out.println("############################################"); System.out.println("ConversionTrackerService::mutate(ADD)"); System.out.println("############################################"); Holder<ConversionTrackerReturnValue> addConversionTrackerReturnValueHolder = new Holder<ConversionTrackerReturnValue>(); Holder<List<jp.yahooapis.im.V5.ConversionTrackerService.Error>> addConversionTrackerErrorHolder = new Holder<List<jp.yahooapis.im.V5.ConversionTrackerService.Error>>(); conversionTrackerService.mutate( operation, addConversionTrackerReturnValueHolder, addConversionTrackerErrorHolder); // if error if (addConversionTrackerErrorHolder.value != null && addConversionTrackerErrorHolder.value.size() > 0) { SoapUtils.displayErrors( new ConversionTrackerServiceErrorEntityFactory(addConversionTrackerErrorHolder.value), true); } // response if (addConversionTrackerReturnValueHolder.value != null) { for (ConversionTrackerValues values : addConversionTrackerReturnValueHolder.value.getValues()) { if (values.isOperationSucceeded()) { // display response displayConversionTracker(values.getConversionTracker()); } else { // if error SoapUtils.displayErrors( new ConversionTrackerServiceErrorEntityFactory(values.getError()), true); } } } // Response return addConversionTrackerReturnValueHolder.value.getValues(); }
/** * Sample Program for ConversionTrackerService GET. * * @param selector ConversionTrackerSelector * @return ConversionTrackerValues * @throws Exception */ public static List<ConversionTrackerValues> get(ConversionTrackerSelector selector) throws Exception { // ================================================================= // ConversionTrackerService // ================================================================= ConversionTrackerServiceInterface conversionTrackerService = SoapUtils.createServiceInterface( ConversionTrackerServiceInterface.class, ConversionTrackerService.class); // call API System.out.println("############################################"); System.out.println("ConversionTrackerService::get"); System.out.println("############################################"); Holder<ConversionTrackerPage> getConversionTrackerPageHolder = new Holder<ConversionTrackerPage>(); Holder<List<jp.yahooapis.im.V5.ConversionTrackerService.Error>> getConversionTrackerErrorHolder = new Holder<List<jp.yahooapis.im.V5.ConversionTrackerService.Error>>(); conversionTrackerService.get( selector, getConversionTrackerPageHolder, getConversionTrackerErrorHolder); // if error if (getConversionTrackerErrorHolder.value != null && getConversionTrackerErrorHolder.value.size() > 0) { SoapUtils.displayErrors( new ConversionTrackerServiceErrorEntityFactory(getConversionTrackerErrorHolder.value), true); } // response if (getConversionTrackerErrorHolder.value != null) { for (ConversionTrackerValues values : getConversionTrackerPageHolder.value.getValues()) { if (values.isOperationSucceeded()) { displayConversionTracker(values.getConversionTracker()); } else { SoapUtils.displayErrors( new ConversionTrackerServiceErrorEntityFactory(values.getError()), true); } } } // Response return getConversionTrackerPageHolder.value.getValues(); }
/** * create sample request. * * @param accountId long * @param conversionTrackerValues ConversionTrackerValues * @return ConversionTrackerSelector */ public static ConversionTrackerSelector createSampleGetRequest( long accountId, List<ConversionTrackerValues> conversionTrackerValues) { // Set Selector ConversionTrackerSelector conversionTrackerSelector = new ConversionTrackerSelector(); conversionTrackerSelector.setAccountId(accountId); for (ConversionTrackerValues values : conversionTrackerValues) { conversionTrackerSelector .getConversionTrackerIds() .add(values.getConversionTracker().getConversionTrackerId()); } Paging paging = new Paging(); paging.setStartIndex(1); paging.setNumberResults(20); conversionTrackerSelector.setPaging(paging); return conversionTrackerSelector; }
/** * create sample request. * * @param accountId long * @param campaignValues CampaignValues * @return ConversionTrackerOperation */ public static ConversionTrackerOperation createSampleSetRequest( long accountId, List<ConversionTrackerValues> conversionTrackerValues) { ConversionTrackerOperation setConversionTrackerOperation = new ConversionTrackerOperation(); setConversionTrackerOperation.setAccountId(accountId); setConversionTrackerOperation.setOperator(Operator.SET); for (ConversionTrackerValues values : conversionTrackerValues) { ConversionTracker setConversionTracker = new ConversionTracker(); setConversionTracker.setAccountId(accountId); setConversionTracker.setConversionTrackerId( values.getConversionTracker().getConversionTrackerId()); setConversionTracker.setConversionTrackerName( "SampleConversionTracker_UpdateOn_" + SoapUtils.getCurrentTimestamp()); setConversionTracker.setStatus(ConversionTrackerStatus.DISABLED); setConversionTracker.setCategory(ConversionTrackerCategory.PAGE_VIEW); setConversionTracker.setUserRevenueValue((long) 300); setConversionTracker.setConversionTrackerType(ConversionTrackerType.WEB_CONVERSION); setConversionTrackerOperation.getOperand().add(setConversionTracker); } return setConversionTrackerOperation; }