public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
// Do the install
List<WizardActionStatus> actionStatus = new ArrayList<WizardActionStatus>();
AbstractWizardSequence seq = getWizardSequence(request);
String policyName = (String) seq.getAttribute(PolicyDetailsForm.ATTR_RESOURCE_NAME, null);
String policyDescription = (String) seq.getAttribute(PolicyDetailsForm.ATTR_RESOURCE_DESCRIPTION, null);
try {
Policy pol =PolicyDatabaseFactory.getInstance().createPolicy(policyName, policyDescription, Policy.TYPE_NORMAL, getSessionInfo(request).getUser().getRealm().getRealmID());
actionStatus.add(new WizardActionStatus(WizardActionStatus.COMPLETED_OK,
"policyWizard.policyFinish.status.policyCreated"));
CoreEvent coreEvent = new ResourceChangeEvent(this, CoreEventConstants.CREATE_POLICY, pol, getSessionInfo(request),
CoreEvent.STATE_SUCCESSFUL);
CoreServlet.getServlet().fireCoreEvent(coreEvent);
try {
UserDatabase udb = UserDatabaseManager.getInstance().getUserDatabase(LogonControllerFactory.getInstance().getSessionInfo(request).getUser().getRealm());
for (Iterator i = ((PropertyList) seq.getAttribute(PolicyPrincipalSelectionForm.ATTR_SELECTED_ACCOUNTS, null))
.iterator(); i.hasNext();) {
User user = udb.getAccount((String) i.next());
PolicyDatabaseFactory.getInstance().grantPolicyToPrincipal(pol,
user);
CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.GRANT_POLICY_TO_PRINCIPAL, pol, getSessionInfo(request),
CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_TYPE, "user").addAttribute(
CoreAttributeConstants.EVENT_ATTR_POLICY_NAME,
pol.getResourceName()).addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_ID, user.getPrincipalName()));
}
for (Iterator i = ((PropertyList) seq.getAttribute(PolicyPrincipalSelectionForm.ATTR_SELECTED_ROLES, null))
.iterator(); i.hasNext();) {
Role role = udb.getRole((String) i.next());
PolicyDatabaseFactory.getInstance().grantPolicyToPrincipal(pol,
role);