コード例 #1
0
 @Override
 public synchronized void addTrigger(Trigger t) throws TriggerLoaderException {
   t.setTriggerId(triggerCount);
   t.setLastModifyTime(System.currentTimeMillis());
   triggers.put(t.getTriggerId(), t);
   triggerCount++;
 }
コード例 #2
0
  @Override
  public Object toJson() {
    Map<String, Object> jsonObj = new HashMap<String, Object>();
    jsonObj.put("actionId", actionId);
    jsonObj.put("type", type);
    jsonObj.put("trigger", trigger.toJson());

    return jsonObj;
  }
コード例 #3
0
 @SuppressWarnings("unchecked")
 public static CreateTriggerAction createFromJson(Object obj) throws Exception {
   Map<String, Object> jsonObj = (HashMap<String, Object>) obj;
   if (!jsonObj.get("type").equals(type)) {
     throw new Exception("Cannot create action of " + type + " from " + jsonObj.get("type"));
   }
   String actionId = (String) jsonObj.get("actionId");
   Trigger trigger = Trigger.fromJson(jsonObj.get("trigger"));
   return new CreateTriggerAction(actionId, trigger);
 }
コード例 #4
0
 @Override
 public String getDescription() {
   return "create another: " + trigger.getDescription();
 }