Exemplo n.º 1
0
  public void execute(JsonActionContext context) throws Exception {
    Map p = context.getParameterMap();

    if (_log.isDebugEnabled()) {
      for (Iterator i = p.entrySet().iterator(); i.hasNext(); ) {
        Map.Entry ent = (Map.Entry) i.next();

        _log.debug("key=" + ent.getKey() + " val=" + ArrayUtil.toString((Object[]) ent.getValue()));
      }
    }

    String name = ((String[]) p.get("name"))[0];
    String desc = ((String[]) p.get("description"))[0];
    long maxWait = Long.parseLong(((String[]) p.get("maxWaitTime"))[0]);
    boolean pausable = Boolean.valueOf(((String[]) p.get("allowPause"))[0]).booleanValue();
    boolean notifyAll = Boolean.valueOf(((String[]) p.get("notifyAll"))[0]).booleanValue();
    boolean repeat = Boolean.valueOf(((String[]) p.get("repeat"))[0]).booleanValue();

    Integer id = Integer.valueOf(((String[]) p.get(ID))[0]);

    EventsBoss eBoss = Bootstrap.getBean(EventsBoss.class);
    Escalation escalation = eBoss.findEscalationById(context.getSessionId(), id);
    JSONObject result;
    try {
      eBoss.updateEscalation(
          context.getSessionId(), escalation, name, desc, maxWait, pausable, notifyAll, repeat);
      result = Escalation.getJSON(escalation);
    } catch (DuplicateObjectException exception) {
      // An escalation by this name already exists show error msg.
      result = new JSONObject();
      result.put("error", "An escalation with this name already exists.");
    }
    context.setJSONResult(new JSONResult(result));
    context.getRequest().setAttribute(Escalation.JSON_NAME, result);
  }
 public void addAIServiceTypeValue(AIServiceTypeValue aiserviceType) {
   AIServiceTypeValue[] newserviceType = {aiserviceType};
   aiServiceTypes = (AIServiceTypeValue[]) ArrayUtil.combine(aiServiceTypes, newserviceType);
 }
 public void addAIServiceValue(AIServiceValue aiservice) {
   AIServiceValue[] newservice = {aiservice};
   _aiservices = (AIServiceValue[]) ArrayUtil.combine(_aiservices, newservice);
 }