global class LogAutoSendBatchProduct implements Database.Batchable<sObject> {

	  global LogAutoSendBatchProduct() {}


	      global Database.QueryLocator start(Database.BatchableContext BC) {
    	Integer max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);

        return Database.getQueryLocator(
            [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
                    Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c,Type__c,
                    retry_cnt__c
               FROM BatchIF_Log__c
              WHERE RowDataFlg__c = true
                AND retry_cnt__c != null AND retry_cnt__c > 0 AND retry_cnt__c < :max_cnt AND (Type__c = 'SBG004' OR Type__c = 'SBG005')]
        );
    }

    global void execute(Database.BatchableContext BC, List<BatchIF_Log__c> rowDataList) {
    	String strType_c = null;
    	for (BatchIF_Log__c rowData:rowDataList){
    		strType_c= String.valueOf(rowData.get('Type__c'));
            if (strType_c == 'SBG004'){
                // SBG004WebService.execute(BC,rowDataList);
                SBG004Rest.main(rowData.Id);
            }
            if (strType_c == 'SBG005'){
                // SBG005WebService.execute(BC,rowDataList);
                SBG005Rest.main(rowData.Id);
            }
            
        }
    }

    global void finish(Database.BatchableContext BC) {
        // 今回はやることないです
    }

	  
}