List<RoleItem> funcs = role.getItems();
List<RoleItem> oldFuncs = readRole(role.getId(), cra);
Iterator<RoleItem> it = oldFuncs.iterator();
while (it.hasNext()) {
boolean funcRemoved = true;
RoleItem ori = it.next();
for (RoleItem ri : funcs) {
if (ri.getFunc().equalsIgnoreCase(ori.getFunc()) && ri.getSys().equalsIgnoreCase(ori.getSys())) {
funcRemoved = false;
continue; // role still exists
}
}
if (funcRemoved) {
RoleItemKey rik = new RoleItemKey(role.getId(), ori.getFunc(), ori.getSys(), ori.getRevNo());
deleteItem(rik, cra);
it.remove();
}
}
for (RoleItem ri : funcs) {
boolean funcAdded = true;
for (RoleItem ori : oldFuncs) {
if (ri.getFunc().equalsIgnoreCase(ori.getFunc()) && ri.getSys().equalsIgnoreCase(ori.getSys())) {
funcAdded = false;
continue; // role still exists
}
}
if (funcAdded) {