if (cb.isChecked() == true) {
// Get the object by casting
SecRight right = (SecRight) listitem.getAttribute("data");
// get the group
SecGroup group = getSelectedGroup();
// check if the item is newly checked. If so we cannot found
// it in the SecGroupRight-table
SecGroupright groupRight = getSecurityService().getGroupRightByGroupAndRight(group, right);
// if new, we make a newly Object
if (groupRight == null) {
groupRight = getSecurityService().getNewSecGroupright();
groupRight.setSecGroup(group);
groupRight.setSecRight(right);
}
// save to DB
try {
getSecurityService().saveOrUpdate(groupRight);
} catch (DataAccessException e) {
ZksampleMessageUtils.showErrorMessage(e.getMostSpecificCause().toString());
}
} else if (cb.isChecked() == false) {
// Get the object by casting
SecRight right = (SecRight) listitem.getAttribute("data");
// get the group
SecGroup group = getSelectedGroup();
// check if the item is newly unChecked. If so we must found
// it in the SecGroupRight-table
SecGroupright groupRight = getSecurityService().getGroupRightByGroupAndRight(group, right);