@Override public JSONObject toJSON() { JSONObject json = new JSONObject(); json.put(JSON_KEY_ID, this.getId()); json.put(JSON_KEY_LABEL, this.getLabel()); json.put(JSON_KEY_DESCRIPTION, this.getDescription()); json.put(JSON_KEY_ISREQUIRED, this.isRequired()); json.put(JSON_KEY_STATUS, this.getStatus().toString()); if (this.formFields != null) { JSONArray fields = new JSONArray(this.formFields); json.put(JSON_KEY_FIELDS, fields); } return json; }
@Override public JSONObject toJSON() { JSONObject json = new JSONObject(); json.put(JSON_KEY_ID, this.getId()); json.put(JSON_KEY_LABEL, this.getLabel()); json.put(JSON_KEY_DESCRIPTION, this.getDescription()); json.put(JSON_KEY_ISREQUIRED, this.isRequired()); json.put(JSON_KEY_STATUS, this.getStatus().toString()); if (this.dataFields != null) { JSONArray dFields = new JSONArray(this.dataFields); json.put(JSON_KEY_DATAFIELDS, dFields); } if (this.formFields != null) { JSONArray fields = new JSONArray(this.formFields); json.put(JSON_KEY_FIELDS, fields); } return json; }
/** * Copies an instance of {@link Consent} to a new instance. * * @param status the consent whose state is to be copied * @return an instance which is identical to the `from` instance */ @Override public Consent copy(ConsentStatus status) { Consent copy = new DefaultConsent( this.getId(), this.getLabel(), this.getDescription(), this.isRequired(), this.getFields()); copy.setStatus(status); return copy; } }
/** * Copies an instance of {@link Consent} to a new instance. * * @param status the consent whose state is to be copied * @return an instance which is identical to the `from` instance */ @Override public Consent copy(ConsentStatus status) { Consent copy = new DefaultConsent( this.getId(), this.getLabel(), this.getDescription(), this.isRequired(), this.getDataFields(), this.getFields()); copy.setStatus(status); return copy; } }