2012-03-10 21 views
2

私は現在、Apex Workbookを使用してSalesForceの知識をリフレッシュしています。なぜこのSalesForce Batchableクラスを保存できないのですか?

#15チュートリアル、レッスン1:私は、私はこれを保存しようと関係なく、どの開発インターフェース(例えばフォースIDE、コンソール、セットアップ)のIは、使用、しかし

global class CleanUpRecords implements Database.Batchable<Object> 
{ 
    global final String query; 

    global CleanUpRecords (String q) {query = q;} 

    global Database.Querylocator start (Database.BatchableContext BC) 
    { 
      return Database.getQueryLocator(query); 
    }  


    global void execute (Database.BatchableContext BC, List<sObject> scope) 
    { 
     delete scope; 
     Database.emptyRecycleBin(scope); 
    }  

    global void finish(Database.BatchableContext BC) 
    { 
     AsyncApexJob a = [ 
       SELECT Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedBy.Email 
       FROM AsyncApexJob 
       WHERE Id = :BC.getJobId() 
      ]; 

     // Send an email to the Apex job's submitter 
     // notifying of job completion. 
     Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
     String[] toAddresses = new String[] {a.CreatedBy.Email}; 
     mail.setToAddresses(toAddresses); 
     mail.setSubject('Record Clean Up Completed ' + a.Status); 
     mail.setPlainTextBody (
       'The batch Apex job processed ' + a.TotalJobItems + 
       ' batches with '+ a.NumberOfErrors + ' failures.' 
       ); 
     Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 
    } 

} 

:次のコードを提供しています取得:

Multiple markers at this line 
    - File only saved locally, not to server 
    - Save error: CleanUpRecords: Class must implement the global interface method: Iterable<Object> start(Database.BatchableContext) from Database.Batchable<Object>, CleanUpRecords: Class must implement the global interface method: void execute(Database.BatchableContext, LIST<Object>) from 
    Database.Batchable<Object> 

(または同等のものを、私はそれを保存しようとするかに依存する。)

しかし、それは必要なメソッドがすでに存在している私には思えます。

何が欠けていますか?

+0

私はこのDatabase.Batchable を試してみました。しかし、それは私に同じエラーを与えました。私はジェネリックスはあなたが任意のオブジェクトを使用できることを意味します。しかし、その後、私はこれがApexコードであることに気付きました。ご質問ありがとうございます。 :-) –

答えて

6

不満を抱くように準備する...ただ1人のキャラクターしかいない。

あなたのクラス宣言は次のようになります。

global class CleanUpRecords implements Database.Batchable<sObject> { 

の代わり:

global class CleanUpRecords implements Database.Batchable<Object> { 
+0

大きなキャッチ!乾杯! –

関連する問題