static public String getComment(JSONObject cfg) { if (cfg.containsKey(CONFIG_KEY)) { return cfg.getString(CONFIG_KEY); } return ""; }
protected static boolean hasClaimsThingy(JSONObject config, String key) { JSONObject claims; if (config.containsKey(CLAIMS_KEY)) { claims = config.getJSONObject(CLAIMS_KEY); } else { claims = new JSONObject(); } return claims.containsKey(key); }
public static int getSubjectValue(JSONObject json) { JSONObject api = json.getJSONObject(KEYS_API); JSONObject subject = api.getJSONObject(KEYS_SUBJECT); if (subject.containsKey(SUBJECT_ADMIN)) { return SUBJECT_ADMIN_VALUE; } if (subject.containsKey(SUBJECT_CLIENT)) { return SUBJECT_CLIENT_VALUE; } return SUBJECT_UNKNOWN_VALUE; }
public static Vif vifFromJSON(JSONObject jsonVif) { return getVif(jsonVif.getString("vifType"), jsonVif.containsKey("description") ? jsonVif.getString("description") : null, jsonVif.containsKey("unitOfMeasurement") ? UnitOfMeasurement.fromLabel(jsonVif.getString("unitOfMeasurement")) : null, jsonVif.containsKey("siPrefix") ? SiPrefix.fromLabel(jsonVif.getString("siPrefix")) : null, jsonVif.containsKey("exponent") ? jsonVif.getInt("exponent") : null); }
public StructuralNodeModifier(String config) { super(); JSONObject json = JSONObject.fromObject(config); this.name = json.getString(CONFIG_NAME); this.type = Type.valueOf(json.getString(CONFIG_TYPE)); if (json.containsKey(CONFIG_TYPE)) { pattern = Pattern.compile(json.getString(CONFIG_PATTERN)); } }
@Override public Object processObjectValue(String s, Object o, JsonConfig jsonConfig) { Object po = o; if (o instanceof GregorianCalendar) { po = ((GregorianCalendar) o).getTime(); } JSONObject processedValue = (JSONObject) super.processObjectValue(s, po, jsonConfig); if (!processedValue.isNullObject() && processedValue.containsKey("hours")) { processedValue.element("timeInMillis", ((GregorianCalendar) o).getTimeInMillis()); } return processedValue; }
@Override public void fromJson(JSONObject json) { if (json.containsKey(CHANGE)) { change = new Change(json.getJSONObject(CHANGE)); } if (json.containsKey(PATCH_SET)) { this.patchSet = new PatchSet(json.getJSONObject(PATCH_SET)); } }
void sendTokenInfo(MTWebSocket mtws, String inResponseTo, JSONObject data) { if (data.containsKey("propertyNames")) { sendTokenProperties(mtws, inResponseTo, data); } else { sendTokenRegisterdProperties(mtws, inResponseTo, data); } }
public void fromJSON(JSONObject json) { setName(json.getString("name")); if (json.containsKey("id")) { setId(json.getInt("id")); } } }
private void configureWorkspacesCalculation(JSONObject form){ boolean oldCalculationWorkspace = calculationWorkspace; String oldCountIntervalWorkspace = countIntervalWorkspace; calculationWorkspace = form.containsKey("calculationWorkspace"); countIntervalWorkspace = calculationWorkspace? form.getJSONObject("calculationWorkspace").getString("countIntervalWorkspace") : "0 */6 * * *"; WorkspaceDiskUsageCalculationThread workspaceCalculation = AperiodicWork.all().get(WorkspaceDiskUsageCalculationThread.class); if(!oldCountIntervalWorkspace.equals(countIntervalWorkspace) || oldCalculationWorkspace!=calculationWorkspace) workspaceCalculation.reschedule(); }
private void configureBuildsCalculation(JSONObject form){ boolean oldCalculationBuilds = calculationBuilds; String oldCountIntervalBuilds = countIntervalBuilds; calculationBuilds = form.containsKey("calculationBuilds"); countIntervalBuilds = calculationBuilds? form.getJSONObject("calculationBuilds").getString("countIntervalBuilds") : "0 */6 * * *"; BuildDiskUsageCalculationThread buildCalculation = AperiodicWork.all().get(BuildDiskUsageCalculationThread.class); if(!oldCountIntervalBuilds.equals(countIntervalBuilds) || oldCalculationBuilds!=calculationBuilds) buildCalculation.reschedule(); }
private boolean isBranchChange() { if (!isEditedAction()) { return false; } JSONObject changes = this.payloadJson.getJSONObject("changes"); return !changes.isNullObject() && changes.containsKey("base"); }
@Override public void fromJson(JSONObject json) { super.fromJson(json); if (json.containsKey(UPLOADER)) { this.account = new Account(json.getJSONObject(UPLOADER)); } }
public static BaseClient getTarget(JSONObject json) { JSONObject api = json.getJSONObject(KEYS_API); JSONObject target = api.getJSONObject(KEYS_TARGET); if (target.containsKey(SUBJECT_ADMIN)) { return getACConverter().fromJSON(target); } if (target.containsKey(SUBJECT_CLIENT)) { return getClientConverter().fromJSON(target); } return null; }
private JSONObject getRCJSON(String[] rcodes) { JSONObject result = new JSONObject(); for (String rcode : rcodes) { int oldval = 0; if (result.containsKey(rcode)) { oldval = (Integer) result.get(rcode); } result.put(rcode, oldval + 1); } return result; }
@Override public void fromJson(JSONObject json) { super.fromJson(json); if (json.containsKey(UPLOADER)) { this.account = new Account(json.getJSONObject(UPLOADER)); } }
public JSONObject getClaims() { if(!getState().containsKey(CLAIMS_KEY)){ return new JSONObject(); } return getState().getJSONObject(CLAIMS_KEY); }
@Override public void fromJson(JSONObject json) { number = getString(json, NUMBER); revision = getString(json, REVISION); ref = getString(json, REF); if (json.containsKey(UPLOADER)) { uploader = new Account(json.getJSONObject(UPLOADER)); } }
@Override public void fromJson(JSONObject json) { project = getString(json, PROJECT); branch = getString(json, BRANCH); id = getString(json, ID); number = getString(json, NUMBER); subject = getString(json, SUBJECT); if (json.containsKey(OWNER)) { owner = new Account(json.getJSONObject(OWNER)); } url = getString(json, URL); }
@Override public void fromJson(JSONObject json) { project = getString(json, PROJECT); branch = getString(json, BRANCH); id = getString(json, ID); number = getString(json, NUMBER); subject = getString(json, SUBJECT); if (json.containsKey(OWNER)) { owner = new Account(json.getJSONObject(OWNER)); } url = getString(json, URL); }