public static void addSEAPermResultsToJson(PermissionSet permset,
StringBuilder jsonBuild, String permCategory, int i) {
Iterator entityItter = null;
Iterator seaItter = null;
SetupEntityTypes seaName = null;
Map<SetupEntityTypes, Set<String>> seaPermMap = new HashMap();
StringBuilder permsetRoot = new StringBuilder();
permsetRoot.append("permset").append(i+1).append(SEA);
if (permCategory.equals(UNIQUE)) {
seaPermMap = permset.getSeaPermMap(ObjPermCategory.unique);
permsetRoot.append(UNIQUE);
} else if (permCategory.equals(COMMON)) {
seaPermMap = permset.getSeaPermMap(ObjPermCategory.common);
permsetRoot.append(COMMON);
} else if (permCategory.equals(DIFFERENCES)) {
seaPermMap = permset.getSeaPermMap(ObjPermCategory.differing);
permsetRoot.append(DIFFERENCES);
}
String permsetLabel = permsetRoot.toString();
jsonBuild.append(", ").append("\"" + permsetLabel + "\"").append(": [");
SortedSet<SetupEntityTypes> alphabeticalKeySet = new TreeSet<SetupEntityTypes>();
alphabeticalKeySet.addAll(seaPermMap.keySet());
seaItter = alphabeticalKeySet.iterator();
if (seaItter.hasNext()) {jsonBuild.append("{ \"success\": \"true\", \"text\": \"Setup Entities\", \"").append(permsetLabel).append("\": [ "); }
while (seaItter.hasNext()) {
seaName = (SetupEntityTypes) seaItter.next();
jsonBuild.append("{\"success\": \"true\", \"text\": \"").append(seaName.getDisplayName()).append("\", \"").append(permsetLabel).append("\": [");
SortedSet<String> alphabeticalEntitySet = new TreeSet<String>();
if (seaPermMap.containsKey(seaName)) {
alphabeticalEntitySet.addAll(seaPermMap.get(seaName));
} else {