2016-11-12 26 views
0

我創建像條件如下:滴料 - 雙量

$event : EventObject(type=='Sale', $points:points, $playerid:playerid) from 
entry-point eventstream 

這樣的結果,我需要的變量傳遞到以下幾點:

boolean givePointsToPlayer(String playerId, 
         String pointType, 
         double amount, 
         String notificationMessage) 

最簡單的例子下面是我給這個玩家3分

updateAPIv1.givePointsToPlayer($playerid, 'Points', 3, 'Points Awarded'); 
update(engine.getPlayerById($playerid)); 

但是,我想通過$ points:points to'double amoun T」。

簡單的問題我知道,但我怎麼做到最好?就像是?

$points=double amount; 
updateAPIv1.givePointsToPlayer($playerid, 'Points', amount, 'Points Awarded'); 
update(engine.getPlayerById($playerid));; 

欣賞反饋。謝謝。

***更新我也

$event : EventObject(type=='Sale', $points:points, $playerid:playerid) 
      from entry-point eventstream  

updateAPIv1.givePointsToPlayer($playerid, 'Points', $points, 'Points Awarded'); 
update(engine.getPlayerById($playerid));  

嘗試,但我得到以下錯誤此

"Unable to create Field Extractor for 'points' 
    Field/method 'points' not found for class 'com.sap.gamification.model.EventObject" 
    "Rule Compilation error $points cannot be resolved " 

對這個有什麼想法?

回答

0

由於這是一個無效的語句,因此您應該趕快掌握Java語法。

$points=double amount; 

不過,你不需要綁定變量($points)的值存儲在後果另一個變量。你可以寫這個調用:

updateAPIv1.givePointsToPlayer($playerid, 'Points', $points, 'Points Awarded'); 

思考的必然事實領域「最後的」變量變數:你可以訪問值,但不能改變它。

編輯這假定您有:

public class EventObject { 
    private double points; 
    public double getPoints(){ return points; } 
    // ... rest of class 
} 
+0

感謝您的答覆。我已經嘗試過,並沒有奏效,例如:$ event:EventObject(type =='Sale',$ points:points,$ playerid:playerid)from entry-point eventstreamupdateAPIv1.givePointsToPlayer($ playerid,'Points', $積分,'積分獎勵'); update(engine.getPlayerById($ playerid)); – MacAodh

+0

查看更新以上 – MacAodh

+0

請參閱編輯我的答案。 – laune