@Override public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData) throws FormException { return formData.optBoolean("specified") ? super.newInstance(req, formData) : null; }
@Override public UserProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException { return new UserSearchProperty(formData.optBoolean("insensitiveSearch")); }
JSONObject json = req.getSubmittedForm(); makeDisabled(json.optBoolean("disable")); if(json.optBoolean("hasCustomQuietPeriod", json.has("quiet_period"))) { quietPeriod = json.optInt("quiet_period"); } else { if(json.optBoolean("hasCustomScmCheckoutRetryCount", json.has("scmCheckoutRetryCount"))) { scmCheckoutRetryCount = json.optInt("scmCheckoutRetryCount"); } else { blockBuildWhenDownstreamBuilding = json.optBoolean("blockBuildWhenDownstreamBuilding"); blockBuildWhenUpstreamBuilding = json.optBoolean("blockBuildWhenUpstreamBuilding"); } else if(json.optBoolean("hasCustomWorkspace", json.has("customWorkspace"))) { customWorkspace = Util.fixEmptyAndTrim(json.optString("customWorkspace")); } else { scmCheckoutStrategy = null; if(json.optBoolean("hasSlaveAffinity", json.has("label"))) { assignedNode = Util.fixEmptyAndTrim(json.optString("label")); } else if(req.hasParameter("_.assignedLabelString")) { concurrentBuild = json.optBoolean("concurrentBuild");
JSONObject json = req.getSubmittedForm(); synchronized (this) { recurse = json.optBoolean("recurse", true); jobNames.clear(); Iterable<? extends TopLevelItem> items;
if (json.has("useSecurity")) { JSONObject security = json.getJSONObject("useSecurity"); j.setDisableRememberMe(security.optBoolean("disableRememberMe", false)); j.setSecurityRealm(SecurityRealm.all().newInstanceFromRadioList(security, "realm")); j.setAuthorizationStrategy(AuthorizationStrategy.all().newInstanceFromRadioList(security, "authorization"));
public boolean optBoolean(String key, boolean defaultValue) { return jsonObject.optBoolean(key, defaultValue); }
public boolean optBoolean(String key) { return jsonObject.optBoolean(key); }
@Override public boolean configure(StaplerRequest req, JSONObject json) throws FormException { androidHome = json.optString("androidHome"); shouldInstallSdk = json.optBoolean("shouldInstallSdk", true); shouldKeepInWorkspace = json.optBoolean("shouldKeepInWorkspace", false); save(); return true; }
@Override public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData) throws FormException { return formData.optBoolean("specified") ? super.newInstance(req, formData) : null; }
public boolean optBoolean(String arg0) { return getJSONObject().optBoolean(arg0); } public double optDouble(String arg0, double arg1) {
@Override public EnvInjectJobProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException { if (formData.optBoolean("on")) { return (EnvInjectJobProperty)super.newInstance(req, formData); } return null; }
@Override public UserProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException { return new UserSearchProperty(formData.optBoolean("insensitiveSearch")); }
public boolean optBoolean(String arg0, boolean arg1) { return getJSONObject().optBoolean(arg0, arg1); } public boolean optBoolean(String arg0) {
protected static ContentViewLayout getContentViewLayoutFromJSON(JSONObject jsonCvLayout) { if (jsonCvLayout == null || jsonCvLayout.isNullObject()) { return null; } String name = jsonCvLayout.optString("name", null); String title = jsonCvLayout.optString("title", null); boolean translateTitle = jsonCvLayout.optBoolean("translateTitle"); String iconPath = jsonCvLayout.optString("iconPath", null); boolean showCSVExport = jsonCvLayout.optBoolean("showCSVExport"); return new ContentViewLayoutImpl(name, title, translateTitle, iconPath, showCSVExport); }
private Analysis parseAnalysis(JSONObject json) { final String state = StringUtils.trimToNull(json.optString("state")); final boolean isSuppressed = json.optBoolean("isSuppressed", false); return new Analysis(state, isSuppressed); }
/*package*/ void configure(StaplerRequest req, JSONObject c) throws Descriptor.FormException, IOException { // apply configuration conditions.rebuild(req,c.optJSONObject("conditions"), PromotionCondition.all()); buildSteps = (List)Descriptor.newInstancesFromHeteroList( req, c, "buildStep", (List) PromotionProcess.getAll()); icon = c.getString("icon"); if (c.optBoolean("hasAssignedLabel")) { assignedLabel = Util.fixEmptyAndTrim(c.optString("assignedLabelString")); } else { assignedLabel = null; } isVisible = c.getString("isVisible"); save(); }
@DataBoundConstructor public MailAccount(JSONObject jo){ address = nullify(jo.optString("address", null)); smtpHost = nullify(jo.optString("smtpHost", null)); smtpPort = nullify(jo.optString("smtpPort", null)); if(jo.optBoolean("auth", false)){ smtpUsername = nullify(jo.optString("smtpUsername", null)); smtpPassword = Secret.fromString(jo.optString("smtpPassword", null)); } useSsl = jo.optBoolean("useSsl", false); advProperties = nullify(jo.optString("advProperties", null)); }
@SuppressWarnings("deprecation") @Override protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, Descriptor.FormException { super.submit(req, rsp); JSONObject json = req.getSubmittedForm(); definition = req.bindJSON(FlowDefinition.class, json.getJSONObject("definition")); authToken = hudson.model.BuildAuthorizationToken.create(req); if (req.getParameter("hasCustomQuietPeriod") != null) { quietPeriod = Integer.parseInt(req.getParameter("quiet_period")); } else { quietPeriod = null; } makeDisabled(json.optBoolean("disable")); }
private static boolean isTrueCondition(JSONObject stats, JSONObject node, double purityThreshold, int trueIdx) { String nodeIdx = node.optString("id"); JSONArray nodeValues = stats.optJSONObject(nodeIdx).optJSONArray("counts"); double purity = ((double) nodeValues.optInt(trueIdx)) / stats.optJSONObject(nodeIdx).optInt("count"); return purity >= purityThreshold && node.optBoolean("value"); }
private void init() { crawlerPage.getRequest().setUrl(NEW_TASK); crawlerPage.getRequest().setHttpMethod(HttpMethod.GET); fetcher.run(crawlerPage); String content = crawlerPage.getResponse().getStatus().getContent(); System.out.println(content); JSONObject json = crawlerPage.getResponse().getRespFormatJson(); if (json.optBoolean("success")){ taskid = json.optString("taskid"); status = 0; } }