/** * @param id consent id * @param label consent label/title (required) * @param description consent detailed description (optional, may be null) * @param required when true, no interaction with a document is allowed until this consent is granted * @param formFields form fields which are only available when this consent is granted */ public DefaultConsent(String id, String label, String description, boolean required, List<String> formFields) { this.id = id; this.label = label; this.description = processDescription(description); this.required = required; this.formFields = (formFields == null) ? null : Collections.unmodifiableList(formFields); validate(); }
/** * @param id consent id * @param label consent label/title (required) * @param description consent detailed description (optional, may be null) * @param required when true, no interaction with a document is allowed until this consent is granted * @param dataFields a list of values present in the UI Extensions * @param formFields form fields which are only available when this consent is granted */ public DefaultConsent(String id, String label, String description, boolean required, List<String> dataFields, List<String> formFields) { this.id = id; this.label = label; this.description = processDescription(description); this.required = required; this.dataFields = (dataFields == null) ? null : Collections.unmodifiableList(dataFields); this.formFields = (formFields == null) ? null : Collections.unmodifiableList(formFields); validate(); }
/** * A constructor from JSON representation. * * @param consentJSON JSON in the format produced by toJSON() */ public DefaultConsent(JSONObject consentJSON) { this.id = consentJSON.optString(JSON_KEY_ID); this.label = consentJSON.optString(JSON_KEY_LABEL); this.description = processDescription(consentJSON.optString(JSON_KEY_DESCRIPTION)); this.required = consentJSON.optBoolean(JSON_KEY_ISREQUIRED); setStatus(ConsentStatus.fromString(consentJSON.optString(JSON_KEY_ISREQUIRED))); JSONArray fields = consentJSON.optJSONArray(JSON_KEY_FIELDS); if (fields == null) { this.formFields = null; } else { this.formFields = new LinkedList<>(); for (Object field : fields) { this.formFields.add((String) field); } } validate(); }
this.description = processDescription(consentJSON.optString(JSON_KEY_DESCRIPTION)); this.required = consentJSON.optBoolean(JSON_KEY_ISREQUIRED); setStatus(ConsentStatus.fromString(consentJSON.optString(JSON_KEY_STATUS)));