public static <Type> JSONValue toJSON(
      Map<String, Type> value, AbstractJsonEncoderDecoder<Type> encoder, Style style) {
    if (value == null) {
      return JSONNull.getInstance();
    }

    switch (style) {
      case DEFAULT:
      case SIMPLE:
        {
          JSONObject rc = new JSONObject();
          for (Entry<String, Type> t : value.entrySet()) {
            rc.put(t.getKey(), encoder.encode(t.getValue()));
          }
          return rc;
        }
      case JETTISON_NATURAL:
        {
          JSONObject rc = new JSONObject();
          JSONArray entries = new JSONArray();
          int i = 0;
          for (Entry<String, Type> t : value.entrySet()) {
            JSONObject entry = new JSONObject();
            entry.put("key", new JSONString(t.getKey()));
            entry.put("value", encoder.encode(t.getValue()));
            entries.set(i++, entry);
          }
          rc.put("entry", entries);
          return rc;
        }
      default:
        throw new UnsupportedOperationException(
            "The encoding style is not yet suppored: " + style.name());
    }
  }
  /**
   * Prepares a JSON object
   *
   * @return JSONObject the whole query
   */
  private JSONObject prepareJSONObject() {

    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("facility", new JSONNumber(facilityId));
    jsonQuery.put("execService", new JSONNumber(execServiceId));
    return jsonQuery;
  }
예제 #3
0
 public JSONValue visit(Comparison<?> comparison) {
   JSONObject o = new JSONObject();
   o.put(OPERATOR, new JSONString(comparison.getOperator()));
   o.put(FIELD, new JSONString(comparison.getField()));
   o.put(VALUE, JSONUtil.toJsonValue(comparison.getValue()));
   return o;
 }
예제 #4
0
 public JSONValue visit(Property property) {
   JSONObject o = new JSONObject();
   o.put("name", new JSONString(property.getName()));
   o.put("type", new JSONString(property.getType()));
   o.put("subproperties", property.getSubproperties().accept(this));
   return o;
 }
예제 #5
0
  public JSONObject asJsonObject() {
    JSONObject object = new JSONObject();
    object.put(IM_PROTOCOL, new JSONString(getProtocol()));
    object.put(IM_ADDRESS, new JSONString(getAddress()));

    return object;
  }
예제 #6
0
  @Override
  public JSONObject toJSONObject() {
    JSONObject object = super.toJSONObject();

    ImageDataFilterChain chain = m_filters;

    if ((null != chain) && (chain.size() > 0)) {
      JSONArray filters = new JSONArray();

      JSONObject filter = new JSONObject();

      filter.put("active", JSONBoolean.getInstance(chain.isActive()));

      for (ImageDataFilter<?> ifilter : chain.getFilters()) {
        if (null != ifilter) {
          JSONObject make = ifilter.toJSONObject();

          if (null != make) {
            filters.set(filters.size(), make);
          }
        }
      }
      filter.put("filters", filters);

      object.put("filter", filter);
    }
    return object;
  }
  /**
   * * Enregistrer les paramètres liés à chaque Element (titre) Params: Les positions de l'elements
   * (X,Y) et son emplacement dans la liste des elements
   *
   * @param last **
   */
  @SuppressWarnings("rawtypes")
  private void ajouterParametre(int emplacement, String name, String option) {

    ArrayList params = (ArrayList) parametres.get(emplacement);
    int k = 0;
    for (int i = 0; i < params.size(); i++) {

      final ArrayList p = (ArrayList) params.get(i);

      /** ****** */
      JSONObject paramAsJSONObjectBis =
          BuildJsonObject.buildJSONObjectParametreBis(
              "-1", "" + p.get(0), "" + p.get(1), "" + emplacement);
      /** ****** */
      formAsJSONObjectBis.put("parametre" + emplacement + i, paramAsJSONObjectBis);
      k = i + 1;
    }
    if (((ArrayList) elements.get(emplacement)).get(0).equals("checkbox")
        || ((ArrayList) elements.get(emplacement)).get(0).equals("radio")) {
      JSONObject paramAsJSONObjectBis =
          BuildJsonObject.buildJSONObjectParametreBis(
              "-1", "libelles", "" + choices.get(Integer.parseInt(name)), "" + emplacement);
      formAsJSONObjectBis.put("parametre" + emplacement + k, paramAsJSONObjectBis);

    } else if (((ArrayList) elements.get(emplacement)).get(0).equals("combobox")) {
      JSONObject paramAsJSONObjectBis =
          BuildJsonObject.buildJSONObjectParametreBis(
              "-1", "libelles", "" + options.get(Integer.parseInt(option)), "" + emplacement);
      formAsJSONObjectBis.put("parametre" + emplacement + k, paramAsJSONObjectBis);
    }

    /** ********* */
  }
 protected JSONObject getJsonComplexTrigger(
     ScheduleType scheduleType,
     MonthOfYear month,
     WeekOfMonth weekOfMonth,
     List<DayOfWeek> daysOfWeek,
     Date startDate,
     Date endDate) {
   JSONObject trigger = new JSONObject();
   trigger.put(
       "uiPassParam",
       new JSONString(scheduleEditorWizardPanel.getScheduleType().name())); // $NON-NLS-1$
   if (month != null) {
     JSONArray jsonArray = new JSONArray();
     jsonArray.set(0, new JSONString(Integer.toString(month.ordinal())));
     trigger.put("monthsOfYear", jsonArray); // $NON-NLS-1$
   }
   if (weekOfMonth != null) {
     JSONArray jsonArray = new JSONArray();
     jsonArray.set(0, new JSONString(Integer.toString(weekOfMonth.ordinal())));
     trigger.put("weeksOfMonth", jsonArray); // $NON-NLS-1$
   }
   if (daysOfWeek != null) {
     JSONArray jsonArray = new JSONArray();
     int index = 0;
     for (DayOfWeek dayOfWeek : daysOfWeek) {
       jsonArray.set(index++, new JSONString(Integer.toString(dayOfWeek.ordinal())));
     }
     trigger.put("daysOfWeek", jsonArray); // $NON-NLS-1$
   }
   addJsonStartEnd(trigger, startDate, endDate);
   return trigger;
 }
예제 #9
0
 /**
  * Prepares a JSON object
  *
  * @return JSONObject the whole query
  */
 private JSONObject prepareJSONObject() {
   JSONObject jsonQuery = new JSONObject();
   jsonQuery.put("securityTeam", new JSONNumber(securityTeamId));
   jsonQuery.put("user", new JSONNumber(userId));
   jsonQuery.put("description", new JSONString(description));
   return jsonQuery;
 }
예제 #10
0
 /**
  * A convenient way to create an options JSONObject. Use SliderOption for keys.
  *
  * @param min - default minimum of the slider
  * @param max - default maximum of the slider
  * @param defaultValues - default points of each anchor
  * @return a JSONObject of Slider options
  */
 public static JSONObject getOptions(int min, int max, int[] defaultValues) {
   JSONObject options = new JSONObject();
   options.put(SliderOption.MIN.toString(), new JSONNumber(min));
   options.put(SliderOption.MAX.toString(), new JSONNumber(max));
   JSONArray vals = intArrayToJSONArray(defaultValues);
   options.put(SliderOption.VALUES.toString(), vals);
   return options;
 }
  protected boolean addBlockoutPeriod(
      final JSONObject schedule, final JsJobTrigger trigger, String urlSuffix) {
    String url = GWT.getHostPageBaseURL() + "api/scheduler/blockout/" + urlSuffix; // $NON-NLS-1$

    RequestBuilder addBlockoutPeriodRequest = new RequestBuilder(RequestBuilder.POST, url);
    addBlockoutPeriodRequest.setHeader("accept", "text/plain"); // $NON-NLS-1$ //$NON-NLS-2$
    addBlockoutPeriodRequest.setHeader(
        "Content-Type", "application/json"); // $NON-NLS-1$ //$NON-NLS-2$
    addBlockoutPeriodRequest.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");

    // Create a unique blockout period name
    final Long duration = trigger.getBlockDuration();
    final String blockoutPeriodName =
        trigger.getScheduleType()
            + Random.nextInt()
            + ":"
            + //$NON-NLS-1$
            /* PentahoSessionHolder.getSession().getName() */ "admin"
            + ":"
            + duration; //$NON-NLS-1$ //$NON-NLS-2$

    // Add blockout specific parameters
    JSONObject addBlockoutParams = schedule;
    addBlockoutParams.put("jobName", new JSONString(blockoutPeriodName)); // $NON-NLS-1$
    addBlockoutParams.put("duration", new JSONNumber(duration)); // $NON-NLS-1$
    addBlockoutParams.put("timeZone", new JSONString(scheduleEditorWizardPanel.getTimeZone()));

    try {
      addBlockoutPeriodRequest.sendRequest(
          addBlockoutParams.toString(),
          new RequestCallback() {
            public void onError(Request request, Throwable exception) {
              MessageDialogBox dialogBox =
                  new MessageDialogBox(
                      Messages.getString("error"),
                      exception.toString(),
                      false,
                      false,
                      true); //$NON-NLS-1$
              dialogBox.center();
              setDone(false);
            }

            public void onResponseReceived(Request request, Response response) {
              if (response.getStatusCode() == Response.SC_OK) {
                if (null != callback) {
                  callback.okPressed();
                }
              }
            }
          });
    } catch (RequestException e) {
      // ignored
    }

    return true;
  }
예제 #12
0
 public void createGame(String title, String creator, boolean withMap, final JsonCallback jcb) {
   JSONObject object = new JSONObject();
   object.put("title", new JSONString(title));
   object.put("creator", new JSONString(creator));
   JSONObject config = new JSONObject();
   object.put("config", config);
   config.put("mapAvailable", JSONBoolean.getInstance(withMap));
   invokeJsonPOST(null, object, jcb);
 }
 protected JSONObject getJsonCronTrigger(String cronString, Date startDate, Date endDate) {
   JSONObject trigger = new JSONObject();
   trigger.put(
       "uiPassParam",
       new JSONString(scheduleEditorWizardPanel.getScheduleType().name())); // $NON-NLS-1$
   trigger.put("cronString", new JSONString(cronString)); // $NON-NLS-1$
   addJsonStartEnd(trigger, startDate, endDate);
   return trigger;
 }
 protected JSONObject getJsonSimpleTrigger(
     int repeatCount, int interval, Date startDate, Date endDate) {
   JSONObject trigger = new JSONObject();
   trigger.put(
       "uiPassParam",
       new JSONString(scheduleEditorWizardPanel.getScheduleType().name())); // $NON-NLS-1$
   trigger.put("repeatInterval", new JSONNumber(interval)); // $NON-NLS-1$
   trigger.put("repeatCount", new JSONNumber(repeatCount)); // $NON-NLS-1$
   addJsonStartEnd(trigger, startDate, endDate);
   return trigger;
 }
예제 #15
0
  /**
   * Prepares a JSON object.
   *
   * @return JSONObject - the whole query
   */
  private JSONObject prepareJSONObject() {
    // query
    JSONObject query = new JSONObject();
    query.put("id", new JSONNumber(appId));

    if (reason != null) {
      query.put("reason", new JSONString(reason));
    }

    return query;
  }
예제 #16
0
  /**
   * Prepares a JSON object
   *
   * @return JSONObject the whole query
   */
  private JSONObject prepareJSONObject() {
    // category
    JSONObject category = new JSONObject();
    category.put("id", new JSONNumber(id));
    category.put("name", new JSONString(name));
    category.put("rank", new JSONNumber(rank));

    // whole JSON query
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("category", category);
    return jsonQuery;
  }
예제 #17
0
  /**
   * Prepares a JSON object
   *
   * @return JSONObject the whole query
   */
  private JSONObject prepareJSONObject() {
    // service
    JSONObject service = new JSONObject();
    service.put("name", new JSONString(serviceName)); // service name as object

    // owner
    JSONNumber owner = new JSONNumber(ownerId); // object json number

    // whole JSON query
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("service", service); // service object
    jsonQuery.put("owner", owner); // owner ID
    return jsonQuery;
  }
예제 #18
0
  private void saveSecuritySettings(final AsyncCallback<Boolean> callback) {
    JSONObject jsNewRoleAssignments = new JSONObject();
    JSONArray jsLogicalRoleAssignments = new JSONArray();
    int x = 0;
    for (Map.Entry<String, List<String>> roleAssignment : newRoleAssignments.entrySet()) {
      JSONArray jsLogicalRoles = new JSONArray();
      int y = 0;
      for (String logicalRoleName : roleAssignment.getValue()) {
        jsLogicalRoles.set(y++, new JSONString(logicalRoleName));
      }
      JSONObject jsRoleAssignment = new JSONObject();
      jsRoleAssignment.put("roleName", new JSONString(roleAssignment.getKey()));
      jsRoleAssignment.put("logicalRoles", jsLogicalRoles);
      jsLogicalRoleAssignments.set(x++, jsRoleAssignment);
    }
    jsNewRoleAssignments.put("logicalRoleAssignments", jsLogicalRoleAssignments);
    RequestBuilder saveSettingRequestBuilder =
        new RequestBuilder(RequestBuilder.PUT, contextURL + "api/userrole/roleAssignments");
    saveSettingRequestBuilder.setHeader(
        "Content-Type", "application/json"); // $NON-NLS-1$//$NON-NLS-2$
    WaitPopup.getInstance().setVisible(true);
    try {
      saveSettingRequestBuilder.sendRequest(
          jsNewRoleAssignments.toString(),
          new RequestCallback() {

            @Override
            public void onError(Request request, Throwable exception) {
              WaitPopup.getInstance().setVisible(false);
              callback.onFailure(exception);
            }

            @Override
            public void onResponseReceived(Request request, Response response) {
              WaitPopup.getInstance().setVisible(false);
              if (response.getStatusCode() == 200) {
                masterRoleMap.putAll(newRoleAssignments);
                newRoleAssignments.clear();
                callback.onSuccess(true);
              } else {
                callback.onSuccess(false);
              }
            }
          });
    } catch (RequestException e) {
      WaitPopup.getInstance().setVisible(false);
      callback.onFailure(e);
    }
  }
예제 #19
0
 protected JSONObject writeBoolean(
     JSONObject jsonObject, String fieldLabel, boolean fieldBoolean) {
   if (jsonObject != null && fieldLabel != null) {
     jsonObject.put(fieldLabel, JSONBoolean.getInstance(fieldBoolean));
   }
   return jsonObject;
 }
예제 #20
0
  private static JSONValue toJSON(SerValue serValue) {
    if (serValue.isString()) {
      return new JSONString(serValue.asString());

    } else if (serValue.isReal()) {
      return new JSONNumber(serValue.asReal());

    } else if (serValue.isArray()) {
      SerArray serArray = serValue.asArray();
      JSONArray jsonArray = new JSONArray();
      for (int i = 0; i != serArray.size(); ++i) {
        jsonArray.set(i, toJSON(serArray.get(i)));
      }
      return jsonArray;

    } else if (serValue.isObject()) {
      SerObject serObject = serValue.asObject();
      JSONObject jsonObject = new JSONObject();
      for (String key : serObject.keySet()) {
        jsonObject.put(key, toJSON(serObject.get(key)));
      }
      return jsonObject;

    } else {
      throw new IllegalArgumentException();
    }
  }
예제 #21
0
 public JSONValue visit(Query query) {
   JSONObject o = new JSONObject();
   if (query.getProperties() != null) {
     o.put(PROPERTIES, query.getProperties().accept(this));
   }
   if (query.getWhere() != null) {
     o.put(WHERE, query.getWhere().accept(this));
   }
   if (query.getOffset() != -1) {
     o.put(OFFSET, new JSONNumber(query.getOffset()));
   }
   if (query.getLimit() != -1) {
     o.put(LIMIT, new JSONNumber(query.getLimit()));
   }
   return o;
 }
  private void rebuildJSON() {
    JSONObject obj = new JSONObject();

    obj.put(base_name, new JSONString(this.items_list.getText()));

    this.current_json = new JSON_Representation(obj);
  }
예제 #23
0
  /**
   * Generates the values from the form
   *
   * @return
   */
  public ArrayList<ApplicationFormItemData> getValues() {
    ArrayList<ApplicationFormItemData> formItemDataList = new ArrayList<ApplicationFormItemData>();

    // goes through all the item generators and retrieves the value
    for (RegistrarFormItemGenerator gen : applFormGenerators) {

      String value = gen.getValue();
      String prefilled = gen.getPrefilledValue();
      JSONObject formItemJSON = new JSONObject(gen.getFormItem());

      // remove text (locale), saves data transfer & removes problem with parsing locale
      formItemJSON.put("i18n", new JSONObject());

      // cast form item back
      ApplicationFormItem formItem = formItemJSON.getJavaScriptObject().cast();

      // prepare package with data
      ApplicationFormItemData data =
          ApplicationFormItemData.construct(
              formItem, formItem.getShortname(), value, prefilled, "");

      formItemDataList.add(data);
    }
    return formItemDataList;
  }
예제 #24
0
  private void addLabelFilters(JSONObject conditionArgs) {
    List<String> include = new ArrayList<String>(), exclude = new ArrayList<String>();

    getIncludeAndExclude(include, exclude, FilterFactory.LABEL_TYPE);

    if (!savedShowInvalid) {
      exclude.add(TestLabelManager.INVALIDATED_LABEL);
    }

    if (!include.isEmpty()) {
      conditionArgs.put("include_labels", Utils.stringsToJSON(include));
    }
    if (!exclude.isEmpty()) {
      conditionArgs.put("exclude_labels", Utils.stringsToJSON(exclude));
    }
  }
예제 #25
0
  public JSONObject buildJsonRequest(ValuesManager form) {
    JSONObject entry = new JSONObject();
    addToJsonObject(entry, FIRST_NAME, form.getValueAsString(FIRST_NAME));
    addToJsonObject(entry, LAST_NAME, form.getValueAsString(LAST_NAME));
    addToJsonObject(entry, NUMBER, form.getValueAsString(NUMBER));

    JSONObject contactInfo = new JSONObject();
    addToJsonObject(contactInfo, JOB_TITLE, form.getValueAsString(JOB_TITLE));
    addToJsonObject(contactInfo, JOB_DEPT, form.getValueAsString(JOB_DEPT));
    addToJsonObject(contactInfo, COMPANY_NAME, form.getValueAsString(COMPANY_NAME));
    addToJsonObject(contactInfo, ASSISTANT_NAME, form.getValueAsString(ASSISTANT_NAME));
    addToJsonObject(contactInfo, CELL_PHONE_NUMBER, form.getValueAsString(CELL_PHONE_NUMBER));
    addToJsonObject(contactInfo, HOME_PHONE_NUMBER, form.getValueAsString(HOME_PHONE_NUMBER));
    addToJsonObject(
        contactInfo, ASSISTANT_PHONE_NUMBER, form.getValueAsString(ASSISTANT_PHONE_NUMBER));
    addToJsonObject(contactInfo, FAX_NUMBER, form.getValueAsString(FAX_NUMBER));
    addToJsonObject(contactInfo, IM_ID, form.getValueAsString(IM_ID));
    addToJsonObject(contactInfo, IM_DISPLAY_ID, form.getValueAsString(IM_DISPLAY_ID));
    addToJsonObject(contactInfo, ALTERNATE_IM_ID, form.getValueAsString(ALTERNATE_IM_ID));
    addToJsonObject(contactInfo, LOCATION, form.getValueAsString(LOCATION));
    addToJsonObject(contactInfo, EMAIL_ADDRESS, form.getValueAsString(EMAIL_ADDRESS));
    addToJsonObject(
        contactInfo, ALTERNATE_EMAIL_ADDRESS, form.getValueAsString(ALTERNATE_EMAIL_ADDRESS));

    JSONObject homeAddress = new JSONObject();
    addToJsonObject(homeAddress, ADDRESS_STREET, form.getValueAsString(HOME_STREET));
    addToJsonObject(homeAddress, ADDRESS_CITY, form.getValueAsString(HOME_CITY));
    addToJsonObject(homeAddress, ADDRESS_STATE, form.getValueAsString(HOME_STATE));
    addToJsonObject(homeAddress, ADDRESS_COUNTRY, form.getValueAsString(HOME_COUNTRY));
    addToJsonObject(homeAddress, ADDRESS_ZIP, form.getValueAsString(HOME_ZIP));
    contactInfo.put(HOME_ADDRESS, homeAddress);

    JSONObject officeAddress = new JSONObject();
    addToJsonObject(officeAddress, ADDRESS_STREET, form.getValueAsString(OFFICE_STREET));
    addToJsonObject(officeAddress, ADDRESS_CITY, form.getValueAsString(OFFICE_CITY));
    addToJsonObject(officeAddress, ADDRESS_STATE, form.getValueAsString(OFFICE_STATE));
    addToJsonObject(officeAddress, ADDRESS_COUNTRY, form.getValueAsString(OFFICE_COUNTRY));
    addToJsonObject(officeAddress, ADDRESS_ZIP, form.getValueAsString(OFFICE_ZIP));
    addToJsonObject(officeAddress, OFFICE_DESIGNATION, form.getValueAsString(OFFICE_DESIGNATION));
    contactInfo.put(OFFICE_ADDRESS, officeAddress);

    entry.put(PhonebookDataSource.CONTACT_INFORMATION, contactInfo);

    JSONObject clientRequestObject = new JSONObject();
    clientRequestObject.put(KEY, entry);
    return clientRequestObject;
  }
예제 #26
0
파일: Store.java 프로젝트: farasmus/betele
  public JSONObject getJSON() {
    JSONObject commandObj = new JSONObject();
    JSONString type = new JSONString(this.getClass().getName());
    JSONString componentID = new JSONString(getComponentID());
    JSONString componentDescription = new JSONString(getComponentDescription());
    JSONString fileName = new JSONString(getFileName());
    JSONNumber xcoor = new JSONNumber(getLeft());
    JSONNumber ycoor = new JSONNumber(getTop());

    commandObj.put("type", type);
    commandObj.put("componentID", componentID);
    commandObj.put("componentDescription", componentDescription);
    commandObj.put("fileName", fileName);
    commandObj.put("xcoor", xcoor);
    commandObj.put("ycoor", ycoor);

    HashMap<String, Port> ports2 = getPorts();
    Collection<Port> values = ports2.values();

    JSONArray ports = new JSONArray();

    for (Port port : values) {
      JSONObject portobj = new JSONObject();
      JSONString porttype = new JSONString(port.getClass().getName());
      JSONArray dataSet = new JSONArray();
      for (DataDefinitionEntry dataDefinitionEntry : port.getDataSet()) {
        JSONObject entry = new JSONObject();
        JSONNumber order = new JSONNumber(dataDefinitionEntry.getOrder());
        JSONString fieldName = new JSONString(dataDefinitionEntry.getFieldName());
        JSONString fieldType = new JSONString(dataDefinitionEntry.getFieldType());
        entry.put("order", order);
        entry.put("fieldName", fieldName);
        entry.put("fieldType", fieldType);
        dataSet.set(dataSet.size(), entry);
      }
      portobj.put("porttype", porttype);
      portobj.put("dataSet", dataSet);
      ports.set(ports.size(), portobj);
    }
    commandObj.put("ports", ports);

    return commandObj;
  }
 /**
  * Returns a JSON representation of the object. This method is the counterpart to the
  * PropertyGroup(String) constructor.
  *
  * @return a JSON object
  */
 @Override
 public JSONObject toJson() {
   JSONObject json = super.toJson();
   List<JSONValue> jsonProperties = new ArrayList<JSONValue>();
   for (JSONMetaDataObject property : properties) {
     jsonProperties.add(property.toJson());
   }
   json.put(PROPERTIES, JsonUtil.buildArray(jsonProperties));
   return json;
 }
  /**
   * Before creating a new schedule, we want to check to see if the schedule that is being created
   * is going to conflict with any one of the blockout periods if one is provisioned.
   *
   * @param schedule
   * @param trigger
   */
  protected void verifyBlockoutConflict(final JSONObject schedule, final JsJobTrigger trigger) {
    String url = GWT.getHostPageBaseURL() + "api/scheduler/blockout/blockstatus"; // $NON-NLS-1$

    RequestBuilder blockoutConflictRequest = new RequestBuilder(RequestBuilder.POST, url);
    blockoutConflictRequest.setHeader("accept", "application/json"); // $NON-NLS-1$ //$NON-NLS-2$
    blockoutConflictRequest.setHeader(
        "Content-Type", "application/json"); // $NON-NLS-1$ //$NON-NLS-2$
    blockoutConflictRequest.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");

    final JSONObject verifyBlockoutParams = schedule;
    verifyBlockoutParams.put("jobName", new JSONString(scheduleName)); // $NON-NLS-1$

    try {
      blockoutConflictRequest.sendRequest(
          verifyBlockoutParams.toString(),
          new RequestCallback() {
            public void onError(Request request, Throwable exception) {
              MessageDialogBox dialogBox =
                  new MessageDialogBox(
                      Messages.getString("error"),
                      exception.toString(),
                      false,
                      false,
                      true); //$NON-NLS-1$
              dialogBox.center();
              setDone(false);
            }

            public void onResponseReceived(Request request, Response response) {
              if (response.getStatusCode() == Response.SC_OK) {
                JsBlockStatus statusResponse =
                    (JsBlockStatus) parseJson(JsonUtils.escapeJsonForEval(response.getText()));

                // Determine if this schedule conflicts all the time or some of the time
                boolean partiallyBlocked =
                    Boolean.parseBoolean(statusResponse.getPartiallyBlocked());
                boolean totallyBlocked = Boolean.parseBoolean(statusResponse.getTotallyBlocked());
                if (partiallyBlocked || totallyBlocked) {
                  promptDueToBlockoutConflicts(totallyBlocked, partiallyBlocked, schedule, trigger);
                } else {
                  // Continue with other panels in the wizard (params, email)
                  handleWizardPanels(schedule, trigger);
                }
              } else {
                handleWizardPanels(schedule, trigger);
              }
            }
          });
    } catch (RequestException e) {
      // ignored
    }

    super.nextClicked();
  }
 @SuppressWarnings("deprecation")
 private JSONObject addJsonStartEnd(JSONObject trigger, Date startDate, Date endDate) {
   trigger.put(
       "startTime",
       new JSONString(
           DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).format(startDate))); // $NON-NLS-1$
   if (endDate != null) {
     endDate.setHours(23);
     endDate.setMinutes(59);
     endDate.setSeconds(59);
   }
   trigger.put(
       "endTime",
       endDate == null
           ? JSONNull.getInstance()
           : new JSONString(
               DateTimeFormat.getFormat(PredefinedFormat.ISO_8601)
                   .format(endDate))); // $NON-NLS-1$
   return trigger;
 }
  protected JSONObject getJsonComplexTrigger(
      ScheduleType scheduleType, MonthOfYear month, int dayOfMonth, Date startDate, Date endDate) {
    JSONObject trigger = new JSONObject();
    trigger.put(
        "uiPassParam",
        new JSONString(scheduleEditorWizardPanel.getScheduleType().name())); // $NON-NLS-1$

    if (month != null) {
      JSONArray jsonArray = new JSONArray();
      jsonArray.set(0, new JSONString(Integer.toString(month.ordinal())));
      trigger.put("monthsOfYear", jsonArray); // $NON-NLS-1$
    }

    JSONArray jsonArray = new JSONArray();
    jsonArray.set(0, new JSONString(Integer.toString(dayOfMonth)));
    trigger.put("daysOfMonth", jsonArray); // $NON-NLS-1$

    addJsonStartEnd(trigger, startDate, endDate);
    return trigger;
  }