}
@Override
public void readForm(PageRightsForm form, ActionMessages errors, HttpServletRequest request)
{
RoleVO role = (RoleVO) getPanel().getEntity();
// entferne zuerst alle Rechte
role.getRights().clear();
for (int i = 0; i < form.getRights().length; i++)
{
// f�ge die neuen Rechte hinzu
try
{
RightVO right = new RightDAO().getById(new Integer(form.getRights()[i]));
role.getRights().add(right);
if (log.isDebugEnabled())
log.debug("added right: " + right);
}
catch (HibernateException e)
{
log.error("could not load role for id: " + form.getRights()[i], e);
}
}
// f�ge alle fehlenden Lese-Rechte hinzu
HashSet<RightVO> missingRights = new HashSet<RightVO>();
for(RightVO right : role.getRights()) {
if(RightVO.Type.WRITE.equals(right.getType())) {
RightVO readRight = new RightDAO().getReadRightForRightGroup(right.getRightGroup());
if(!role.getRights().contains(readRight)) {
missingRights.add(readRight);
}
}
}
if(!missingRights.isEmpty()) {
if(log.isDebugEnabled())
log.debug("add "+missingRights.size()+" missing rights");
role.getRights().addAll(missingRights);
}
}