Cleanup sponge files and don't persist empty sections - resolves #96
This commit is contained in:
parent
0ae59bd3e6
commit
fc4750706b
@ -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) {
|
public SubjectDataHolder(Map<ImmutableContextSet, Map<String, String>> options, Map<ImmutableContextSet, Map<String, Boolean>> permissions, Map<ImmutableContextSet, Set<SubjectReference>> parents) {
|
||||||
this.options = new HashMap<>();
|
this.options = new HashMap<>();
|
||||||
for (Map.Entry<ImmutableContextSet, Map<String, String>> e : options.entrySet()) {
|
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<>();
|
this.permissions = new HashMap<>();
|
||||||
for (Map.Entry<ImmutableContextSet, Map<String, Boolean>> e : permissions.entrySet()) {
|
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<>();
|
this.parents = new HashMap<>();
|
||||||
for (Map.Entry<ImmutableContextSet, Set<SubjectReference>> e : parents.entrySet()) {
|
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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user