62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste/*
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * The contents of this file are subject to the terms of the Common Development and
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * Distribution License (the License). You may not use this file except in compliance with the
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * License.
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste *
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * specific language governing permission and limitations under the License.
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste *
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * When distributing Covered Software, include this CDDL Header Notice in each file and include
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * Header, with the fields enclosed by brackets [] replaced by your own identifying
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * information: "Portions copyright [year] [name of copyright owner]".
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste *
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * Copyright 2015 ForgeRock AS.
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste */
62639ee1329be2d687701dfa01fc006314440bf7Jaco Joostepackage com.sun.identity.console.audit;
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste
62639ee1329be2d687701dfa01fc006314440bf7Jaco Joosteimport static com.sun.identity.console.audit.AuditConsoleConstants.*;
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste
62639ee1329be2d687701dfa01fc006314440bf7Jaco Joosteimport com.iplanet.jato.RequestManager;
62639ee1329be2d687701dfa01fc006314440bf7Jaco Joosteimport com.sun.identity.console.audit.model.RealmAuditConfigModel;
62639ee1329be2d687701dfa01fc006314440bf7Jaco Joosteimport com.sun.identity.console.base.model.AMConsoleException;
62639ee1329be2d687701dfa01fc006314440bf7Jaco Joosteimport com.sun.identity.console.base.model.AMModel;
62639ee1329be2d687701dfa01fc006314440bf7Jaco Joosteimport com.sun.web.ui.view.alert.CCAlert;
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste
62639ee1329be2d687701dfa01fc006314440bf7Jaco Joosteimport javax.servlet.http.HttpServletRequest;
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste/**
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * Realm Audit configuration UI view bean.
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste *
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * @since 13.0.0
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste */
62639ee1329be2d687701dfa01fc006314440bf7Jaco Joostepublic class RealmEventHandlerAddViewBean extends AbstractEventHandlerAddViewBean {
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste private static final String DEFAULT_DISPLAY_URL = "/console/audit/RealmEventHandlerAdd.jsp";
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste private static final String PAGE_NAME = "RealmEventHandlerAdd";
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste /**
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste * Create a new {@code RealmEventHandlerAddViewBean}.
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste */
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste public RealmEventHandlerAddViewBean() {
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste super(PAGE_NAME, DEFAULT_DISPLAY_URL);
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste }
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste @Override
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste protected AMModel getModelInternal() {
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste HttpServletRequest req = RequestManager.getRequestContext().getRequest();
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste try {
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste return new RealmAuditConfigModel(req, getPageSessionAttributes());
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste } catch (AMConsoleException e) {
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste setInlineAlertMessage(CCAlert.TYPE_ERROR, ERROR_MESSAGE, e.getMessage());
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste }
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste return null;
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste }
62639ee1329be2d687701dfa01fc006314440bf7Jaco Jooste}