Activity Forums Salesforce® Discussions Cannot understand meaning of integer ebayBatchesInProgress.get(0).get('batchesInQueue') in Salesforce?

  • Cannot understand meaning of integer ebayBatchesInProgress.get(0).get('batchesInQueue') in Salesforce?

    Posted by Deepak on August 25, 2019 at 3:19 pm

    I am trying to understand a class but cant understand meaning of (Integer)ebayBatchesInProgress.get(0).get('batchesInQueue') in the following program:

    public static void ecommerceSyncMethod(){
            
            // Below executing a logic to judge the pre-queued batches :
            //For Ebay
            Integer numberOfBatchesNotProcessedEbay = 0;
            list<AggregateResult> ebayBatchesInProgress =  [Select Count(id) batchesInQueue
                                                            from AsyncApexJob 
                                                            where (ApexClass.Name = 'BatchToAddEcommerceItemEbay' 
                                                                   OR ApexClass.Name = 'BatchToDelistEcommerceItem'
                                                                   OR ApexClass.Name = 'BatchToUpdateEcommerceItem')
                                                            AND Status IN ('Holding','Holding1','Queued', 'Preparing', 'Processing')
                                                           ];
            
            if(null != ebayBatchesInProgress && !ebayBatchesInProgress.isEmpty()){
                numberOfBatchesNotProcessedEbay = (Integer)ebayBatchesInProgress.get(0).get('batchesInQueue');
            }
            
            //For Amazon
            Integer numberOfBatchesNotProcessedAmazon = 0;
            list<AggregateResult> amazonBatchesInProgress =  [Select Count(id) batchesInQueue
                                                              from AsyncApexJob 
                                                              where ApexClass.Name = 'BatchForEcommerceItemsAmazon' 
                                                              AND Status IN ('Holding','Holding1','Queued', 'Preparing', 'Processing')
                                                             ];
            
            if(null != amazonBatchesInProgress && !amazonBatchesInProgress.isEmpty()){
                numberOfBatchesNotProcessedAmazon = (Integer)amazonBatchesInProgress.get(0).get('batchesInQueue');
            }
            
            //For Watch Facts
            Integer numberOfBatchesNotProcessedWatchFacts = 0;
            list<AggregateResult> watchFactsBatchesInProgress =  [Select Count(id) batchesInQueue
                                                                  from AsyncApexJob 
                                                                  where (ApexClass.Name = 'BatchForEcommerceItemsWatchFacts' 
                                                                         OR ApexClass.Name = 'BatchToDeleteEcommerceItemWatchFacts')
                                                                  AND Status IN ('Holding','Queued', 'Preparing', 'Processing')
                                                                 ];
            
            if(null != watchFactsBatchesInProgress && !watchFactsBatchesInProgress.isEmpty()){
                numberOfBatchesNotProcessedWatchFacts = (Integer)watchFactsBatchesInProgress.get(0).get('batchesInQueue');
            }
            //For CrownAndCaliber
            Integer numberOfBatchesNotProcessedCrownAndCaliber = 0;
            list<AggregateResult> crownAndCaliberBatchesInProgress =  [Select Count(id) batchesInQueue
                                                                       from AsyncApexJob 
                                                                       where ApexClass.Name = 'BatchForEcommerceItemsCrownAndCaliber' 
                                                                       AND Status IN ('Holding','Queued', 'Preparing', 'Processing')
                                                                      ];
            
            if(null != crownAndCaliberBatchesInProgress && !crownAndCaliberBatchesInProgress.isEmpty()){
                numberOfBatchesNotProcessedCrownAndCaliber = (Integer)crownAndCaliberBatchesInProgress.get(0).get('batchesInQueue');
            }
            //For Shopify
            Integer numberOfBatchesNotProcessedShopify = 0;
            list<AggregateResult> shopifyBatchesInProgress =  [Select Count(id) batchesInQueue
                                                               from AsyncApexJob 
                                                               where ApexClass.Name = 'BatchForEcommerceItemsShopify' 
                                                               AND Status IN ('Holding','Queued', 'Preparing', 'Processing')
                                                              ];
            
            if(null != shopifyBatchesInProgress && !shopifyBatchesInProgress.isEmpty()){
                numberOfBatchesNotProcessedShopify = (Integer)shopifyBatchesInProgress.get(0).get('batchesInQueue');
            }
            
            //For Jomashop
            Integer numberOfBatchesNotProcessedJomashop = 0;
            list<AggregateResult> JomashopBatchesInProgress =  [Select Count(id) batchesInQueue
                                                                from AsyncApexJob 
                                                                where ApexClass.Name = 'BatchForEcommerceItemsJomashop' 
                                                                AND Status IN ('Holding','Queued', 'Preparing', 'Processing')
                                                               ];
            
            if(null != JomashopBatchesInProgress && !JomashopBatchesInProgress.isEmpty()){
                numberOfBatchesNotProcessedJomashop = (Integer)JomashopBatchesInProgress.get(0).get('batchesInQueue');
            }
            
            
            //Code to be executed when the schedule class wakes up
            map<id,list<Listing_Event__c>> mapOfProductAddVsListingEventEbay = new map<id,list<Listing_Event__c>>();
            
            map<id,list<Listing_Event__c>> mapOfProductUpdateVsListingEventEbay = new map<id,list<Listing_Event__c>>();
            
            map<id,list<Listing_Event__c>> mapOfProductRemoveVsListingEventEbay = new map<id,list<Listing_Event__c>>();
            
            
            map<id,list<Listing_Event__c>> listingIdVsEventListMapForEitherAddUpdateRemoveOrGetResult = new map<id,list<Listing_Event__c>>();
            map<id,list<Listing_Event__c>> listingIdVsEventListMapForAddUpdateRemoveOrGetResultWatchFacts = new map<id,list<Listing_Event__c>>();
            map<id,list<Listing_Event__c>> listingIdVsEventListMapForAddUpdateOrRemoveCrownAndCaliber = new map<id,list<Listing_Event__c>>();
            map<id,list<Listing_Event__c>> listingIdVsEventListMapForAddUpdateOrRemoveShopify = new map<id,list<Listing_Event__c>>();
            map<id,list<Listing_Event__c>> listingIdVsEventListMapForAddUpdateOrRemoveJomashop = new map<id,list<Listing_Event__c>>();

     

    Deepak replied 4 years, 7 months ago 1 Member · 0 Replies
  • 0 Replies

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos

Popular Salesforce Infographics