return policyModel;
}
public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
MessageForm mf = (MessageForm)form;
Realm realm = getSessionInfo(request).getUser().getRealm();
Message msg = new Message(mf.getSubject(), mf.getContent(), mf.getUrgent());
for(Iterator i = mf.getSelectedAccountsList().iterator(); i.hasNext(); ) {
msg.getRecipients().add(new Recipient(Recipient.USER, (String)i.next(), realm.getResourceName()));
}
for(Iterator i = mf.getSelectedRolesList().iterator(); i.hasNext(); ) {
msg.getRecipients().add(new Recipient(Recipient.ROLE, (String)i.next(), realm.getResourceName()));
}
for(Iterator i = mf.getSelectedPoliciesList().iterator(); i.hasNext(); ) {
String policyName = PolicyDatabaseFactory.getInstance().getPolicy(Integer.parseInt((String)i.next())).getResourceName();
msg.getRecipients().add(new Recipient(Recipient.POLICY, policyName, realm.getResourceName()));
}
if(msg.getRecipients().size() == 0) {
throw new Exception("No recipients in any of the accounts, roles or policies selected.");
}
if(mf.getSelectedSink().equals("*")) {
CoreServlet.getServlet().getNotifier().sendToAll(msg);
}
else if(mf.getSelectedSink().equals("^")) {
CoreServlet.getServlet().getNotifier().sendToFirst(msg);
}
else {
CoreServlet.getServlet().getNotifier().sendToSink(mf.getSelectedSink(), msg);
}
return cancel(mapping, form, request, response);
}