Cleanup sponge files and don't persist empty sections - resolves #96

This commit is contained in:
Luck 2016-12-21 21:33:32 +00:00
parent 0ae59bd3e6
commit fc4750706b
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -47,17 +47,23 @@ public class SubjectDataHolder {
public SubjectDataHolder(Map<ImmutableContextSet, Map<String, String>> options, Map<ImmutableContextSet, Map<String, Boolean>> permissions, Map<ImmutableContextSet, Set<SubjectReference>> parents) {
this.options = new HashMap<>();
for (Map.Entry<ImmutableContextSet, Map<String, String>> e : options.entrySet()) {
this.options.put(e.getKey().toMap(), new HashMap<>(e.getValue()));
if (!e.getValue().isEmpty()) {
this.options.put(e.getKey().toMap(), new HashMap<>(e.getValue()));
}
}
this.permissions = new HashMap<>();
for (Map.Entry<ImmutableContextSet, Map<String, Boolean>> e : permissions.entrySet()) {
this.permissions.put(e.getKey().toMap(), new HashMap<>(e.getValue()));
if (!e.getValue().isEmpty()) {
this.permissions.put(e.getKey().toMap(), new HashMap<>(e.getValue()));
}
}
this.parents = new HashMap<>();
for (Map.Entry<ImmutableContextSet, Set<SubjectReference>> e : parents.entrySet()) {
this.parents.put(e.getKey().toMap(), e.getValue().stream().map(SubjectReference::serialize).collect(Collectors.toList()));
if (!e.getValue().isEmpty()) {
this.parents.put(e.getKey().toMap(), e.getValue().stream().map(SubjectReference::serialize).collect(Collectors.toList()));
}
}
}