@Override
 public synchronized void addTrigger(Trigger t) throws TriggerLoaderException {
   t.setTriggerId(triggerCount);
   t.setLastModifyTime(System.currentTimeMillis());
   triggers.put(t.getTriggerId(), t);
   triggerCount++;
 }
Exemplo n.º 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;
  }
Exemplo n.º 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);
 }
Exemplo n.º 4
0
 @Override
 public String getDescription() {
   return "create another: " + trigger.getDescription();
 }