Commit be311f23 authored by George Kalampokis's avatar George Kalampokis
Browse files

Add visibility rules checkup on dataset finalize checkup

parent 54838477
......@@ -673,9 +673,18 @@ public class DatasetManager {
datasetProfileValidators.add(node.getNodeValue());
}
JSONObject obj = new JSONObject(dataset.getProperties());
VisibilityRuleService visibilityRuleService = this.apiContext.getUtilitiesService().getVisibilityRuleService();
visibilityRuleService.setProperties(obj.toMap());
dataset.setProfile(profile);
PagedDatasetProfile pagedDatasetProfile = this.getPagedProfile(new DatasetWizardModel(), dataset);
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
for (String validator : datasetProfileValidators) {
if (obj.getString(validator) == null || obj.getString(validator).trim().isEmpty()) {
if ((obj.getString(validator) == null || obj.getString(validator).trim().isEmpty()) && visibilityRuleService.isElementVisible(validator)) {
throw new Exception("Field value of " + validator + " must be filled.");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment